summaryrefslogtreecommitdiff
path: root/saveload.h
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-03-02 00:32:48 +0000
committerDarkvater <darkvater@openttd.org>2006-03-02 00:32:48 +0000
commit903c3aa63d71cfcf9560715b8fb41724d86c07e3 (patch)
tree6ad37c31a548b6c9554beca6f072de8478242d16 /saveload.h
parentf83f192309542b306e874cf7d4dedc74e6384e62 (diff)
downloadopenttd-903c3aa63d71cfcf9560715b8fb41724d86c07e3.tar.xz
(svn r3721) - [3/4] Present the game with a unified structure for the configuration-ini, saveload, console and gui representations of the settings. From part 3 on, OpenTTD is once again compilable.
- Code has been added to the saveload code to honour the SLF_SAVE_NO and SLF_NETWORK_NO flags. SLF_NETWORK_NO just reads in the the bytestream and then discards it because that setting is not synchronised. For this the function SlSkipBytes() has been reinstated - SAVEGAME_VERSION has been changed from a constant ENUM to a constant integer. This was done for the configuration-code to be able to tell which version of a CONDVAR type to handle. As said before, because settings can be saved to the savegame, they will become conditional at some point. The configuration code always has to read the 'most recent' version. - GameOptions are saved through the new structure. It is fully compatible with any old savegame...however it is better. Because of the move to this new format we can instruct the loader to skip certain variables. Autosave for example isn't synchronised anymore (in the network). The same goes for currency and kilometers :D. That is the only functionality change this patch is supposed to have if I have written it correctly. - NOTE! Patches are still not saved so for Multiplayer to work network_client.c and network_server.c needed slight modifications.
Diffstat (limited to 'saveload.h')
-rw-r--r--saveload.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/saveload.h b/saveload.h
index e56d25876..077f3c84c 100644
--- a/saveload.h
+++ b/saveload.h
@@ -230,6 +230,16 @@ static inline bool CheckSavegameVersion(uint16 version)
return _sl_version < version;
}
+/** Checks if some version from/to combination falls within the range of the
+ * active savegame version */
+static inline bool SlIsObjectCurrentlyValid(uint16 version_from, uint16 version_to)
+{
+ extern const uint16 SAVEGAME_VERSION;
+ if (SAVEGAME_VERSION < version_from || SAVEGAME_VERSION > version_to) return false;
+
+ return true;
+}
+
/* Get the NumberType of a setting. This describes the integer type
* as it is represented in memory
* @param type VarType holding information about the variable-type