Skip to content
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

Prevent underflow in getMissionTime() calculation #3918

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

KJeff01
Copy link
Member

@KJeff01 KJeff01 commented Jun 25, 2024

mission.time undergoes signed to unsigned int promotion, and when mission.time is -1 either from initialization or from a setMissionTime(-1) to disable the timer, it would result in huge values being returned.

This resulted in the scripted power auto-gain bonus giving the player maximum power in this case.

@past-due past-due added this to the 4.5.0 milestone Jun 25, 2024
`mission.time` undergoes signed to unsigned int promotion, and when `mission.time` is -1 either from initialization
or from a setMissionTime(-1) to disable the timer, it would result in huge values being returned.

This resulted in the scripted power auto-gain bonus giving the player maximum power in this case.
This previously relied on the underflow issue and not correcting it would mean no timer would appear.
@KJeff01 KJeff01 merged commit 893a3b4 into Warzone2100:master Jun 26, 2024
30 checks passed
@KJeff01 KJeff01 deleted the promotionCheck branch June 26, 2024 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants