Don't reserve airfields/helipads for husks that just fall down

fixes #3376
This commit is contained in:
Matthias Mailänder
2013-06-16 11:24:03 +02:00
parent 886099a948
commit 11755798cc
7 changed files with 26 additions and 26 deletions

View File

@@ -128,7 +128,7 @@ namespace OpenRA
Bounds.Invalidate(); Bounds.Invalidate();
ExtendedBounds.Invalidate(); ExtendedBounds.Invalidate();
currentActivity = Traits.Util.RunActivity( this, currentActivity ); currentActivity = Traits.Util.RunActivity(this, currentActivity);
} }
public void UpdateSight() public void UpdateSight()

View File

@@ -122,17 +122,17 @@ namespace OpenRA
public static void RunAfterTick(Action a) { delayedActions.Add(a); } public static void RunAfterTick(Action a) { delayedActions.Add(a); }
public static void RunAfterDelay(int delay, Action a) { delayedActions.Add(a, delay); } public static void RunAfterDelay(int delay, Action a) { delayedActions.Add(a, delay); }
static void Tick( OrderManager orderManager, Viewport viewPort ) static void Tick(OrderManager orderManager, Viewport viewPort)
{ {
if (orderManager.Connection.ConnectionState != lastConnectionState) if (orderManager.Connection.ConnectionState != lastConnectionState)
{ {
lastConnectionState = orderManager.Connection.ConnectionState; lastConnectionState = orderManager.Connection.ConnectionState;
ConnectionStateChanged( orderManager ); ConnectionStateChanged(orderManager);
} }
Tick( orderManager ); Tick(orderManager);
if( worldRenderer != null && orderManager.world != worldRenderer.world ) if (worldRenderer != null && orderManager.world != worldRenderer.world)
Tick( worldRenderer.world.orderManager ); Tick(worldRenderer.world.orderManager);
using (new PerfSample("render")) using (new PerfSample("render"))
{ {

View File

@@ -144,7 +144,7 @@ namespace OpenRA.Traits
.Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyKilled>())) .Concat(self.Owner.PlayerActor.TraitsImplementing<INotifyKilled>()))
nd.Killed(self, ai); nd.Killed(self, ai);
if( RemoveOnDeath ) if (RemoveOnDeath)
self.Destroy(); self.Destroy();
Log.Write("debug", "{0} #{1} killed by {2} #{3}", self.Info.Name, self.ActorID, attacker.Info.Name, attacker.ActorID); Log.Write("debug", "{0} #{1} killed by {2} #{3}", self.Info.Name, self.ActorID, attacker.Info.Name, attacker.ActorID);

View File

@@ -110,19 +110,19 @@ namespace OpenRA.Traits
(next, a) => { a.Queue( next ); return a; }); (next, a) => { a.Queue( next ); return a; });
} }
public static Activity RunActivity( Actor self, Activity act ) public static Activity RunActivity(Actor self, Activity act)
{ {
while( act != null ) while (act != null)
{ {
var prev = act; var prev = act;
var sw = new Stopwatch(); var sw = new Stopwatch();
act = act.Tick( self ); act = act.Tick(self);
var dt = sw.ElapsedTime(); var dt = sw.ElapsedTime();
if(dt > Game.Settings.Debug.LongTickThreshold) if (dt > Game.Settings.Debug.LongTickThreshold)
Log.Write("perf", "[{2}] Activity: {0} ({1:0.000} ms)", prev, dt * 1000, Game.LocalTick); Log.Write("perf", "[{2}] Activity: {0} ({1:0.000} ms)", prev, dt * 1000, Game.LocalTick);
if( prev == act ) if (prev == act)
break; break;
} }
return act; return act;

View File

@@ -86,10 +86,8 @@ namespace OpenRA.Mods.RA.Air
protected void ReserveSpawnBuilding() protected void ReserveSpawnBuilding()
{ {
/* not spawning in the air, so try to assoc. with our afld. this is a hack. */ /* HACK: not spawning in the air, so try to assoc. with our afld. */
var afld = GetActorBelow(); var afld = GetActorBelow();
if (afld == null) if (afld == null)
return; return;
@@ -102,10 +100,10 @@ namespace OpenRA.Mods.RA.Air
public void SetPosition(Actor self, CPos cell) public void SetPosition(Actor self, CPos cell)
{ {
SetPxPosition( self, Util.CenterOfCell( cell ) ); SetPxPosition(self, Util.CenterOfCell(cell));
} }
public void SetPxPosition( Actor self, PPos px ) public void SetPxPosition(Actor self, PPos px)
{ {
SubPxPosition = px.ToPSubPos(); SubPxPosition = px.ToPSubPos();
} }
@@ -114,9 +112,9 @@ namespace OpenRA.Mods.RA.Air
public bool AircraftCanEnter(Actor a) public bool AircraftCanEnter(Actor a)
{ {
if( self.AppearsHostileTo(a) ) return false; if (self.AppearsHostileTo(a)) return false;
return Info.RearmBuildings.Contains( a.Info.Name ) return Info.RearmBuildings.Contains(a.Info.Name)
|| Info.RepairBuildings.Contains( a.Info.Name ); || Info.RepairBuildings.Contains(a.Info.Name);
} }
public bool CanEnterCell(CPos location) { return true; } public bool CanEnterCell(CPos location) { return true; }
@@ -126,7 +124,7 @@ namespace OpenRA.Mods.RA.Air
get get
{ {
decimal ret = Info.Speed; decimal ret = Info.Speed;
foreach( var t in self.TraitsImplementing<ISpeedModifier>() ) foreach (var t in self.TraitsImplementing<ISpeedModifier>())
ret *= t.GetSpeedModifier(); ret *= t.GetSpeedModifier();
return (int)ret; return (int)ret;
} }
@@ -135,7 +133,7 @@ namespace OpenRA.Mods.RA.Air
Pair<CPos, SubCell>[] noCells = new Pair<CPos, SubCell>[] { }; Pair<CPos, SubCell>[] noCells = new Pair<CPos, SubCell>[] { };
public IEnumerable<Pair<CPos, SubCell>> OccupiedCells() { return noCells; } public IEnumerable<Pair<CPos, SubCell>> OccupiedCells() { return noCells; }
public void TickMove( int speed, int facing ) public void TickMove(int speed, int facing)
{ {
var rawspeed = speed * 7 / (32 * PSubPos.PerPx); var rawspeed = speed * 7 / (32 * PSubPos.PerPx);
SubPxPosition += rawspeed * -Util.SubPxVector[facing]; SubPxPosition += rawspeed * -Util.SubPxVector[facing];
@@ -186,7 +184,7 @@ namespace OpenRA.Mods.RA.Air
public string VoicePhraseForOrder(Actor self, Order order) public string VoicePhraseForOrder(Actor self, Order order)
{ {
switch( order.OrderString ) switch (order.OrderString)
{ {
case "Move": case "Move":
case "Enter": case "Enter":

View File

@@ -106,6 +106,7 @@ namespace OpenRA.Mods.RA.Air
if (firstTick) if (firstTick)
{ {
firstTick = false; firstTick = false;
if (!self.HasTrait<FallsToEarth>()) // TODO: Aircraft husks don't properly unreserve.
ReserveSpawnBuilding(); ReserveSpawnBuilding();
} }

View File

@@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA.Air
if (firstTick) if (firstTick)
{ {
firstTick = false; firstTick = false;
if (!self.HasTrait<FallsToEarth>()) // TODO: Aircraft husks don't properly unreserve.
ReserveSpawnBuilding(); ReserveSpawnBuilding();
} }
} }