Merge pull request #11956 from obrakmann/fix11953_fix-aircraft-reservation-madness

Fix aircraft reservation madness
This commit is contained in:
Matthias Mailänder
2016-09-04 21:54:28 +02:00
committed by GitHub
5 changed files with 62 additions and 25 deletions

View File

@@ -29,11 +29,19 @@ namespace OpenRA.Mods.Common.Traits
return; /* nothing to do */
if (!Target.FromActor(reservedFor).IsValidFor(self))
reservedFor = null; /* not likely to arrive now. */
{
/* Not likely to arrive now. */
reservedForAircraft.UnReserve();
reservedFor = null;
reservedForAircraft = null;
}
}
public IDisposable Reserve(Actor self, Actor forActor, Aircraft forAircraft)
{
if (reservedForAircraft != null && reservedForAircraft.MayYieldReservation)
reservedForAircraft.UnReserve();
reservedFor = forActor;
reservedForAircraft = forAircraft;
@@ -53,7 +61,7 @@ namespace OpenRA.Mods.Common.Traits
public static bool IsReserved(Actor a)
{
var res = a.TraitOrDefault<Reservable>();
return res != null && res.reservedFor != null;
return res != null && res.reservedForAircraft != null && !res.reservedForAircraft.MayYieldReservation;
}
public void Disposing(Actor self)