Check that worm do not try to move at his current location
check latest value after while loop too
This commit is contained in:
@@ -111,6 +111,13 @@ namespace OpenRA.Mods.D2k.Traits
|
|||||||
|
|
||||||
while (!self.World.Map.Contains(moveTo) || !mobile.CanEnterCell(moveTo, null, false))
|
while (!self.World.Map.Contains(moveTo) || !mobile.CanEnterCell(moveTo, null, false))
|
||||||
{
|
{
|
||||||
|
// without this check, this while can be infinity loop
|
||||||
|
if (moveTo == self.Location)
|
||||||
|
{
|
||||||
|
self.CancelActivity();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
noiseDirection /= 2;
|
noiseDirection /= 2;
|
||||||
moveTo = self.World.Map.CellContaining(self.CenterPosition + noiseDirection);
|
moveTo = self.World.Map.CellContaining(self.CenterPosition + noiseDirection);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user