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

@@ -193,6 +193,35 @@ namespace OpenRA
player.Shroud.ExploreAll(this);
}
public void AddToMaps(Actor self, IOccupySpace ios)
{
ActorMap.AddInfluence(self, ios);
ActorMap.AddPosition(self, ios);
if (!self.Bounds.Size.IsEmpty)
ScreenMap.Add(self);
}
public void UpdateMaps(Actor self, IOccupySpace ios)
{
if (!self.IsInWorld)
return;
if (!self.Bounds.Size.IsEmpty)
ScreenMap.Update(self);
ActorMap.UpdatePosition(self, ios);
}
public void RemoveFromMaps(Actor self, IOccupySpace ios)
{
ActorMap.RemoveInfluence(self, ios);
ActorMap.RemovePosition(self, ios);
if (!self.Bounds.Size.IsEmpty)
ScreenMap.Remove(self);
}
public void LoadComplete(WorldRenderer wr)
{
// ScreenMap must be initialized before anything else