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

Check that noiseDirection is not a zero #11670

Merged
merged 1 commit into from Aug 12, 2016
Merged

Check that noiseDirection is not a zero #11670

merged 1 commit into from Aug 12, 2016

Conversation

evgeniysergeev
Copy link
Contributor

fix unexpected freezes that can happen because of infinity loop in RescanForTargets

@@ -111,6 +111,10 @@ void RescanForTargets(Actor self)

while (!self.World.Map.Contains(moveTo) || !mobile.CanEnterCell(moveTo, null, false))
{
// without this check, this while statement can be infinity loop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to move the (moveTo == self.Location) check below inside this loop instead. That will catch the error case faster, and cancel the activity before returning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the (moveTo == self.Location)

not moved, but copied this check into while statement and leave additional check after while statement.

check latest value after while loop too
@evgeniysergeev evgeniysergeev changed the title check that noiseDirection is not a zero Check that noiseDirection is not a zero Jul 19, 2016
@@ -111,6 +111,13 @@ void RescanForTargets(Actor self)

while (!self.World.Map.Contains(moveTo) || !mobile.CanEnterCell(moveTo, null, false))
{
// without this check, this while can be infinity loop
if (moveTo == self.Location)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can the sandworm ever end up at a location that is either not in the map, or that it cannot enter?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spawner outside the cordon, or on a cell with another actor?

@obrakmann
Copy link
Contributor

Fair enough. 👍

@GraionDilach
Copy link
Contributor

👍

@obrakmann obrakmann merged commit 9604bf4 into OpenRA:bleed Aug 12, 2016
@obrakmann
Copy link
Contributor

Changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants