summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuXarick <43006711+SamuXarick@users.noreply.github.com>2021-01-07 09:35:09 +0000
committerGitHub <noreply@github.com>2021-01-07 10:35:09 +0100
commitf84a466ca516136de218bc599bbfaf8c909829f4 (patch)
tree763668f5f83067845e1c2b03792e8d2152bcad47
parentc988b4d62ba08ee6a5efa44e0fa10da59dff4ae8 (diff)
downloadopenttd-f84a466ca516136de218bc599bbfaf8c909829f4.tar.xz
Fix #7945: Add cost of clearing the sloped tile when placing a dock (#7947)
-rw-r--r--regression/regression/result.txt4
-rw-r--r--src/station_cmd.cpp4
2 files changed, 5 insertions, 3 deletions
diff --git a/regression/regression/result.txt b/regression/regression/result.txt
index 52d957faf..2153cdaad 100644
--- a/regression/regression/result.txt
+++ b/regression/regression/result.txt
@@ -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
@@ -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
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 735edd06f..d06178fc4 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2535,8 +2535,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);
@@ -2591,7 +2593,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)