Fix bug #1745396: "MI: Saved game from the credits sequence fails to load".

Now we specifically disallow saves in room 0 for all v4+ games. Original
has exactly this check in all versions, and such games are impossible to load.

Still the problem is not resolved for v0-v3 and HE games.

svn-id: r42664
This commit is contained in:
Eugene Sandulenko 2009-07-22 19:25:53 +00:00
parent 0932497cca
commit 9b031982cf
3 changed files with 18 additions and 1 deletions

View file

@ -439,7 +439,7 @@ ScummMenuDialog::ScummMenuDialog(ScummEngine *scumm)
new GUI::ButtonWidget(this, "ScummMain.Resume", "Resume", kPlayCmd, 'P'); new GUI::ButtonWidget(this, "ScummMain.Resume", "Resume", kPlayCmd, 'P');
new GUI::ButtonWidget(this, "ScummMain.Load", "Load", kLoadCmd, 'L'); new GUI::ButtonWidget(this, "ScummMain.Load", "Load", kLoadCmd, 'L');
new GUI::ButtonWidget(this, "ScummMain.Save", "Save", kSaveCmd, 'S'); _saveButton = new GUI::ButtonWidget(this, "ScummMain.Save", "Save", kSaveCmd, 'S');
new GUI::ButtonWidget(this, "ScummMain.Options", "Options", kOptionsCmd, 'O'); new GUI::ButtonWidget(this, "ScummMain.Options", "Options", kOptionsCmd, 'O');
#ifndef DISABLE_HELP #ifndef DISABLE_HELP
@ -471,6 +471,15 @@ ScummMenuDialog::~ScummMenuDialog() {
delete _loadDialog; delete _loadDialog;
} }
void ScummMenuDialog::reflowLayout() {
// For v4+ games do not allow to save in room 0 just as original did.
// It is not possible to load such saves
if ((_vm->_game.version >= 4) && (_vm->_currentRoom == 0))
_saveButton->setEnabled(false);
Dialog::reflowLayout();
}
void ScummMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { void ScummMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) { switch (cmd) {
case kSaveCmd: case kSaveCmd:

View file

@ -88,6 +88,8 @@ public:
~ScummMenuDialog(); ~ScummMenuDialog();
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
virtual void reflowLayout();
protected: protected:
ScummEngine *_vm; ScummEngine *_vm;
@ -99,6 +101,8 @@ protected:
SaveLoadChooser *_saveDialog; SaveLoadChooser *_saveDialog;
SaveLoadChooser *_loadDialog; SaveLoadChooser *_loadDialog;
GUI::ButtonWidget *_saveButton;
void save(); void save();
void load(); void load();
}; };

View file

@ -95,6 +95,10 @@ Common::Error ScummEngine::saveGameState(int slot, const char *desc) {
} }
bool ScummEngine::canSaveGameStateCurrently() { bool ScummEngine::canSaveGameStateCurrently() {
// For v4+ games do not allow to save in room 0
if (_game.version >= 4)
return (_currentRoom != 0);
// FIXME: For now always allow loading in V0-V3 games // FIXME: For now always allow loading in V0-V3 games
// TODO: Should we disallow saving in some more places, // TODO: Should we disallow saving in some more places,
// e.g. when a SAN movie is playing? Not sure whether the // e.g. when a SAN movie is playing? Not sure whether the