summaryrefslogtreecommitdiff
path: root/saveload.h
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-28 11:51:31 +0000
committertruelight <truelight@openttd.org>2004-12-28 11:51:31 +0000
commitc2ee8d70e48a79a1f3fbe4003c82a545a29ae195 (patch)
tree31c4abf8c556a50cc2cb6846bddb8f40f21986c9 /saveload.h
parent41201f488c6eb3d4862f49f419ccd9915c46c162 (diff)
downloadopenttd-c2ee8d70e48a79a1f3fbe4003c82a545a29ae195.tar.xz
(svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
an uint8 till the savegame version is bumped to version 5. Then it works automaticly as a fully uint16. So _stations[] can not be increased till after the bump!!
Diffstat (limited to 'saveload.h')
-rw-r--r--saveload.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/saveload.h b/saveload.h
index 4bacf895e..d9ba00765 100644
--- a/saveload.h
+++ b/saveload.h
@@ -1,6 +1,8 @@
#ifndef SAVELOAD_H
#define SAVELOAD_H
+#include <setjmp.h>
+
typedef void ChunkSaveLoadProc();
typedef void AutolengthProc(void *arg);
@@ -23,6 +25,49 @@ typedef struct {
byte null;
} NullStruct;
+typedef void WriterProc(uint len);
+typedef uint ReaderProc();
+
+typedef uint ReferenceToIntProc(void *v, uint t);
+typedef void *IntToReferenceProc(uint r, uint t);
+
+typedef struct {
+ bool save;
+ byte need_length;
+ byte block_mode;
+ bool error;
+ byte version;
+
+ int obj_len;
+ int array_index, last_array_index;
+
+ uint32 offs_base;
+
+ WriterProc *write_bytes;
+ ReaderProc *read_bytes;
+
+ ReferenceToIntProc *ref_to_int_proc;
+ IntToReferenceProc *int_to_ref_proc;
+
+ const ChunkHandler * const * chs;
+ const byte * const *includes;
+
+ byte *bufp, *bufe;
+
+ int tmp;
+
+ // these 3 may be used by compressor/decompressors.
+ byte *buf; // pointer and size to read/write, initialized by init
+ uint bufsize;
+ FILE *fh;
+
+ void (*excpt_uninit)();
+ const char *excpt_msg;
+ jmp_buf excpt; // used to jump to "exception handler"
+} SaverLoader;
+
+extern SaverLoader _sl;
+
enum {
REF_SCHEDULE = 0,
REF_VEHICLE = 1,