don't update the actor map outside the map borders

This commit is contained in:
Matthias Mailänder
2014-09-21 10:40:49 +02:00
parent 3f66d310db
commit 44d134afe0

View File

@@ -154,6 +154,7 @@ namespace OpenRA.Traits
public void AddInfluence(Actor self, IOccupySpace ios) public void AddInfluence(Actor self, IOccupySpace ios)
{ {
foreach (var c in ios.OccupiedCells()) foreach (var c in ios.OccupiedCells())
if (map.Contains(c.First))
influence[c.First] = new InfluenceNode { Next = influence[c.First], SubCell = c.Second, Actor = self }; influence[c.First] = new InfluenceNode { Next = influence[c.First], SubCell = c.Second, Actor = self };
} }
@@ -161,6 +162,9 @@ namespace OpenRA.Traits
{ {
foreach (var c in ios.OccupiedCells()) foreach (var c in ios.OccupiedCells())
{ {
if (!map.Contains(c.First))
continue;
var temp = influence[c.First]; var temp = influence[c.First];
RemoveInfluenceInner(ref temp, self); RemoveInfluenceInner(ref temp, self);
influence[c.First] = temp; influence[c.First] = temp;