Reservable style fixes

This commit is contained in:
reaperrr
2016-10-20 18:45:59 +02:00
parent 61284d73dd
commit 437e142031

View File

@@ -25,12 +25,13 @@ namespace OpenRA.Mods.Common.Traits
void ITick.Tick(Actor self) void ITick.Tick(Actor self)
{ {
// Nothing to do.
if (reservedFor == null) if (reservedFor == null)
return; /* nothing to do */ return;
if (!Target.FromActor(reservedFor).IsValidFor(self)) if (!Target.FromActor(reservedFor).IsValidFor(self))
{ {
/* Not likely to arrive now. */ // Not likely to arrive now.
reservedForAircraft.UnReserve(); reservedForAircraft.UnReserve();
reservedFor = null; reservedFor = null;
reservedForAircraft = null; reservedForAircraft = null;
@@ -64,28 +65,17 @@ namespace OpenRA.Mods.Common.Traits
return res != null && res.reservedForAircraft != null && !res.reservedForAircraft.MayYieldReservation; return res != null && res.reservedForAircraft != null && !res.reservedForAircraft.MayYieldReservation;
} }
void INotifyActorDisposing.Disposing(Actor self) private void UnReserve()
{ {
if (reservedForAircraft != null) if (reservedForAircraft != null)
reservedForAircraft.UnReserve(); reservedForAircraft.UnReserve();
} }
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) void INotifyActorDisposing.Disposing(Actor self) { UnReserve(); }
{
if (reservedForAircraft != null)
reservedForAircraft.UnReserve();
}
void INotifySold.Selling(Actor self) void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner) { UnReserve(); }
{
if (reservedForAircraft != null)
reservedForAircraft.UnReserve();
}
void INotifySold.Sold(Actor self) void INotifySold.Selling(Actor self) { UnReserve(); }
{ void INotifySold.Sold(Actor self) { UnReserve(); }
if (reservedForAircraft != null)
reservedForAircraft.UnReserve();
}
} }
} }