New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check each trigger-condition in each cycle #626
Merged
Merged
Conversation
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
Now behaviour matches the description of CclAddTrigger. Triggers that check GameCycle for exact values should now work Saves one global variable / one value written to saved games.
Can you see if unit tests can be added for triggers? |
I will try to write a test. |
zzam
added a commit
to zzam/wargus
that referenced
this pull request
Apr 9, 2024
With the original TransformUnit the unit-peasant become unit-attack-peasant only in GameCycle=2. But the Defeat-Trigger that counts them is already executed in in GameCycle=1. This trigger then counts 0 units of type 'unit-attack-peasant' and the mission is lost. This happens since Wargus/stratagus#626 was merged: b5e5bb0c6a18ccbf ("Merge pull request #626 from zzam/trigger-each-cycle") Before the code was fragile but it worked due to the ordering of triggers. Closes: Wargus#458
zzam
added a commit
to zzam/wargus
that referenced
this pull request
Apr 9, 2024
With the original TransformUnit the unit-peasant become unit-attack-peasant only in GameCycle=2. But the Defeat-Trigger that counts them is already executed in in GameCycle=1. This trigger then counts 0 units of type 'unit-attack-peasant' and the mission is lost. This happens since Wargus/stratagus#626 was merged: b5e5bb0c6a18ccbf ("Merge pull request #626 from zzam/trigger-each-cycle") Before the code was fragile but it worked due to the ordering of triggers. Closes: Wargus#458
Jarod42
pushed a commit
to Wargus/wargus
that referenced
this pull request
Apr 10, 2024
With the original TransformUnit the unit-peasant become unit-attack-peasant only in GameCycle=2. But the Defeat-Trigger that counts them is already executed in in GameCycle=1. This trigger then counts 0 units of type 'unit-attack-peasant' and the mission is lost. This happens since Wargus/stratagus#626 was merged: b5e5bb0c6a18ccbf ("Merge pull request #626 from zzam/trigger-each-cycle") Before the code was fragile but it worked due to the ordering of triggers. Closes: #458
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.
Run all check-functions of all triggers in each cycle. Also improve the API of the called functions to get the index of the trigger [0,n-1] instead of an (shifted) index into a lua-table of triggers.
Contrary to the documentation [1] only one trigger condition is run in every Cycle. This state is even saved to a saved game file.
[1]
stratagus/src/game/trigger.cpp
Lines 412 to 416 in 838f82e