/// <summary> /// Analyses the map. Can take up a few seconds. /// </summary> public void Analyse() { DateTime now = DateTime.Now; Width = Game.MapWidth; Height = Game.MapHeight; int minSize = Math.Max(Width, Height); int power = 1; while (power < minSize) { power *= 2; } PathFinderTileData = new byte[power, power]; PathFinderTile = new PathFinderFast(PathFinderTileData); BuildGrid = new BuildTileInfo[Width, Height]; WalkGrid = new WalkTileInfo[Width * 4, Height * 4]; UpdateWalkability(); CalculateInaccessibility(); CalculateAltitude(); InitLength = (DateTime.Now.Ticks - now.Ticks) / 10000.0f; FindBases(); #if DEBUG Game.SendText($"Map analyser: {InitLength}ms"); SaveToFile(Game.MapFileName); #endif SelfBase = Bases.OrderBy(x => x.DepotPosition.CalcDistance(Game.Self.StartLocation)).First(); AnalysisFinished(); }
public Base GetBaseForPool() { return(Bases.OrderBy(b => b.DistanceToMain).ToList()[2]); }