Ensure Clear(T) also have a safety check to ensure no listener is attached.
Move related methods next to each other. Change Clear(T) to use Array.Fill.
This commit is contained in:
@@ -25,24 +25,33 @@ namespace OpenRA
|
||||
public CellLayer(MapGridType gridType, Size size)
|
||||
: base(gridType, size) { }
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
if (CellEntryChanged != null)
|
||||
throw new InvalidOperationException(
|
||||
"Cannot clear values when there are listeners attached to the CellEntryChanged event.");
|
||||
|
||||
base.Clear();
|
||||
}
|
||||
|
||||
public override void CopyValuesFrom(CellLayerBase<T> anotherLayer)
|
||||
{
|
||||
if (CellEntryChanged != null)
|
||||
throw new InvalidOperationException(
|
||||
"Cannot copy values when there are listeners attached to the CellEntryChanged event.");
|
||||
$"Cannot copy values when there are listeners attached to the {nameof(CellEntryChanged)} event.");
|
||||
|
||||
base.CopyValuesFrom(anotherLayer);
|
||||
}
|
||||
|
||||
public override void Clear()
|
||||
{
|
||||
if (CellEntryChanged != null)
|
||||
throw new InvalidOperationException(
|
||||
$"Cannot clear values when there are listeners attached to the {nameof(CellEntryChanged)} event.");
|
||||
|
||||
base.Clear();
|
||||
}
|
||||
|
||||
public override void Clear(T clearValue)
|
||||
{
|
||||
if (CellEntryChanged != null)
|
||||
throw new InvalidOperationException(
|
||||
$"Cannot clear values when there are listeners attached to the {nameof(CellEntryChanged)} event.");
|
||||
|
||||
base.Clear(clearValue);
|
||||
}
|
||||
|
||||
// Resolve an array index from cell coordinates
|
||||
int Index(CPos cell)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user