Track actor positions in ActorMap.

This commit is contained in:
Paul Chote
2013-09-21 16:06:39 +12:00
parent b00cc6108d
commit e03ec690ff
8 changed files with 64 additions and 8 deletions

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Traits
class Waypoint : IOccupySpace, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld
{
[Sync] CPos location;
[Sync] readonly CPos location;
public Waypoint(ActorInitializer init)
{
@@ -34,12 +34,14 @@ namespace OpenRA.Traits
public void AddedToWorld(Actor self)
{
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this);
self.World.ScreenMap.Add(self);
}
public void RemovedFromWorld(Actor self)
{
self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this);
self.World.ScreenMap.Remove(self);
}
}