I need some help with a hard to debug issue. What happens is the following:
- Player ends the turn letting the AIs take their turn
- The AI decides to attack one of the player's naval units with one of theirs
- "Waiting for other players to finish their turns" never goes away and the game remains stuck
I investigated what is happening with logging some more and here is some additional information that may be relevant:
- I think where the code is stuck is CvGame::updateMoves() where a player is checked for busy units. If a player has no busy (and no ready) units "setAutomoves(true)" is called, ostensibly triggering the move of the next unit. However, the stuck AI player has a busy unit, being the one which attacked the player's unit.
- The unit is considered busy because both its attacked unit and attacked plot are not NULL. These are set to NULL when combat ends
- My understanding is that it's quite normal that they are not NULL for a while until combat is resolved and animated. It seems that CvGame::updateTimers() is responsible for resolving additional steps in the combat evaluation. It seems this function is not called at all. I compared this with normal combat evaluations where updateTimers() is called multiple times until the combat was done.
- I have no idea what the reason of updateTimers() not being called is. Maybe the code is stuck somewhere else but I have no clue where to start.
- Something else that may be relevant: both the attacking and the defending unit have a retreat chance. However it does not matter if the attacking unit retreats or not (forced the latter by disabling the retreat check), the combat will not properly end.
This occurred in my mod so I cannot easily share the save but if someone has any idea what might be going on here or what I could do to further debug this it would help a lot.
- Player ends the turn letting the AIs take their turn
- The AI decides to attack one of the player's naval units with one of theirs
- "Waiting for other players to finish their turns" never goes away and the game remains stuck
I investigated what is happening with logging some more and here is some additional information that may be relevant:
- I think where the code is stuck is CvGame::updateMoves() where a player is checked for busy units. If a player has no busy (and no ready) units "setAutomoves(true)" is called, ostensibly triggering the move of the next unit. However, the stuck AI player has a busy unit, being the one which attacked the player's unit.
- The unit is considered busy because both its attacked unit and attacked plot are not NULL. These are set to NULL when combat ends
- My understanding is that it's quite normal that they are not NULL for a while until combat is resolved and animated. It seems that CvGame::updateTimers() is responsible for resolving additional steps in the combat evaluation. It seems this function is not called at all. I compared this with normal combat evaluations where updateTimers() is called multiple times until the combat was done.
- I have no idea what the reason of updateTimers() not being called is. Maybe the code is stuck somewhere else but I have no clue where to start.
- Something else that may be relevant: both the attacking and the defending unit have a retreat chance. However it does not matter if the attacking unit retreats or not (forced the latter by disabling the retreat check), the combat will not properly end.
This occurred in my mod so I cannot easily share the save but if someone has any idea what might be going on here or what I could do to further debug this it would help a lot.