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);
self.World.ScreenMap.Add(self);
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;
self.World.ScreenMap.Update(self);
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);
self.World.ScreenMap.Remove(self);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self);
OnCruisingAltitudeLeft();
OnAirborneAltitudeLeft();
}

View File

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

View File

@@ -106,21 +106,27 @@ namespace OpenRA.Mods.Common.Traits
TopLeft = self.World.Map.CellContaining(pos);
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.UpdatePosition(self, this);
self.World.ScreenMap.Update(self);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Update(self);
}
public void AddedToWorld(Actor self)
{
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this);
self.World.ScreenMap.Add(self);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Add(self);
}
public void RemovedFromWorld(Actor self)
{
self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this);
self.World.ScreenMap.Remove(self);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self);
}
public bool Disabled

View File

@@ -431,7 +431,9 @@ namespace OpenRA.Mods.Common.Traits
CenterPosition = pos;
if (self.IsInWorld)
{
self.World.ScreenMap.Update(self);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Update(self);
self.World.ActorMap.UpdatePosition(self, this);
}
}
@@ -440,14 +442,18 @@ namespace OpenRA.Mods.Common.Traits
{
self.World.ActorMap.AddInfluence(self, this);
self.World.ActorMap.AddPosition(self, this);
self.World.ScreenMap.Add(self);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Add(self);
}
public void RemovedFromWorld(Actor self)
{
self.World.ActorMap.RemoveInfluence(self, this);
self.World.ActorMap.RemovePosition(self, this);
self.World.ScreenMap.Remove(self);
if (!self.Bounds.Size.IsEmpty)
self.World.ScreenMap.Remove(self);
}
public IEnumerable<IOrderTargeter> Orders { get { yield return new MoveOrderTargeter(self, this); } }