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

Fix infinite loop in HeliAttack/HeliReturnToBase #14946

Merged
merged 1 commit into from Mar 22, 2018

Conversation

Projects
None yet
2 participants
@reaperrr
Copy link
Contributor

reaperrr commented Mar 19, 2018

This can happen if HeliAttack tells the heli to return to base when the player doesn't have any of the RearmBuildings available, because the activity queues itself after the HeliReturnToBase, and the latter will, after a forced land, then queue back HeliAttack, which then immediately queues back HRTB and so on.

Instead, we now assume that if there is no base to return to, going to NextActivity is pointless and don't queue it.
RTB was most likely ordered by HeliAttack due to lack of ammo, so resuming the attack would be pointless anyway without means to reload first.

Fixes #14479.

@reaperrr reaperrr added this to the Next release milestone Mar 19, 2018

@reaperrr reaperrr force-pushed the reaperrr:fix-heli-infinite-loop branch from 5e68f8a to 6bc4ab9 Mar 19, 2018

@abcdefg30
Copy link
Member

abcdefg30 left a comment

Looks good to me.

I wonder though if we have any conventions on not using else when you return in the if-branch already.

Fix infinite loop in HeliReturnToBase
This can happen if HeliAttack tells the heli to return to base when the player doesn't have any of the RearmBuildings available, because the activity queues itself after the HRTB, and the latter will, after a forced land, then queue back HeliAttack, which then immediately queues back HRTB and so on.

Instead, we now assume that if there is no base to return to, going to NextActivity is pointless and don't queue NextActivity.
RTB was likely ordered by HeliAttack due to lack of ammo, so resuming the attack would be pointless.

@reaperrr reaperrr force-pushed the reaperrr:fix-heli-infinite-loop branch from 6bc4ab9 to 24f44ba Mar 22, 2018

@reaperrr

This comment has been minimized.

Copy link
Contributor Author

reaperrr commented Mar 22, 2018

I wonder though if we have any conventions on not using else when you return in the if-branch already.

Updated, removed that 'else' you meant.

@abcdefg30 abcdefg30 merged commit 3069bbf into OpenRA:bleed Mar 22, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@abcdefg30

This comment has been minimized.

Copy link
Member

abcdefg30 commented Mar 22, 2018

@reaperrr reaperrr deleted the reaperrr:fix-heli-infinite-loop branch May 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.