-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix history errors when seeking through history. (#10494)
Fix history errors when seeking through history. Unfortunately, my fix for #10429, which fixed history errors on Imperialism 1974, introduced a different bug where seeking back in time in history would cause errors. This is because the "last change" of a Node that's not a leaf is not always consistent, since more child nodes get added to it over time, and thus seeking to such a node and then later seeking away from it would result in an inconsistent sequence of changes. This PR reworks the History class to explicitly keep track of the change index we're past, instead of the tree node (whose last change index may change), which fixes the problem. There is no problem with serialization because the History class uses writeReplace() (i.e. serializing a different object in its place) and the properties being changed are only relevant for the History object in "seek mode", which is never serialized (it's on a copy of the game data). Tested by playing Feudal Japan Warlords 5 players with all-AIs and moving around history nodes while it's advancing. Before this change, an error dialog about trying to remove non-existent units would be encountered.
- Loading branch information
Showing
2 changed files
with
28 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters