Check that worm do not try to move at his current location

check latest value after while loop too
This commit is contained in:
evgeniysergeev
2016-07-19 11:42:06 +03:00
parent 25c640679c
commit e824a4afbd

View File

@@ -111,6 +111,13 @@ namespace OpenRA.Mods.D2k.Traits
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;
moveTo = self.World.Map.CellContaining(self.CenterPosition + noiseDirection);
}