This patch seems good with my tests so far, but something this big needs a while with other testers involved.
I ended up modifying the ProcessCommand()ing in three places, not counting the deleted dead code:
Click here to view the secret text
×CDemoScreen::OnBetweenEvents() does all of it for the full-screen demo playback, and was the easiest to modify.
CCurrentGame::PlayCommands() handles loading saved games to the real game, plus some verification steps. But it required an argument specifying the command index at which to stop. Which causes problems if the fixup is changing the list of commands during processing. Luckily, all callers were passing it Commands.GetSize(), so I ended up removing that argument and renaming the function PlayAllCommands().
In CCurrentGame::PlayCommandsToTurn(), I put just an ASSERT(), not the new ReplaceDoubleCommands(). The method is actually only used for replaying from the room start or snapshot in the process of rewinding, and rewinding is the whole reason we need the double commands fixed up in the first place. That is, PlayCommandsToTurn() isn't responsible for fixing the commands; it's actually one of the things that needs to assume they've already been fixed up.
All other calls of CCurrentGame::ProcessCommand() I determined don't need to do the fixup. Feel free to double check me here. Details:
Click here to view the secret text
×CDrodScreen::AdvanceDemoPlayback() is the view-demo-from-main-menu; no rewinding there.
Both CGameScreen::ProcessCommand() overloads are actual gameplay commands; since the commands are unfrozen, just CMD_DOUBLE is stored.
CSellScreen has a few calls, but since my sworn foe Danforth Strout has neither double potions nor rewinds, I'm not too worried about him.
CDbDemo::Test() handles 'double command fixup' its own way by messing with wTurnNo; since that seems to work now and there's no rewinding, I didn't touch it.
(Yeah, no spoilers or secrets here, just semi-relevant long paragraphs.)
By the way, since Mike applies most of these patches "
manually"
, I added the -p flag to diff, which makes function names or other context markers appear on the '@@' lines. Might be a bit helpful. Hope it doesn't mess up anybody's patch program.
[Last edited by schep at 09-20-2007 02:49 AM : whitespace]