diff options
author | yexo <yexo@openttd.org> | 2011-10-30 13:47:45 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2011-10-30 13:47:45 +0000 |
commit | 433f74edd9fd3d9f3fed5cf09c7d6c510600b0aa (patch) | |
tree | 41ce1db0b149196cbda1c78d8abf9d6e720042d2 /src/saveload | |
parent | bd6d490987fe6767b8bb07ef9bf7753049c0c564 (diff) | |
download | openttd-433f74edd9fd3d9f3fed5cf09c7d6c510600b0aa.tar.xz |
(svn r23065) -Add: -q option to read a savegame, write some general info and exit
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/gamelog_sl.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/saveload/gamelog_sl.cpp b/src/saveload/gamelog_sl.cpp index 0218a5a20..f25a8d1eb 100644 --- a/src/saveload/gamelog_sl.cpp +++ b/src/saveload/gamelog_sl.cpp @@ -11,6 +11,7 @@ #include "../stdafx.h" #include "../gamelog_internal.h" +#include "../fios.h" #include "saveload.h" @@ -101,15 +102,15 @@ static const SaveLoad * const _glog_desc[] = { assert_compile(lengthof(_glog_desc) == GLCT_END); -static void Load_GLOG() +static void Load_GLOG_common(LoggedAction *&gamelog_action, uint &gamelog_actions) { - assert(_gamelog_action == NULL); - assert(_gamelog_actions == 0); + assert(gamelog_action == NULL); + assert(gamelog_actions == 0); GamelogActionType at; while ((at = (GamelogActionType)SlReadByte()) != GLAT_NONE) { - _gamelog_action = ReallocT(_gamelog_action, _gamelog_actions + 1); - LoggedAction *la = &_gamelog_action[_gamelog_actions++]; + gamelog_action = ReallocT(gamelog_action, gamelog_actions + 1); + LoggedAction *la = &gamelog_action[gamelog_actions++]; la->at = at; @@ -165,7 +166,16 @@ static void Save_GLOG() SlWriteByte(GLAT_NONE); } +static void Load_GLOG() +{ + Load_GLOG_common(_gamelog_action, _gamelog_actions); +} + +static void Check_GLOG() +{ + Load_GLOG_common(_load_check_data.gamelog_action, _load_check_data.gamelog_actions); +} extern const ChunkHandler _gamelog_chunk_handlers[] = { - { 'GLOG', Save_GLOG, Load_GLOG, NULL, NULL, CH_RIFF | CH_LAST } + { 'GLOG', Save_GLOG, Load_GLOG, NULL, Check_GLOG, CH_RIFF | CH_LAST } }; |