Revert cachedLocation change that caused issues with transports.

This partially reverts commit 2f5ac1a360.
This commit is contained in:
Paul Chote
2014-10-06 08:20:02 +13:00
parent 2f4a267ba7
commit ba89eaa50d

View File

@@ -36,10 +36,10 @@ namespace OpenRA.Mods.RA
readonly List<Actor> cargo = new List<Actor>(); readonly List<Actor> cargo = new List<Actor>();
readonly HashSet<Actor> reserves = new HashSet<Actor>(); readonly HashSet<Actor> reserves = new HashSet<Actor>();
CPos cachedLocation;
int totalWeight = 0; int totalWeight = 0;
int reservedWeight = 0; int reservedWeight = 0;
CPos currentCell;
public IEnumerable<CPos> CurrentAdjacentCells { get; private set; } public IEnumerable<CPos> CurrentAdjacentCells { get; private set; }
public bool Unloading { get; internal set; } public bool Unloading { get; internal set; }
public IEnumerable<Actor> Passengers { get { return cargo; } } public IEnumerable<Actor> Passengers { get { return cargo; } }
@@ -269,7 +269,7 @@ namespace OpenRA.Mods.RA
public void AddedToWorld(Actor self) public void AddedToWorld(Actor self)
{ {
// Force location update to avoid issues when initial spawn is outside map // Force location update to avoid issues when initial spawn is outside map
cachedLocation = self.Location; currentCell = self.Location;
CurrentAdjacentCells = GetAdjacentCells(); CurrentAdjacentCells = GetAdjacentCells();
} }
@@ -286,13 +286,13 @@ namespace OpenRA.Mods.RA
foreach (var npe in self.TraitsImplementing<INotifyPassengerEntered>()) foreach (var npe in self.TraitsImplementing<INotifyPassengerEntered>())
npe.PassengerEntered(self, c); npe.PassengerEntered(self, c);
} }
initialized = true; initialized = true;
} }
if (cachedLocation != self.Location) var cell = self.World.Map.CellContaining(self.CenterPosition);
if (currentCell != cell)
{ {
cachedLocation = self.Location; currentCell = cell;
CurrentAdjacentCells = GetAdjacentCells(); CurrentAdjacentCells = GetAdjacentCells();
} }
} }