Fix screen map updates for boundless actors.

This commit is contained in:
Matthias Mailänder
2016-02-21 11:34:33 +01:00
parent 9d85ddb82c
commit 3885f0b559
4 changed files with 35 additions and 11 deletions

View File

@@ -135,7 +135,10 @@ namespace OpenRA.Mods.Common.Traits
{
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Add(self);
var altitude = self.World.Map.DistanceAboveTerrain(CenterPosition);
if (altitude.Length >= Info.MinAirborneAltitude)
OnAirborneAltitudeReached();
@@ -352,7 +355,9 @@ namespace OpenRA.Mods.Common.Traits
if (!self.IsInWorld)
return;
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Update(self);
self.World.ActorMap.UpdatePosition(self, this);
var altitude = self.World.Map.DistanceAboveTerrain(CenterPosition);
var isAirborne = altitude.Length >= Info.MinAirborneAltitude;
@@ -604,7 +609,10 @@ namespace OpenRA.Mods.Common.Traits
UnReserve();
self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self);
OnCruisingAltitudeLeft();
OnAirborneAltitudeLeft();
}

View File

@@ -208,6 +208,8 @@ namespace OpenRA.Mods.Common.Traits
{
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Add(self);
var cs = self.World.WorldActor.TraitOrDefault<CrateSpawner>();
@@ -219,6 +221,8 @@ namespace OpenRA.Mods.Common.Traits
{
self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self);
var cs = self.World.WorldActor.TraitOrDefault<CrateSpawner>();

View File

@@ -106,6 +106,8 @@ namespace OpenRA.Mods.Common.Traits
TopLeft = self.World.Map.CellContaining(pos);
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.UpdatePosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Update(self);
}
@@ -113,6 +115,8 @@ namespace OpenRA.Mods.Common.Traits
{
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Add(self);
}
@@ -120,6 +124,8 @@ namespace OpenRA.Mods.Common.Traits
{
self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self);
}

View File

@@ -431,7 +431,9 @@ namespace OpenRA.Mods.Common.Traits
CenterPosition = pos;
if (self.IsInWorld)
{
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Update(self);
self.World.ActorMap.UpdatePosition(self, this);
}
}
@@ -440,6 +442,8 @@ namespace OpenRA.Mods.Common.Traits
{
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Add(self);
}
@@ -447,6 +451,8 @@ namespace OpenRA.Mods.Common.Traits
{
self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self);
}