public int SyncHash() { // using (new PerfSample("synchash")) { var n = 0; var ret = 0; // hash all the actors foreach (var a in Actors) { ret += n++ *(int)(1 + a.ActorID) * Sync.CalculateSyncHash(a); } // hash all the traits that tick foreach (var x in ActorsWithTrait <ISync>()) { ret += n++ *(int)(1 + x.Actor.ActorID) * Sync.CalculateSyncHash(x.Trait); } // TODO: don't go over all effects foreach (var e in Effects) { var sync = e as ISync; if (sync != null) { ret += n++ *Sync.CalculateSyncHash(sync); } } // Hash the shared rng ret += SharedRandom.Last; return(ret); } }
public int SyncHash() { //using (new PerfSample("synchash")) { int n = 0; int ret = 0; // hash all the actors foreach (var a in Actors) { ret += n++ *(int)(1 + a.ActorID) * Sync.CalculateSyncHash(a); } // hash all the traits that tick foreach (var x in traitDict.ActorsWithTraitMultiple <ISync>(this)) { ret += n++ *(int)(1 + x.Actor.ActorID) * Sync.CalculateSyncHash(x.Trait); } // Hash the shared rng ret += SharedRandom.Last; return(ret); } }