From 373aaee004c4493a95d25751faa24ffc159f58cc Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 3 Dec 2017 20:55:23 +0000 Subject: [PATCH] Use World.(AddTo|RemoveFrom)Maps in Immobile/Building. --- OpenRA.Mods.Common/Traits/Buildings/Building.cs | 10 ++-------- OpenRA.Mods.Common/Traits/Immobile.cs | 8 ++------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index b4422a3ab4..f6c5c2d4e4 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -311,19 +311,13 @@ namespace OpenRA.Mods.Common.Traits if (Info.RemoveSmudgesOnBuild) RemoveSmudges(); - self.World.ActorMap.AddInfluence(self, this); - self.World.ActorMap.AddPosition(self, this); - self.World.ScreenMap.Add(self); - + self.World.AddToMaps(self, this); influence.AddInfluence(self, Info.Tiles(self.Location)); } void INotifyRemovedFromWorld.RemovedFromWorld(Actor self) { - self.World.ActorMap.RemoveInfluence(self, this); - self.World.ActorMap.RemovePosition(self, this); - self.World.ScreenMap.Remove(self); - + self.World.RemoveFromMaps(self, this); influence.RemoveInfluence(self, Info.Tiles(self.Location)); } diff --git a/OpenRA.Mods.Common/Traits/Immobile.cs b/OpenRA.Mods.Common/Traits/Immobile.cs index 685648d044..c46c5ee0f2 100644 --- a/OpenRA.Mods.Common/Traits/Immobile.cs +++ b/OpenRA.Mods.Common/Traits/Immobile.cs @@ -54,16 +54,12 @@ namespace OpenRA.Mods.Common.Traits void INotifyAddedToWorld.AddedToWorld(Actor self) { - self.World.ActorMap.AddInfluence(self, this); - self.World.ActorMap.AddPosition(self, this); - self.World.ScreenMap.Add(self); + self.World.AddToMaps(self, this); } void INotifyRemovedFromWorld.RemovedFromWorld(Actor self) { - self.World.ActorMap.RemoveInfluence(self, this); - self.World.ActorMap.RemovePosition(self, this); - self.World.ScreenMap.Remove(self); + self.World.RemoveFromMaps(self, this); } } }