Fix for bug #2828333 (AGI: KQ1: Greensleeves always plays):

- Made all savegame loading in AGI do the same pre-load and post-load stuff.
- Moved load/saveGameState from AgiBase to AgiEngine
- Added rudimentary error handling to load/saveGameState
- Incidentally also fixes the hanging note from bug #2798797.

svn-id: r43025
This commit is contained in:
Kari Salminen 2009-08-03 17:18:18 +00:00
parent 1cf0eb1727
commit 9931fb6a44
3 changed files with 30 additions and 16 deletions

View file

@ -972,6 +972,9 @@ void AgiEngine::checkQuickLoad() {
snprintf (saveNameBuffer, 256, "%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot"));
_sprites->eraseBoth();
_sound->stopSound();
if (loadGame(saveNameBuffer, false) == errOK) { // Do not check game id
_game.exitAllLogics = 1;
_menu->enableAll();
@ -979,4 +982,29 @@ void AgiEngine::checkQuickLoad() {
}
}
Common::Error AgiEngine::loadGameState(int slot) {
static char saveLoadSlot[12];
sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), slot);
_sprites->eraseBoth();
_sound->stopSound();
if (loadGame(saveLoadSlot) == errOK) {
_game.exitAllLogics = 1;
_menu->enableAll();
return Common::kNoError;
} else {
return Common::kUnknownError;
}
}
Common::Error AgiEngine::saveGameState(int slot, const char *desc) {
static char saveLoadSlot[12];
sprintf(saveLoadSlot, "%s.%.3d", _targetName.c_str(), slot);
if (saveGame(saveLoadSlot, desc) == errOK)
return Common::kNoError;
else
return Common::kUnknownError;
}
} // End of namespace Agi