Mark cells that have changed MovementType as dirty
This commit is contained in:
@@ -270,6 +270,7 @@ namespace OpenRA.Traits
|
|||||||
WDist LargestActorRadius { get; }
|
WDist LargestActorRadius { get; }
|
||||||
WDist LargestBlockingActorRadius { get; }
|
WDist LargestBlockingActorRadius { get; }
|
||||||
|
|
||||||
|
void UpdateOccupiedCells(IOccupySpace ios);
|
||||||
event Action<CPos> CellUpdated;
|
event Action<CPos> CellUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,12 +90,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
protected override void TraitEnabled(Actor self)
|
protected override void TraitEnabled(Actor self)
|
||||||
{
|
{
|
||||||
self.World.ActorMap.UpdatePosition(self, self.OccupiesSpace);
|
self.World.ActorMap.UpdateOccupiedCells(self.OccupiesSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void TraitDisabled(Actor self)
|
protected override void TraitDisabled(Actor self)
|
||||||
{
|
{
|
||||||
self.World.ActorMap.UpdatePosition(self, self.OccupiesSpace);
|
self.World.ActorMap.UpdateOccupiedCells(self.OccupiesSpace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,10 +159,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var oldValue = movementTypes;
|
var oldValue = movementTypes;
|
||||||
movementTypes = value;
|
movementTypes = value;
|
||||||
if (value != oldValue)
|
if (value != oldValue)
|
||||||
|
{
|
||||||
|
self.World.ActorMap.UpdateOccupiedCells(self.OccupiesSpace);
|
||||||
foreach (var n in notifyMoving)
|
foreach (var n in notifyMoving)
|
||||||
n.MovementTypeChanged(self, value);
|
n.MovementTypeChanged(self, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
int oldFacing, facing;
|
int oldFacing, facing;
|
||||||
|
|||||||
@@ -410,6 +410,15 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
influenceNode = influenceNode.Next;
|
influenceNode = influenceNode.Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateOccupiedCells(IOccupySpace ios)
|
||||||
|
{
|
||||||
|
if (CellUpdated == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var c in ios.OccupiedCells())
|
||||||
|
CellUpdated(c.First);
|
||||||
|
}
|
||||||
|
|
||||||
void ITick.Tick(Actor self)
|
void ITick.Tick(Actor self)
|
||||||
{
|
{
|
||||||
// Position updates are done in one pass
|
// Position updates are done in one pass
|
||||||
|
|||||||
Reference in New Issue
Block a user