Fixes #4955 aircraft reservation crash

Fixes the specific cause of the crash reported in #4955 with HeliReturn
and adds an UnReserve call while attempting to reserve spawn building in
Aircraft.cs
This commit is contained in:
Squiggles211
2014-05-22 01:34:34 -05:00
parent a040abd539
commit 0e4b1d28aa
2 changed files with 9 additions and 2 deletions

View File

@@ -80,8 +80,12 @@ namespace OpenRA.Mods.RA.Air
return;
var res = afld.Trait<Reservable>();
if (res != null)
{
UnReserve();
Reservation = res.Reserve(afld, self, this);
}
}
public void UnReserve()

View File

@@ -47,9 +47,12 @@ namespace OpenRA.Mods.RA.Air
var res = dest.TraitOrDefault<Reservable>();
var heli = self.Trait<Helicopter>();
if (res != null)
heli.Reservation = res.Reserve(dest, self, heli);
if (res != null)
{
heli.UnReserve();
heli.Reservation = res.Reserve(dest, self, heli);
}
var exit = dest.Info.Traits.WithInterface<ExitInfo>().FirstOrDefault();
var offset = (exit != null) ? exit.SpawnOffset : WVec.Zero;