diff --git a/OpenRA.Game/Traits/Activities/Move.cs b/OpenRA.Game/Traits/Activities/Move.cs index e8d7008fed..56c32e5b0c 100755 --- a/OpenRA.Game/Traits/Activities/Move.cs +++ b/OpenRA.Game/Traits/Activities/Move.cs @@ -102,6 +102,16 @@ namespace OpenRA.Traits.Activities this.nearEnough = 0; } + static int HashList(List xs) + { + int hash = 0; + int n = 0; + foreach (var x in xs) + hash += n++ * x.GetHashCode(); + + return hash; + } + List EvalPath( Actor self, Mobile mobile ) { var path = getPath(self, mobile).TakeWhile(a => a != mobile.toCell).ToList(); @@ -109,6 +119,8 @@ namespace OpenRA.Traits.Activities Log.Write("debug", "EvalPath #{0} {1}", self.ActorID, string.Join(" ", path.Select(a => a.ToString()).ToArray())); + mobile.PathHash = HashList(path); + return path; } diff --git a/OpenRA.Game/Traits/Mobile.cs b/OpenRA.Game/Traits/Mobile.cs index b402f64196..fb094aa17b 100644 --- a/OpenRA.Game/Traits/Mobile.cs +++ b/OpenRA.Game/Traits/Mobile.cs @@ -98,6 +98,9 @@ namespace OpenRA.Traits set { SetLocation( __fromCell, value ); } } + [Sync] + public int PathHash; // written by Move.EvalPath, to temporarily debug this crap. + void SetLocation(int2 from, int2 to) { if (fromCell == from && toCell == to) return;