diff --git a/OpenRA.Game/Traits/Render/RenderBuildingWarFactory.cs b/OpenRA.Game/Traits/Render/RenderBuildingWarFactory.cs index 053ba3b9a3..969fba8f4c 100644 --- a/OpenRA.Game/Traits/Render/RenderBuildingWarFactory.cs +++ b/OpenRA.Game/Traits/Render/RenderBuildingWarFactory.cs @@ -53,7 +53,7 @@ namespace OpenRA.Traits public void Tick(Actor self) { if (isOpen && !self.World.WorldActor.traits.Get() - .GetUnitsAt(((1/24f) * self.CenterLocation).ToInt2()).Any()) + .GetUnitsAt(((1f/Game.CellSize) * self.CenterLocation).ToInt2()).Any()) { isOpen = false; roof.PlayBackwardsThen(GetPrefix(self) + "build-top", () => roof.Play(GetPrefix(self) + "idle-top")); diff --git a/OpenRA.Game/Traits/World/UnitInfluence.cs b/OpenRA.Game/Traits/World/UnitInfluence.cs index a3be7ef6a6..afaba57b49 100644 --- a/OpenRA.Game/Traits/World/UnitInfluence.cs +++ b/OpenRA.Game/Traits/World/UnitInfluence.cs @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using OpenRA.FileFormats; namespace OpenRA.Traits { @@ -33,10 +34,12 @@ namespace OpenRA.Traits public class UnitInfluence : ITick { List[,] influence; + Map map; public UnitInfluence( Actor self ) { - int size = self.World.Map.MapSize; + map = self.World.Map; + var size = self.World.Map.MapSize; influence = new List[size, size]; for (int i = 0; i < size; i++) for (int j = 0; j < size; j++) @@ -90,6 +93,7 @@ namespace OpenRA.Traits public IEnumerable GetUnitsAt( int2 a ) { + if (!map.IsInMap(a)) return null; return influence[ a.X, a.Y ]; }