summaryrefslogtreecommitdiff
path: root/src/road_cmd.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-10-03 15:39:49 +0200
committerMichael Lutz <michi@icosahedron.de>2021-12-16 22:28:32 +0100
commitb6933a2ebdf66c5fb23b2226d3ce07d71426d7d2 (patch)
tree0cb31934ea674ea3b8bb23dd118db803b319fe7c /src/road_cmd.cpp
parent39e8783f4b8d24a27d28f99905acf8f54dec24fa (diff)
downloadopenttd-b6933a2ebdf66c5fb23b2226d3ce07d71426d7d2.tar.xz
Codechange: Move command arguments to the back of the DoCommand function call.
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r--src/road_cmd.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 70a014434..942cce7a5 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -366,7 +366,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
if (!IsTileType(tile, MP_ROAD)) {
/* If it's the last roadtype, just clear the whole tile */
- if (GetRoadType(tile, OtherRoadTramType(rtt)) == INVALID_ROADTYPE) return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ if (GetRoadType(tile, OtherRoadTramType(rtt)) == INVALID_ROADTYPE) return DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
CommandCost cost(EXPENSES_CONSTRUCTION);
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
@@ -821,7 +821,7 @@ do_clear:;
}
if (need_to_clear) {
- CommandCost ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ CommandCost ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
if (ret.Failed()) return ret;
cost.AddCost(ret);
}
@@ -867,7 +867,7 @@ do_clear:;
if (HasPowerOnRoad(rt, existing_rt)) {
rt = existing_rt;
} else if (HasPowerOnRoad(existing_rt, rt)) {
- CommandCost ret = DoCommand(tile, tile, rt, flags, CMD_CONVERT_ROAD);
+ CommandCost ret = DoCommand(flags, CMD_CONVERT_ROAD, tile, tile, rt);
if (ret.Failed()) return ret;
cost.AddCost(ret);
} else {
@@ -1038,7 +1038,7 @@ CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p
if (tile == start_tile && HasBit(p2, 0)) bits &= DiagDirToRoadBits(dir);
}
- CommandCost ret = DoCommand(tile, drd << 11 | rt << 4 | bits, 0, flags, CMD_BUILD_ROAD);
+ CommandCost ret = DoCommand(flags, CMD_BUILD_ROAD, tile, drd << 11 | rt << 4 | bits, 0);
if (ret.Failed()) {
last_error = ret;
if (last_error.GetErrorMessage() != STR_ERROR_ALREADY_BUILT) {
@@ -1129,7 +1129,7 @@ CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32
if (flags & DC_EXEC) {
money_spent += ret.GetCost();
if (money_spent > 0 && money_spent > money_available) {
- _additional_cash_required = DoCommand(start_tile, end_tile, p2, flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD).GetCost();
+ _additional_cash_required = DoCommand(flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD, start_tile, end_tile, p2).GetCost();
return cost;
}
RemoveRoad(tile, flags, bits, rtt, true, false);
@@ -1180,7 +1180,7 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
cost.AddCost(_price[PR_BUILD_FOUNDATION]);
}
- cost.AddCost(DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR));
+ cost.AddCost(DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0));
if (cost.Failed()) return cost;
if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);
@@ -1266,7 +1266,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags)
}
if (flags & DC_EXEC) {
- DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
}
return ret;
}
@@ -2194,7 +2194,7 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne
if (IsRoadDepot(tile)) {
if (GetTileOwner(tile) == old_owner) {
if (new_owner == INVALID_OWNER) {
- DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
+ DoCommand(DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
} else {
/* A road depot has two road bits. No need to dirty windows here, we'll redraw the whole screen anyway. */
RoadType rt = GetRoadTypeRoad(tile);
@@ -2231,7 +2231,7 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne
if (IsLevelCrossing(tile)) {
if (GetTileOwner(tile) == old_owner) {
if (new_owner == INVALID_OWNER) {
- DoCommand(tile, 0, GetCrossingRailTrack(tile), DC_EXEC | DC_BANKRUPT, CMD_REMOVE_SINGLE_RAIL);
+ DoCommand(DC_EXEC | DC_BANKRUPT, CMD_REMOVE_SINGLE_RAIL, tile, 0, GetCrossingRailTrack(tile));
} else {
/* Update infrastructure counts. No need to dirty windows here, we'll redraw the whole screen anyway. */
Company::Get(old_owner)->infrastructure.rail[GetRailType(tile)] -= LEVELCROSSING_TRACKBIT_FACTOR;
@@ -2280,7 +2280,7 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, int z
}
}
- return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ return DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
}
/** Update power of road vehicle under which is the roadtype being converted */