Reduce duplication.

This commit is contained in:
Matthias Mailänder
2016-02-26 10:49:36 +01:00
parent 3885f0b559
commit 9734054582
5 changed files with 41 additions and 58 deletions

View File

@@ -429,31 +429,17 @@ namespace OpenRA.Mods.Common.Traits
public void SetVisualPosition(Actor self, WPos pos)
{
CenterPosition = pos;
if (self.IsInWorld)
{
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Update(self);
self.World.ActorMap.UpdatePosition(self, this);
}
self.World.UpdateMaps(self, this);
}
public void AddedToWorld(Actor self)
{
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Add(self);
self.World.AddToMaps(self, this);
}
public void RemovedFromWorld(Actor self)
{
self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self);
self.World.RemoveFromMaps(self, this);
}
public IEnumerable<IOrderTargeter> Orders { get { yield return new MoveOrderTargeter(self, this); } }