From e824a4afbd2f5e751f8c9dcfbc75ebae19145f6c Mon Sep 17 00:00:00 2001 From: evgeniysergeev Date: Tue, 19 Jul 2016 11:42:06 +0300 Subject: [PATCH] Check that worm do not try to move at his current location check latest value after while loop too --- OpenRA.Mods.D2k/Traits/Sandworm.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenRA.Mods.D2k/Traits/Sandworm.cs b/OpenRA.Mods.D2k/Traits/Sandworm.cs index 0fd131dbb3..c3febd0050 100644 --- a/OpenRA.Mods.D2k/Traits/Sandworm.cs +++ b/OpenRA.Mods.D2k/Traits/Sandworm.cs @@ -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); }