summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tags.h
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-16 11:58:18 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-12-16 11:58:18 +0000
commit8376e440396796e596cdd49b0d539b5fb48f16f0 (patch)
treef0298a62dad2a8a69057db7f5f71fd04c6359561 /crawl-ref/source/tags.h
parent1ece2e1bb923cba7ce186e93de54fc8dc78b1cd2 (diff)
downloadcrawl-ref-8376e440396796e596cdd49b0d539b5fb48f16f0.tar.gz
crawl-ref-8376e440396796e596cdd49b0d539b5fb48f16f0.zip
Fixed crashes when searching for randarts in stash-tracker.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3078 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tags.h')
-rw-r--r--crawl-ref/source/tags.h39
1 files changed, 25 insertions, 14 deletions
diff --git a/crawl-ref/source/tags.h b/crawl-ref/source/tags.h
index df4c3d754b..cdf72df75b 100644
--- a/crawl-ref/source/tags.h
+++ b/crawl-ref/source/tags.h
@@ -44,6 +44,17 @@ struct tagHeader
{
short tagID;
long offset;
+
+ // File handle for direct file writes.
+ FILE *file;
+
+ tagHeader() : tagID(0), offset(0L), file(NULL) { }
+ tagHeader(FILE *f) : tagID(0), offset(0L), file(f) { }
+ unsigned char readByte();
+ void writeByte(unsigned char byte);
+ void write(const void *data, size_t size);
+ void read(void *data, size_t size);
+ void advance(int skip);
};
// last updated 22jan2001 {gdl}
@@ -64,12 +75,12 @@ int read2(FILE * file, char *buffer, unsigned int count);
/* ***********************************************************************
* called from: files tags
* *********************************************************************** */
-void marshallByte(struct tagHeader &th, char data);
-void marshallShort(struct tagHeader &th, short data);
-void marshallLong(struct tagHeader &th, long data);
-void marshallFloat(struct tagHeader &th, float data);
-void marshallBoolean(struct tagHeader &th, bool data);
-void marshallString(struct tagHeader &th, const std::string &data,
+void marshallByte(tagHeader &th, char data);
+void marshallShort(tagHeader &th, short data);
+void marshallLong(tagHeader &th, long data);
+void marshallFloat(tagHeader &th, float data);
+void marshallBoolean(tagHeader &th, bool data);
+void marshallString(tagHeader &th, const std::string &data,
int maxSize = 0);
void marshallCoord(tagHeader &th, const coord_def &c);
void marshallItem(tagHeader &th, const item_def &item);
@@ -78,12 +89,12 @@ void marshallItem(tagHeader &th, const item_def &item);
/* ***********************************************************************
* called from: tags files
* *********************************************************************** */
-char unmarshallByte(struct tagHeader &th);
-short unmarshallShort(struct tagHeader &th);
-long unmarshallLong(struct tagHeader &th);
-float unmarshallFloat(struct tagHeader &th);
-bool unmarshallBoolean(struct tagHeader &th);
-int unmarshallCString(struct tagHeader &th, char *data, int maxSize);
+char unmarshallByte(tagHeader &th);
+short unmarshallShort(tagHeader &th);
+long unmarshallLong(tagHeader &th);
+float unmarshallFloat(tagHeader &th);
+bool unmarshallBoolean(tagHeader &th);
+int unmarshallCString(tagHeader &th, char *data, int maxSize);
std::string unmarshallString(tagHeader &th, int maxSize = 1000);
void unmarshallCoord(tagHeader &th, coord_def &c);
void unmarshallItem(tagHeader &th, item_def &item);
@@ -102,14 +113,14 @@ void tag_init(long largest_tag = 100000);
/* ***********************************************************************
* called from: files
* *********************************************************************** */
-void tag_construct(struct tagHeader &th, int i);
+void tag_construct(tagHeader &th, int i);
// last updated 22jan2001 {gdl}
/* ***********************************************************************
* called from: files
* *********************************************************************** */
-void tag_write(struct tagHeader &th, FILE *saveFile);
+void tag_write(tagHeader &th, FILE *saveFile);
// last updated 22jan2001 {gdl}