Serialize the actor generation for network orders
This commit is contained in:
@@ -56,11 +56,11 @@ namespace OpenRA.Traits
|
||||
generation = 0;
|
||||
}
|
||||
|
||||
Target(Actor a)
|
||||
Target(Actor a, int generation)
|
||||
{
|
||||
type = TargetType.Actor;
|
||||
actor = a;
|
||||
generation = a.Generation;
|
||||
this.generation = generation;
|
||||
|
||||
terrainCenterPosition = WPos.Zero;
|
||||
terrainPositions = null;
|
||||
@@ -85,7 +85,7 @@ namespace OpenRA.Traits
|
||||
public static Target FromPos(WPos p) { return new Target(p); }
|
||||
public static Target FromTargetPositions(in Target t) { return new Target(t.CenterPosition, t.Positions.ToArray()); }
|
||||
public static Target FromCell(World w, CPos c, SubCell subCell = SubCell.FullCell) { return new Target(w, c, subCell); }
|
||||
public static Target FromActor(Actor a) { return a != null ? new Target(a) : Invalid; }
|
||||
public static Target FromActor(Actor a) { return a != null ? new Target(a, a.Generation) : Invalid; }
|
||||
public static Target FromFrozenActor(FrozenActor fa) { return new Target(fa); }
|
||||
|
||||
public Actor Actor => actor;
|
||||
@@ -225,8 +225,10 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
// Expose internal state for serialization by the orders code *only*
|
||||
internal static Target FromSerializedActor(Actor a, int generation) { return a != null ? new Target(a, generation) : Invalid; }
|
||||
internal TargetType SerializableType => type;
|
||||
internal Actor SerializableActor => actor;
|
||||
internal int SerializableGeneration => generation;
|
||||
internal CPos? SerializableCell => cell;
|
||||
internal SubCell? SerializableSubCell => subCell;
|
||||
internal WPos SerializablePos => terrainCenterPosition;
|
||||
|
||||
Reference in New Issue
Block a user