Some improvements for SpatiallyPartitioned.

- Tweak the Update and Remove methods to reduce the number of dictionary lookups required.
- Change the Update method to an indexer, this allows simplifying callers who wanted to AddOrUpdate a value.
- Implement IDictionary<T, Rectangle>, since the class already implements these semantics by providing a backing store of the bounds for each item.
- Clean up some naming to use the generic `item` instead of `actor`.
- Make the MutateBins action methods static.
This commit is contained in:
RoosterDragon
2025-02-18 20:32:09 +00:00
committed by Gustas Kažukauskas
parent 1b2c119b58
commit ce3ad6fbb3
4 changed files with 60 additions and 52 deletions

View File

@@ -340,7 +340,7 @@ namespace OpenRA.Mods.Common.Traits
public void PopulateRadarSignatureCells(Actor self, List<(CPos Cell, Color Color)> destinationBuffer)
{
foreach (var preview in cellMap.Items)
foreach (var preview in cellMap.Keys)
foreach (var cell in Footprint(preview))
destinationBuffer.Add((cell, preview.RadarColor));
}