[wesnoth-commits] [wesnoth/wesnoth] 7e22e5: Fix assert with custom synced AI commands
mattsc
noreply at github.com
Thu Jun 10 18:09:09 UTC 2021
Branch: refs/heads/master
Home: https://github.com/wesnoth/wesnoth
Commit: 7e22e5c8f221f972d47f3a867f3214487c2abcc4
https://github.com/wesnoth/wesnoth/commit/7e22e5c8f221f972d47f3a867f3214487c2abcc4
Author: mattsc <mattsc000 at gmail.com>
Date: 2021-06-10 (Thu, 10 Jun 2021)
Changed paths:
M src/ai/actions.cpp
Log Message:
-----------
Fix assert with custom synced AI commands
Function run() at the beginning of synced_context.cpp asserts when a command is configured not to be undoable (use_undo=false), but the undo stack is not empty (resources::undo_stack->can_undo() returns true). Thus, the undo stack needs to be cleared before executing commands that are not supposed to be undoable.
Most AI commands use use_undo=false, but custom synced commands route through do_command, which uses a hard-coded use_undo=true. That, by itself, is not a problem, but if the next AI action uses use_undo and does not clear the undo stack first, the assert is triggered. AI actions with use_undo=false therefore need to clear the undo stack. This commit adds that for recruiting and recalling, the only AI actions that did not already do so.
Commit: 152e18b9d6584706d465698d3fcab2996f76c1b3
https://github.com/wesnoth/wesnoth/commit/152e18b9d6584706d465698d3fcab2996f76c1b3
Author: mattsc <mattsc000 at gmail.com>
Date: 2021-06-10 (Thu, 10 Jun 2021)
Changed paths:
M src/ai/actions.cpp
Log Message:
-----------
Merge pull request #5595 from mattsc/undo_assert
Fix potential crash when running commands in synced context
Compare: https://github.com/wesnoth/wesnoth/compare/629df4e76caa...152e18b9d658
More information about the Commits
mailing list