diff options
author | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-06-14 00:45:43 +0530 |
---|---|---|
committer | Darshan Shaligram <dshaligram@users.sourceforge.net> | 2010-06-14 03:00:42 +0530 |
commit | 8daa06edec80533c60f919ec2d927e2f0d42186d (patch) | |
tree | b61bf4da055263f9ebfb99f346206d72cf5262b4 /crawl-ref/source/tags.h | |
parent | b115954e0e5c6e2f76a18cc1fedb9418c2d42964 (diff) | |
download | crawl-ref-8daa06edec80533c60f919ec2d927e2f0d42186d.tar.gz crawl-ref-8daa06edec80533c60f919ec2d927e2f0d42186d.zip |
Make Crawl react better to seeing des files and database text files modified and recompiled by new Crawl processes while older processes are running.
When mapdef.cc detects that a .dsc file is out of sync, it throws an exception
that dungeon.cc catches. dungeon.cc then discards all loaded maps and reloads
then from the map index (.idx) files.
The old behaviour was to create a panic save and exit for out-of-sync .dsc
files, which is not ideal since the panic save code is rarely used and tends to
bitrot.
When regenerating text database files in DGL installs, the game no longer
unlinks the old .db file, and will instead update the old file with the
new db keys.
None of this code should be relevant to single-user installs.
Diffstat (limited to 'crawl-ref/source/tags.h')
-rw-r--r-- | crawl-ref/source/tags.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h index 7b82757049..a884317022 100644 --- a/crawl-ref/source/tags.h +++ b/crawl-ref/source/tags.h @@ -133,20 +133,25 @@ inline void marshallEnum(writer& wr, enm value) class reader { public: + reader(const std::string &filename, char minorVersion = TAG_MINOR_VERSION); reader(FILE* input, char minorVersion = TAG_MINOR_VERSION) - : _file(input), _pbuf(0), _read_offset(0), + : _file(input), opened_file(false), _pbuf(0), _read_offset(0), _minorVersion(minorVersion) {} reader(const std::vector<unsigned char>& input, char minorVersion = TAG_MINOR_VERSION) - : _file(0), _pbuf(&input), _read_offset(0), + : _file(0), opened_file(false), _pbuf(&input), _read_offset(0), _minorVersion(minorVersion) {} + ~reader(); unsigned char readByte(); void read(void *data, size_t size); + void advance(size_t size); char getMinorVersion(); + bool valid() const; private: FILE* _file; + bool opened_file; const std::vector<unsigned char>* _pbuf; unsigned int _read_offset; char _minorVersion; |