diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index ace90dc029..92a5faae4e 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2535,14 +2535,17 @@ CommandCost CmdBuildDock(DoCommandFlag flags, TileIndex tile, StationID station_ if (flags & DC_EXEC) { st->ship_station.Add(tile); - st->ship_station.Add(tile + TileOffsByDiagDir(direction)); + TileIndex flat_tile = tile + TileOffsByDiagDir(direction); + st->ship_station.Add(flat_tile); st->AddFacility(FACIL_DOCK, tile); st->rect.BeforeAddRect(dock_area.tile, dock_area.w, dock_area.h, StationRect::ADD_TRY); /* If the water part of the dock is on a canal, update infrastructure counts. - * This is needed as we've unconditionally cleared that tile before. */ - if (wc == WATER_CLASS_CANAL) { + * This is needed as we've cleared that tile before. + * Clearing object tiles may result in water tiles which are already accounted for in the water infrastructure total. + * See: MakeWaterKeepingClass() */ + if (wc == WATER_CLASS_CANAL && !(HasTileWaterClass(flat_tile) && GetWaterClass(flat_tile) == WATER_CLASS_CANAL && IsTileOwner(flat_tile, _current_company))) { Company::Get(st->owner)->infrastructure.water++; } Company::Get(st->owner)->infrastructure.station += 2;