forked from mirror/OpenTTD
Codechange: Move command arguments to the back of the DoCommand function call.
This commit is contained in:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user