public static int CostToMove(VehicleCaravan caravan, int start, int end, int?ticksAbs = null, StringBuilder explanation = null, string caravanTicksPerMoveExplanation = null)
        {
            int caravanTicksPerMove = caravan.TicksPerMove;

            if (start == end)
            {
                return(0);
            }
            if (explanation != null)
            {
                explanation.Append(caravanTicksPerMoveExplanation);
                explanation.AppendLine();
            }
            StringBuilder stringBuilder = (explanation != null) ? new StringBuilder() : null;
            float         num           = float.MaxValue;

            foreach (VehicleDef vehicle in caravan.UniqueVehicleDefsInCaravan().ToList())
            {
                float numTmp = WorldVehiclePathGrid.CalculatedMovementDifficultyAt(end, vehicle, ticksAbs, stringBuilder);
                if (numTmp < num)
                {
                    num = numTmp;
                }
            }

            float roadMovementDifficultyMultiplier = GetRoadMovementDifficultyMultiplier(caravan, start, end, stringBuilder);

            if (explanation != null)
            {
                explanation.AppendLine();
                explanation.Append("TileMovementDifficulty".Translate() + ":");
                explanation.AppendLine();
                explanation.Append(stringBuilder.ToString().Indented("  "));
                explanation.AppendLine();
                explanation.Append("  = " + (num * roadMovementDifficultyMultiplier).ToString("0.#"));
            }
            int num2 = (int)(caravanTicksPerMove * num * roadMovementDifficultyMultiplier);

            num2 = Mathf.Clamp(num2, 1, MaxMoveTicks);
            if (explanation != null)
            {
                explanation.AppendLine();
                explanation.AppendLine();
                explanation.Append("FinalCaravanMovementSpeed".Translate() + ":");
                int num3 = Mathf.CeilToInt(num2 / 1f);
                explanation.AppendLine();
                explanation.Append(string.Concat(new string[]
                {
                    "  ",
                    (60000f / caravanTicksPerMove).ToString("0.#"),
                    " / ",
                    (num * roadMovementDifficultyMultiplier).ToString("0.#"),
                    " = ",
                    (60000f / num3).ToString("0.#"),
                    " "
                }) + "TilesPerDay".Translate());
            }
            return(num2);
        }
 public static void UpdateTextMeshObjectsFor(List <VehicleDef> vehicleDefs)
 {
     for (int i = 0; i < worldPathTexts.Count; i++)
     {
         var      textMesh       = worldPathTexts[i];
         Tile     tile           = Find.WorldGrid[i];
         BiomeDef biome          = tile.biome;
         float    biomeCost      = vehicleDefs.Max(v => v.properties.customBiomeCosts.TryGetValue(biome, Find.WorldGrid[i].biome.movementDifficulty));
         float    hillinessCost  = vehicleDefs.Max(v => v.properties.customHillinessCosts.TryGetValue(tile.hilliness, WorldVehiclePathGrid.HillinessMovementDifficultyOffset(tile.hilliness)));
         float    roadMultiplier = VehicleCaravan_PathFollower.GetRoadMovementDifficultyMultiplier(vehicleDefs, i, -1);
         textMesh.Text = $"{(biomeCost + hillinessCost) * roadMultiplier}";
         textMesh.SetActive(true);
     }
 }