Some improvement to the game loop#935
Merged
stavrosfa merged 1 commit intoMay 19, 2026
Merged
Conversation
Contributor
|
LGTM. Appears to fix the attack-on-load crash game save I shared recently. 👍 |
ajhalme
approved these changes
May 16, 2026
Contributor
Author
|
Adding the save for the crash game you mentioned for future reference. Another good example that this PR is working is the |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses the issue, where upon launching the game, if the player had finished their turn, the AI would immediatly take control, and the game would either get stuck in a loop, or have a black screen.
The main issue was occuring because after loading the game (game data & map), a call to advance the turn was made.
If the human player had finished their turn, either by choise, or by (game) design, that meant the loop was moving on to the next player in the list, effectively skipping the human player.
Now that was working well when in regular play mode, but when loading in directly where the human player has finished their turn, the issue becomes clear.
So, now, no matter what, when loading a new/saved/scenario game, the human player will go first. Even if they have no units left, the have to end the turn manually with the usual methods.
Some other things:
Some of the
Gameclass code was re-ordered, to try and make it more readable, and logically grouped where I thought it would be useful.Removed the PreGame entry from the
GameStateenum as it wasn't really used anywhere, and also interfered with fixing the main bug of this PRI added the
skipFirstTurnplayer flag when loading up a .biq scenario (eample usage:9 WWII in the Pacific.biq)I disabled being able to click anything while the AI are playing their turns.
Some class clean-up, renaming and removing unused imports, etc
Hide all the buttons when they are created to avoid showing them all at once, they already are getting shown/hidden properly when a unit is selected.
Added
isSettlerflag to theUnitPrototypeclass, so that we don't have to check the string name of the prototypeI hope I didn't miss anything, let me know if you have questions or comments