* Updates cached nearest town for all road tiles * @param invalidate are we just invalidating cached data? * @pre invalidate == true implies _generating_world == true */
| 1942 | * @pre invalidate == true implies _generating_world == true |
| 1943 | */ |
| 1944 | void UpdateNearestTownForRoadTiles(bool invalidate) |
| 1945 | { |
| 1946 | assert(!invalidate || _generating_world); |
| 1947 | |
| 1948 | for (const auto t : Map::Iterate()) { |
| 1949 | if (IsTileType(t, MP_ROAD) && !IsRoadDepot(t) && !HasTownOwnedRoad(t)) { |
| 1950 | TownID tid = TownID::Invalid(); |
| 1951 | if (!invalidate) { |
| 1952 | const Town *town = CalcClosestTownFromTile(t); |
| 1953 | if (town != nullptr) tid = town->index; |
| 1954 | } |
| 1955 | SetTownIndex(t, tid); |
| 1956 | } |
| 1957 | } |
| 1958 | } |
| 1959 | |
| 1960 | static int GetSlopePixelZ_Road(TileIndex tile, uint x, uint y, bool) |
| 1961 | { |
no test coverage detected