Changeset - r26834:380dcaafa097
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 22 months ago 2023-01-29 17:09:10
j.g.rennison@gmail.com
Fix: Water infrastructure accounting when building docks
1 file changed with 6 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/station_cmd.cpp
Show inline comments
 
@@ -2535,14 +2535,17 @@ CommandCost CmdBuildDock(DoCommandFlag f
 

	
 
	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;
0 comments (0 inline, 0 general)