Revert "Fix CurrentAdjacentCells cache not acting as a cache"

This reverts commit 6040187844.
This commit is contained in:
Matthias Mailänder
2024-07-30 19:32:13 +02:00
committed by abcdefg30
parent 261bf88382
commit 05ed9d9a73

View File

@@ -107,9 +107,9 @@ namespace OpenRA.Mods.Common.Traits
bool takeOffAfterLoad;
bool initialised;
readonly CachedTransform<CPos, CPos[]> currentAdjacentCells;
readonly CachedTransform<CPos, IEnumerable<CPos>> currentAdjacentCells;
public CPos[] CurrentAdjacentCells => currentAdjacentCells.Update(self.Location);
public IEnumerable<CPos> CurrentAdjacentCells => currentAdjacentCells.Update(self.Location);
public IEnumerable<Actor> Passengers => cargo;
public int PassengerCount => cargo.Count;
@@ -123,8 +123,8 @@ namespace OpenRA.Mods.Common.Traits
self = init.Self;
checkTerrainType = info.UnloadTerrainTypes.Count > 0;
currentAdjacentCells = new CachedTransform<CPos, CPos[]>(loc =>
Util.AdjacentCells(self.World, Target.FromActor(self)).Where(c => loc != c).ToArray());
currentAdjacentCells = new CachedTransform<CPos, IEnumerable<CPos>>(loc =>
Util.AdjacentCells(self.World, Target.FromActor(self)).Where(c => loc != c));
var runtimeCargoInit = init.GetOrDefault<RuntimeCargoInit>(info);
var cargoInit = init.GetOrDefault<CargoInit>(info);