summaryrefslogtreecommitdiff
path: root/src/tunnelbridge_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tunnelbridge_cmd.cpp')
-rw-r--r--src/tunnelbridge_cmd.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 07fcd4446..85c611ae5 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -41,6 +41,8 @@
#include "company_gui.h"
#include "station_func.h"
#include "tunnelbridge_cmd.h"
+#include "landscape_cmd.h"
+#include "terraform_cmd.h"
#include "table/strings.h"
#include "table/bridge_land.h"
@@ -419,7 +421,7 @@ CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex end_tile, uint32 p1, u
bool allow_on_slopes = (_settings_game.construction.build_on_slopes && transport_type != TRANSPORT_WATER);
/* Try and clear the start landscape */
- CommandCost ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile_start, 0, 0);
+ CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_start, 0, 0, {});
if (ret.Failed()) return ret;
cost = ret;
@@ -427,7 +429,7 @@ CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex end_tile, uint32 p1, u
cost.AddCost(terraform_cost_north);
/* Try and clear the end landscape */
- ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile_end, 0, 0);
+ ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile_end, 0, 0, {});
if (ret.Failed()) return ret;
cost.AddCost(ret);
@@ -499,7 +501,7 @@ CommandCost CmdBuildBridge(DoCommandFlag flags, TileIndex end_tile, uint32 p1, u
default:
not_valid_below:;
/* try and clear the middle landscape */
- ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
+ ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
if (ret.Failed()) return ret;
cost.AddCost(ret);
break;
@@ -673,7 +675,7 @@ CommandCost CmdBuildTunnel(DoCommandFlag flags, TileIndex start_tile, uint32 p1,
if (HasTileWaterGround(start_tile)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
- CommandCost ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, start_tile, 0, 0);
+ CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, start_tile, 0, 0, {});
if (ret.Failed()) return ret;
/* XXX - do NOT change 'ret' in the loop, as it is used as the price
@@ -733,7 +735,7 @@ CommandCost CmdBuildTunnel(DoCommandFlag flags, TileIndex start_tile, uint32 p1,
if (HasTileWaterGround(end_tile)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
/* Clear the tile in any case */
- ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, end_tile, 0, 0);
+ ret = Command<CMD_LANDSCAPE_CLEAR>::Do(flags, end_tile, 0, 0, {});
if (ret.Failed()) return_cmd_error(STR_ERROR_UNABLE_TO_EXCAVATE_LAND);
cost.AddCost(ret);
@@ -765,7 +767,7 @@ CommandCost CmdBuildTunnel(DoCommandFlag flags, TileIndex start_tile, uint32 p1,
assert(coa_index < UINT_MAX); // more than 2**32 cleared areas would be a bug in itself
coa = nullptr;
- ret = DoCommand(flags, CMD_TERRAFORM_LAND, end_tile, end_tileh & start_tileh, 0);
+ ret = Command<CMD_TERRAFORM_LAND>::Do(flags, end_tile, end_tileh & start_tileh, 0, {});
_cleared_object_areas[(uint)coa_index].first_tile = old_first_tile;
if (ret.Failed()) return_cmd_error(STR_ERROR_UNABLE_TO_EXCAVATE_LAND);
cost.AddCost(ret);
@@ -1847,7 +1849,7 @@ static void ChangeTileOwner_TunnelBridge(TileIndex tile, Owner old_owner, Owner
if (tt == TRANSPORT_RAIL) {
/* Since all of our vehicles have been removed, it is safe to remove the rail
* bridge / tunnel. */
- [[maybe_unused]] CommandCost ret = DoCommand(DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
+ [[maybe_unused]] CommandCost ret = Command<CMD_LANDSCAPE_CLEAR>::Do(DC_EXEC | DC_BANKRUPT, tile, 0, 0, {});
assert(ret.Succeeded());
} else {
/* In any other case, we can safely reassign the ownership to OWNER_NONE. */
@@ -2038,7 +2040,7 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag
if (res.Succeeded() && (z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
}
- return DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
+ return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile, 0, 0, {});
}
extern const TileTypeProcs _tile_type_tunnelbridge_procs = {