Sync RTB path hash.

This commit is contained in:
Paul Chote
2011-02-24 17:51:41 +13:00
parent 7f39909dc8
commit 869448296a
2 changed files with 7 additions and 4 deletions

View File

@@ -25,10 +25,12 @@ namespace OpenRA.Mods.RA.Air
public override object Create( ActorInitializer init ) { return new Plane( init, this ); }
}
public class Plane : Aircraft, IIssueOrder, IResolveOrder, IOrderVoice, ITick, INotifyDamage
public class Plane : Aircraft, IIssueOrder, IResolveOrder, IOrderVoice, ITick, INotifyDamage, ISync
{
public IDisposable reservation;
[Sync]
public int2 RTBPathHash;
public Plane( ActorInitializer init, PlaneInfo info ) : base( init, info ) { }
bool firstTick = true;

View File

@@ -37,11 +37,11 @@ namespace OpenRA.Mods.RA.Air
{
dest = ChooseAirfield(self);
}
var plane = self.Trait<Plane>();
var res = dest.TraitOrDefault<Reservable>();
if (res != null)
{
var plane = self.Trait<Plane>();
plane.UnReserve();
plane.reservation = res.Reserve(self);
}
@@ -77,6 +77,7 @@ namespace OpenRA.Mods.RA.Air
w1 = (c1 + f).ToInt2();
w2 = (c2 + f).ToInt2();
w3 = (approachStart).ToInt2();
plane.RTBPathHash = w1 + w2 + w3;
isCalculated = true;
}