Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information