In CCurrentGame::LoadFromSavedGame(), just after the if (!PlayAllCommands(...)) {...} block, I added
if (!this->bIsGameActive)
{
//Playing back the saved game didn't work as expected.
//Undo to the last command when the game was active.
UndoCommands(1, CueEvents);
}
This seems to fix the buggy behaviors, so that "
corrupt"
saved games are loaded to the turn before death, both for "
Continue Playing"
and from the "
Restore"
screen.
I believe testing bIsGameActive is better than using the return value of PlayAllCommands, since if the very last command of a saved game involved leaving the room (e.g. a staircase or scripted exit was added in the editor), PlayAllCommands() would return true, but we don't want to allow leaving the room here.
Other related things to consider: When this code truncates commands, should the save game be modified and committed to database? (A "
Continue"
save gets replaced anyway, but with just the above change, checkpoint saves aren't permanently truncated, and modifying the room again could extend their apparent length.)
Do we still want that drod.err message, since this is something normal use can occasionally cause? Maybe move it to drod.log? A popup dialog?
[Last edited by schep at 10-01-2007 04:48 AM]