-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix stuck soldiers when free fight gets aborted while waiting
When one soldier involved in an upcoming free fight is waiting for the other and that aborts the free fight for any reason, e.g. when the spot becomes unreachable, the waiting soldier changes state but doesn't start moving and as he isn't moving already there is no event queued that would make it handle the new (moving) state. This leads to it being stuck there forever and also crashes the draw code which doesn't expect a supposedly walking soldier not having a walk event. Split the `AbortFreeFight` method in 2: - virtual method to determine the next state - base method to reset the free fight state for both soldiers and let them continue For the aborting soldier effectively nothing is changed. The other soldier gets a simulated walk event if he was waiting to handle the new state. As the 2 soldiers might get involved in another fight with each other both their "fight states" are cleaned up first to establish a valid state before the other soldier gets triggered.
- Loading branch information
Showing
7 changed files
with
42 additions
and
28 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
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
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
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