Bugfixes to restoring or restarting a game from the Restore/Restart dialog

svn-id: r29524
This commit is contained in:
Paul Gilbert 2007-11-17 00:19:45 +00:00
parent cec8b98201
commit d5dc2e075a
3 changed files with 11 additions and 3 deletions

View File

@ -135,18 +135,21 @@ void Game::execute() {
screen.setPaletteEmpty();
// Flag for starting game
setState(GS_RESTART);
setState(GS_RESTART);
bool initialRestart = true;
while (!events.quitFlag) {
if ((_state & GS_RESTART) != 0) {
res.reset();
if (!initialRestart) room.reset();
setState(0);
Script::execute(STARTUP_SCRIPT);
int bootParam = ConfMan.getInt("boot_param");
int bootParam = initialRestart ? ConfMan.getInt("boot_param") : 0;
handleBootParam(bootParam);
initialRestart = false;
}
room.update();
@ -1003,6 +1006,9 @@ void Game::loadFromStream(ReadStream *stream) {
_soundFlag = stream->readByte() != 0;
menu.getMenu(2).entries()[2] = sl.getString(_soundFlag ? S_SOUND_ON : S_SOUND_OFF);
// Reset game state flags
setState(0);
}

View File

@ -85,6 +85,7 @@ Room::Room(): _screen(Screen::getReference()) {
_numLayers = 0;
_showInfo = false;
_isExit = false;
_roomNumber = 0;
_destRoomNumber = 0;
_cursorState = CS_NONE;
@ -532,7 +533,7 @@ void Room::setRoomNumber(uint16 newRoomNumber, bool showOverlay) {
_roomData = res.getRoom(newRoomNumber);
if (!_roomData)
error("Tried to change to non-existant room: %d", newRoomNumber);
bool leaveFlag = (_layers[0] && (newRoomNumber != _roomNumber) && (_roomNumber != 0));
bool leaveFlag = (newRoomNumber != _roomNumber) && (_roomNumber != 0);
_roomNumber = _roomData->roomNumber;
_descId = _roomData->descId;

View File

@ -127,6 +127,7 @@ public:
char *statusLine() { return _statusLine; }
void saveToStream(Common::WriteStream *stream);
void loadFromStream(Common::ReadStream *stream);
void reset() { _roomNumber = 999; }
};
} // end of namespace Lure