From 05ed9d9a7364248ccca1f1aa459171c8a30e73b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Tue, 30 Jul 2024 19:32:13 +0200 Subject: [PATCH] Revert "Fix `CurrentAdjacentCells` cache not acting as a cache" This reverts commit 604018784468a45b67860cb110e31c51d9e51ac7. --- OpenRA.Mods.Common/Traits/Cargo.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Cargo.cs b/OpenRA.Mods.Common/Traits/Cargo.cs index c35ba2d1cf..50117d76ad 100644 --- a/OpenRA.Mods.Common/Traits/Cargo.cs +++ b/OpenRA.Mods.Common/Traits/Cargo.cs @@ -107,9 +107,9 @@ namespace OpenRA.Mods.Common.Traits bool takeOffAfterLoad; bool initialised; - readonly CachedTransform currentAdjacentCells; + readonly CachedTransform> currentAdjacentCells; - public CPos[] CurrentAdjacentCells => currentAdjacentCells.Update(self.Location); + public IEnumerable CurrentAdjacentCells => currentAdjacentCells.Update(self.Location); public IEnumerable 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(loc => - Util.AdjacentCells(self.World, Target.FromActor(self)).Where(c => loc != c).ToArray()); + currentAdjacentCells = new CachedTransform>(loc => + Util.AdjacentCells(self.World, Target.FromActor(self)).Where(c => loc != c)); var runtimeCargoInit = init.GetOrDefault(info); var cargoInit = init.GetOrDefault(info);