fix stupid naming in Reservable

This commit is contained in:
Chris Forbes
2011-10-24 17:31:09 +13:00
parent e602e086f3
commit 92f5d67ef1

View File

@@ -19,7 +19,7 @@ namespace OpenRA.Mods.RA
public class Reservable : ITick, INotifyKilled, INotifyCapture, INotifySold public class Reservable : ITick, INotifyKilled, INotifyCapture, INotifySold
{ {
Actor reservedFor; Actor reservedFor;
Aircraft herp; Aircraft reservedForAircraft;
public void Tick(Actor self) public void Tick(Actor self)
{ {
@@ -30,16 +30,16 @@ namespace OpenRA.Mods.RA
reservedFor = null; /* not likely to arrive now. */ reservedFor = null; /* not likely to arrive now. */
} }
public IDisposable Reserve(Actor self, Actor forActor, Aircraft derp) public IDisposable Reserve(Actor self, Actor forActor, Aircraft forAircraft)
{ {
reservedFor = forActor; reservedFor = forActor;
herp = derp; reservedForAircraft = forAircraft;
// NOTE: we really dont care about the GC eating DisposableActions that apply to a world *other* than // NOTE: we really dont care about the GC eating DisposableActions that apply to a world *other* than
// the one we're playing in. // the one we're playing in.
return new DisposableAction( return new DisposableAction(
() => {reservedFor = null; herp = null;}, () => { reservedFor = null; reservedForAircraft = null; },
() => Game.RunAfterTick( () => Game.RunAfterTick(
() => { if (Game.IsCurrentWorld( self.World )) throw new InvalidOperationException( () => { if (Game.IsCurrentWorld( self.World )) throw new InvalidOperationException(
"Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})" "Attempted to finalize an undisposed DisposableAction. {0} ({1}) reserved {2} ({3})"
@@ -54,21 +54,22 @@ namespace OpenRA.Mods.RA
public void Killed(Actor self, AttackInfo e) public void Killed(Actor self, AttackInfo e)
{ {
if (herp != null) if (reservedForAircraft != null)
herp.UnReserve(); reservedForAircraft.UnReserve();
} }
public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner) public void OnCapture (Actor self, Actor captor, Player oldOwner, Player newOwner)
{ {
if (herp != null) if (reservedForAircraft != null)
herp.UnReserve(); reservedForAircraft.UnReserve();
} }
public void Selling (Actor self) { Sold(self); } public void Selling (Actor self) { Sold(self); }
public void Sold (Actor self) public void Sold (Actor self)
{ {
if (herp != null) if (reservedForAircraft != null)
herp.UnReserve(); reservedForAircraft.UnReserve();
} }
} }
} }