Index: src/saveload/company_sl.cpp =================================================================== --- src/saveload/company_sl.cpp (revision 27202) +++ src/saveload/company_sl.cpp (working copy) @@ -141,7 +141,7 @@ case MP_STATION: c = Company::GetIfValid(GetTileOwner(tile)); - if (c != NULL && GetStationType(tile) != STATION_AIRPORT && !IsBuoy(tile)) c->infrastructure.station++; + if (c != NULL && GetStationType(tile) != STATION_AIRPORT && !IsBuoy(tile) && !IsDock(tile)) c->infrastructure.station++; switch (GetStationType(tile)) { case STATION_RAIL: @@ -161,6 +161,11 @@ } case STATION_DOCK: + if (IsDockTile(tile) && !HasTileWaterGround(tile)) { + if (c != NULL) c->infrastructure.station += 2; + } + /* FALL THROUGH */ + case STATION_BUOY: if (GetWaterClass(tile) == WATER_CLASS_CANAL) { if (c != NULL) c->infrastructure.water++; Index: src/station_cmd.cpp =================================================================== --- src/station_cmd.cpp (revision 27202) +++ src/station_cmd.cpp (working copy) @@ -2509,12 +2509,8 @@ if (IsBridgeAbove(tile_cur)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); - /* Get the water class of the water tile before it is cleared.*/ WaterClass wc = GetWaterClass(tile_cur); - ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR); - if (ret.Failed()) return ret; - tile_cur += TileOffsByDiagDir(direction); if (!IsTileType(tile_cur, MP_WATER) || !IsTileFlat(tile_cur)) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE); @@ -2542,11 +2538,6 @@ 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) { - Company::Get(st->owner)->infrastructure.water++; - } Company::Get(st->owner)->infrastructure.station += 2; DirtyCompanyInfrastructureWindows(st->owner); @@ -2587,7 +2578,7 @@ if (flags & DC_EXEC) { DoClearSquare(tile1); MarkTileDirtyByTile(tile1); - MakeWaterKeepingClass(tile2, st->owner); + MakeWaterKeepingClass(tile2, GetTileOwner(tile2)); st->rect.AfterRemoveTile(st, tile1); st->rect.AfterRemoveTile(st, tile2); @@ -3993,11 +3984,16 @@ } /* Update station tile count. */ - if (!IsBuoy(tile) && !IsAirport(tile)) { + if (!IsBuoy(tile) && !IsAirport(tile) && !IsDock(tile)) { old_company->infrastructure.station--; new_company->infrastructure.station++; } + if (IsDockTile(tile) && !HasTileWaterGround(tile)) { + old_company->infrastructure.station -= 2; + new_company->infrastructure.station += 2; + } + /* for buoys, owner of tile is owner of water, st->owner == OWNER_NONE */ SetTileOwner(tile, new_owner); InvalidateWindowClassesData(WC_STATION_LIST, 0); Index: src/station_map.h =================================================================== --- src/station_map.h (revision 27202) +++ src/station_map.h (working copy) @@ -650,7 +650,7 @@ static inline void MakeDock(TileIndex t, Owner o, StationID sid, DiagDirection d, WaterClass wc) { MakeStation(t, o, sid, STATION_DOCK, d); - MakeStation(t + TileOffsByDiagDir(d), o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc); + MakeStation(t + TileOffsByDiagDir(d), IsWaterTile(t + TileOffsByDiagDir(d)) ? GetTileOwner (t + TileOffsByDiagDir(d)) : o, sid, STATION_DOCK, GFX_DOCK_BASE_WATER_PART + DiagDirToAxis(d), wc); } /**