Skip to content

2022-May-23 - Prerelease - 2.6.788

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 23 May 03:48
929cf49
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.