From 9103426898d6526b932c767511cf7ced951125f1 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 29 Jan 2023 17:09:10 +0000 Subject: [PATCH] Fix water infrastructure accounting when building docks See: https://github.com/OpenTTD/OpenTTD/issues/10419 --- src/station_cmd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 9e3252d6aa..1fb1f100c9 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3061,8 +3061,8 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 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. */ + 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;