diff options
-rw-r--r-- | src/station_base.h | 3 | ||||
-rw-r--r-- | src/town_cmd.cpp | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/station_base.h b/src/station_base.h index c63dcade1..eff191860 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -565,6 +565,9 @@ void RebuildStationKdtree(); template<typename Func> void ForAllStationsAroundTiles(const TileArea &ta, Func func) { + /* There are no stations, so we will never find anything. */ + if (Station::GetNumItems() == 0) return; + /* Not using, or don't have a nearby stations list, so we need to scan. */ std::set<StationID> seen_stations; diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index d53cd5783..2863b4d6f 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -2310,12 +2310,10 @@ static void MakeTownHouse(TileIndex t, Town *town, byte counter, byte stage, Hou if (size & BUILDING_2_TILES_X) ClearMakeHouseTile(t + TileDiffXY(1, 0), town, counter, stage, ++type, random_bits); if (size & BUILDING_HAS_4_TILES) ClearMakeHouseTile(t + TileDiffXY(1, 1), town, counter, stage, ++type, random_bits); - if (!_generating_world) { - ForAllStationsAroundTiles(TileArea(t, (size & BUILDING_2_TILES_X) ? 2 : 1, (size & BUILDING_2_TILES_Y) ? 2 : 1), [town](Station *st, TileIndex tile) { - town->stations_near.insert(st); - return true; - }); - } + ForAllStationsAroundTiles(TileArea(t, (size & BUILDING_2_TILES_X) ? 2 : 1, (size & BUILDING_2_TILES_Y) ? 2 : 1), [town](Station *st, TileIndex tile) { + town->stations_near.insert(st); + return true; + }); } |