Skip to content

Commit

Permalink
Fix OpenTTD#7945: Add cost of clearing the sloped tile when placing a…
Browse files Browse the repository at this point in the history
… dock

Fix: Regression results
  • Loading branch information
SamuXarick committed Dec 17, 2020
1 parent 40269f5 commit 439c3ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions regression/regression/result.txt
Expand Up @@ -7327,7 +7327,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
IsBuoyTile(): true
IsLockTile(): true
IsCanalTile(): true
GetBankBalance(): 1999965070
GetBankBalance(): 1999965040

--AIWaypointList(BUOY)--
Count(): 1
Expand All @@ -7346,7 +7346,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
IsBuoyTile(): false
IsLockTile(): false
IsCanalTile(): false
GetBankBalance(): 1999959675
GetBankBalance(): 1999959645
BuildWaterDepot(): true
BuildDock(): true

Expand Down
4 changes: 3 additions & 1 deletion src/station_cmd.cpp
Expand Up @@ -2536,8 +2536,10 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32

if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);

CommandCost cost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_STATION_DOCK]);
ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;
cost.AddCost(ret);

TileIndex tile_cur = tile + TileOffsByDiagDir(direction);

Expand Down Expand Up @@ -2592,7 +2594,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
st->AfterStationTileSetChange(true, STATION_DOCK);
}

return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_STATION_DOCK]);
return cost;
}

void RemoveDockingTile(TileIndex t)
Expand Down

0 comments on commit 439c3ea

Please sign in to comment.