summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.h
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2012-12-17 13:16:59 +0100
committerAdam Borowski <kilobyte@angband.pl>2012-12-17 13:26:41 +0100
commit2a677709eed5238f1ca6754770e52343286d68eb (patch)
treeaf0a7a07b9918ce4bb1387f29ca97f9953328260 /crawl-ref/source/tags.h
parent8f1bf02ff69b91399f66c8542e115848ba0d79bb (diff)
downloadcrawl-ref-2a677709eed5238f1ca6754770e52343286d68eb.tar.gz
crawl-ref-2a677709eed5238f1ca6754770e52343286d68eb.zip
Revert "Remove unused option to ignore write errors for save fragments."
Wasn't unused after all. This reverts commit 85c029f90f2150304624966408f27ed03fa557e6. This reverts commit 8f1bf02ff69b91399f66c8542e115848ba0d79bb.
Diffstat (limited to 'crawl-ref/source/tags.h')
-rw-r--r--crawl-ref/source/tags.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h
index a868cd2a7b..dac3e29706 100644
--- a/crawl-ref/source/tags.h
+++ b/crawl-ref/source/tags.h
@@ -35,16 +35,18 @@ enum tag_type // used during save/load process to identify data blocks
class writer
{
public:
- writer(const string &filename, FILE* output)
- : _filename(filename), _file(output), _chunk(0), _pbuf(0)
+ writer(const string &filename, FILE* output, bool ignore_errors = false)
+ : _filename(filename), _file(output), _chunk(0),
+ _ignore_errors(ignore_errors), _pbuf(0), failed(false)
{
ASSERT(output);
}
writer(vector<unsigned char>* poutput)
- : _filename(), _file(0), _chunk(0), _pbuf(poutput)
- { ASSERT(poutput); }
+ : _filename(), _file(0), _chunk(0), _ignore_errors(false),
+ _pbuf(poutput), failed(false) { ASSERT(poutput); }
writer(package *save, const string &chunkname)
- : _filename(), _file(0), _chunk(0)
+ : _filename(), _file(0), _chunk(0), _ignore_errors(false),
+ failed(false)
{
ASSERT(save);
_chunk = save->writer(chunkname);
@@ -56,6 +58,8 @@ public:
void write(const void *data, size_t size);
long tell();
+ bool succeeded() const { return !failed; }
+
private:
void check_ok(bool ok);
@@ -63,8 +67,11 @@ private:
string _filename;
FILE* _file;
chunk_writer *_chunk;
+ bool _ignore_errors;
vector<unsigned char>* _pbuf;
+
+ bool failed;
};
void marshallByte (writer &, int8_t);