diff options
author | Filippos Karapetis | 2010-06-15 07:25:09 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-06-15 07:25:09 +0000 |
commit | 0dab9e0e1f39b856a0b996dfa2c3103fe0dbfe2f (patch) | |
tree | cda57a4989207fbda07a8e4041a7515124352367 | |
parent | 60d8cc5180c4033978e1bb38e6cc26dab8a126b2 (diff) | |
download | scummvm-rg350-0dab9e0e1f39b856a0b996dfa2c3103fe0dbfe2f.tar.gz scummvm-rg350-0dab9e0e1f39b856a0b996dfa2c3103fe0dbfe2f.tar.bz2 scummvm-rg350-0dab9e0e1f39b856a0b996dfa2c3103fe0dbfe2f.zip |
Reorganized functions a bit
svn-id: r49685
-rw-r--r-- | engines/sci/engine/savegame.cpp | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 34457a819f..89bfa5302d 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -738,33 +738,6 @@ void StringTable::saveLoadWithSerializer(Common::Serializer &ser) { } #endif -#pragma mark - - - -int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) { - TimeDate curTime; - g_system->getTimeAndDate(curTime); - - SavegameMetadata meta; - meta.savegame_version = CURRENT_SAVEGAME_VERSION; - meta.savegame_name = savename; - meta.game_version = version; - meta.savegame_date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF); - meta.savegame_time = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF); - - if (s->executionStackBase) { - warning("Cannot save from below kernel function"); - return 1; - } - - Common::Serializer ser(0, fh); - sync_SavegameMetadata(ser, meta); - Graphics::saveThumbnail(*fh); - s->saveLoadWithSerializer(ser); // FIXME: Error handling? - - return 0; -} - void SegManager::reconstructStack(EngineState *s) { DataStack *stack = (DataStack *)(_heap[findSegmentByType(SEG_TYPE_STACK)]); s->stack_base = stack->_entries; @@ -874,6 +847,34 @@ static void reconstruct_sounds(EngineState *s) { } #endif + +#pragma mark - + + +int gamestate_save(EngineState *s, Common::WriteStream *fh, const char* savename, const char *version) { + TimeDate curTime; + g_system->getTimeAndDate(curTime); + + SavegameMetadata meta; + meta.savegame_version = CURRENT_SAVEGAME_VERSION; + meta.savegame_name = savename; + meta.game_version = version; + meta.savegame_date = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF); + meta.savegame_time = ((curTime.tm_hour & 0xFF) << 16) | (((curTime.tm_min) & 0xFF) << 8) | ((curTime.tm_sec) & 0xFF); + + if (s->executionStackBase) { + warning("Cannot save from below kernel function"); + return 1; + } + + Common::Serializer ser(0, fh); + sync_SavegameMetadata(ser, meta); + Graphics::saveThumbnail(*fh); + s->saveLoadWithSerializer(ser); // FIXME: Error handling? + + return 0; +} + void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { #ifdef USE_OLD_MUSIC_FUNCTIONS SongLibrary temp; |