Simplify ScreenMap bounds checking.

This commit is contained in:
Paul Chote
2017-12-03 15:17:07 +00:00
committed by reaperrr
parent cdc426d162
commit 9e18ec7314
4 changed files with 13 additions and 23 deletions

View File

@@ -78,11 +78,15 @@ namespace OpenRA.Traits
public void Add(Actor a) public void Add(Actor a)
{ {
var bounds = ActorBounds(a);
if (!bounds.Size.IsEmpty)
partitionedActors.Add(a, ActorBounds(a)); partitionedActors.Add(a, ActorBounds(a));
} }
public void Update(Actor a) public void Update(Actor a)
{ {
var bounds = ActorBounds(a);
if (!bounds.Size.IsEmpty)
partitionedActors.Update(a, ActorBounds(a)); partitionedActors.Update(a, ActorBounds(a));
} }

View File

@@ -191,8 +191,6 @@ namespace OpenRA
{ {
ActorMap.AddInfluence(self, ios); ActorMap.AddInfluence(self, ios);
ActorMap.AddPosition(self, ios); ActorMap.AddPosition(self, ios);
if (!self.RenderBounds.Size.IsEmpty)
ScreenMap.Add(self); ScreenMap.Add(self);
} }
@@ -201,9 +199,7 @@ namespace OpenRA
if (!self.IsInWorld) if (!self.IsInWorld)
return; return;
if (!self.RenderBounds.Size.IsEmpty)
ScreenMap.Update(self); ScreenMap.Update(self);
ActorMap.UpdatePosition(self, ios); ActorMap.UpdatePosition(self, ios);
} }
@@ -211,8 +207,6 @@ namespace OpenRA
{ {
ActorMap.RemoveInfluence(self, ios); ActorMap.RemoveInfluence(self, ios);
ActorMap.RemovePosition(self, ios); ActorMap.RemovePosition(self, ios);
if (!self.RenderBounds.Size.IsEmpty)
ScreenMap.Remove(self); ScreenMap.Remove(self);
} }

View File

@@ -313,8 +313,6 @@ namespace OpenRA.Mods.Common.Traits
self.World.ActorMap.AddInfluence(self, this); self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this); self.World.ActorMap.AddPosition(self, this);
if (!self.RenderBounds.Size.IsEmpty)
self.World.ScreenMap.Add(self); self.World.ScreenMap.Add(self);
influence.AddInfluence(self, Info.Tiles(self.Location)); influence.AddInfluence(self, Info.Tiles(self.Location));
@@ -324,8 +322,6 @@ namespace OpenRA.Mods.Common.Traits
{ {
self.World.ActorMap.RemoveInfluence(self, this); self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this); self.World.ActorMap.RemovePosition(self, this);
if (!self.RenderBounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self); self.World.ScreenMap.Remove(self);
influence.RemoveInfluence(self, Info.Tiles(self.Location)); influence.RemoveInfluence(self, Info.Tiles(self.Location));

View File

@@ -56,8 +56,6 @@ namespace OpenRA.Mods.Common.Traits
{ {
self.World.ActorMap.AddInfluence(self, this); self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this); self.World.ActorMap.AddPosition(self, this);
if (!self.RenderBounds.Size.IsEmpty)
self.World.ScreenMap.Add(self); self.World.ScreenMap.Add(self);
} }
@@ -65,8 +63,6 @@ namespace OpenRA.Mods.Common.Traits
{ {
self.World.ActorMap.RemoveInfluence(self, this); self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this); self.World.ActorMap.RemovePosition(self, this);
if (!self.RenderBounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self); self.World.ScreenMap.Remove(self);
} }
} }