Allow the default value of a CellInfo to be an Unvisited location.

In CellInfoLayerPool, instead of having to store a layer with the default values, we know we can just clear the pooled layer in order to reset it. This saves on memory, and also makes resetting marginally faster.

In PathSearch, we need to amend a check to ensure a cell info is not Unvisited before we check on its cost.
This commit is contained in:
RoosterDragon
2021-09-25 13:08:26 +01:00
committed by abcdefg30
parent 6edd5d7bfa
commit 19760b04bd
5 changed files with 51 additions and 33 deletions

View File

@@ -35,6 +35,11 @@ namespace OpenRA
entries = new T[size.Width * size.Height];
}
public virtual void Clear()
{
Array.Clear(entries, 0, entries.Length);
}
public virtual void CopyValuesFrom(CellLayerBase<T> anotherLayer)
{
if (Size != anotherLayer.Size || GridType != anotherLayer.GridType)