sync the last path generated, to try and catch this MUCH earlier
This commit is contained in:
@@ -102,6 +102,16 @@ namespace OpenRA.Traits.Activities
|
|||||||
this.nearEnough = 0;
|
this.nearEnough = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int HashList<T>(List<T> xs)
|
||||||
|
{
|
||||||
|
int hash = 0;
|
||||||
|
int n = 0;
|
||||||
|
foreach (var x in xs)
|
||||||
|
hash += n++ * x.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
List<int2> EvalPath( Actor self, Mobile mobile )
|
List<int2> EvalPath( Actor self, Mobile mobile )
|
||||||
{
|
{
|
||||||
var path = getPath(self, mobile).TakeWhile(a => a != mobile.toCell).ToList();
|
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}",
|
Log.Write("debug", "EvalPath #{0} {1}",
|
||||||
self.ActorID, string.Join(" ", path.Select(a => a.ToString()).ToArray()));
|
self.ActorID, string.Join(" ", path.Select(a => a.ToString()).ToArray()));
|
||||||
|
|
||||||
|
mobile.PathHash = HashList(path);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ namespace OpenRA.Traits
|
|||||||
set { SetLocation( __fromCell, value ); }
|
set { SetLocation( __fromCell, value ); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Sync]
|
||||||
|
public int PathHash; // written by Move.EvalPath, to temporarily debug this crap.
|
||||||
|
|
||||||
void SetLocation(int2 from, int2 to)
|
void SetLocation(int2 from, int2 to)
|
||||||
{
|
{
|
||||||
if (fromCell == from && toCell == to) return;
|
if (fromCell == from && toCell == to) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user