internal static bool Prefix(Navigator ___navigator, int ___cell) { // If nothing has changed since last time, it is a hit! var cached = PathCacher.Lookup(___navigator.PathProber); bool hit = cached.CheckAndUpdate(___navigator, ___cell); if (debug) { DebugMetrics.LogHit(hit); } return(!hit); }
internal static bool Prefix(PathProber __instance, int cell, NavType nav_type, PathFinder.PotentialPath.Flags flags, NavGrid nav_grid, PathFinderAbilities abilities) { // If nothing has changed since last time, it is a hit! var cached = PathCacher.Lookup(__instance); bool hit; if (hit = cached.CheckAndUpdate(nav_grid, cell, nav_type, abilities, flags)) { Interlocked.Increment(ref hits); } Interlocked.Increment(ref total); return(!hit); }