diff options
author | Julien Templier | 2010-10-27 19:19:38 +0000 |
---|---|---|
committer | Julien Templier | 2010-10-27 19:19:38 +0000 |
commit | d5e4ab6b209b1e2a847993ce40a4c015e795b168 (patch) | |
tree | 06075eaa59e282243a6089e6207c8592edd71705 /engines/lastexpress/game/sound.cpp | |
parent | dba75791d9fcda63c546975fa98da4bc64afce7d (diff) | |
download | scummvm-rg350-d5e4ab6b209b1e2a847993ce40a4c015e795b168.tar.gz scummvm-rg350-d5e4ab6b209b1e2a847993ce40a4c015e795b168.tar.bz2 scummvm-rg350-d5e4ab6b209b1e2a847993ce40a4c015e795b168.zip |
LASTEXPRESS: Cleanup game saving
- Move loading of game stream to separate function
- Add checks for NULL in functions using _savegame
- Add expected saved size for sound & savepoints
svn-id: r53881
Diffstat (limited to 'engines/lastexpress/game/sound.cpp')
-rw-r--r-- | engines/lastexpress/game/sound.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/engines/lastexpress/game/sound.cpp b/engines/lastexpress/game/sound.cpp index 1bfba0ca4b..3c87978657 100644 --- a/engines/lastexpress/game/sound.cpp +++ b/engines/lastexpress/game/sound.cpp @@ -508,14 +508,8 @@ void SoundManager::saveLoadWithSerializer(Common::Serializer &s) { s.syncAsUint32LE(_currentType); // Compute the number of entries to save - uint32 count = 0; - if (s.isSaving()) { - for (Common::List<SoundEntry *>::iterator i = _cache.begin(); i != _cache.end(); ++i) - if ((*i)->name2.matchString("NISSND?")) - ++count; - } - - s.syncAsUint32LE(count); + uint32 numEntries = count(); + s.syncAsUint32LE(numEntries); // Save or load each entry data if (s.isSaving()) { @@ -551,6 +545,15 @@ void SoundManager::saveLoadWithSerializer(Common::Serializer &s) { } } +uint32 SoundManager::count() { + uint32 numEntries = 0; + for (Common::List<SoundEntry *>::iterator i = _cache.begin(); i != _cache.end(); ++i) + if ((*i)->name2.matchString("NISSND?")) + ++numEntries; + + return numEntries; +} + ////////////////////////////////////////////////////////////////////////// // Game-related functions ////////////////////////////////////////////////////////////////////////// |