Codechange: Move command arguments to the back of the DoCommand function call.

This commit is contained in:
Michael Lutz
2021-10-03 15:39:49 +02:00
parent 39e8783f4b
commit b6933a2ebd
35 changed files with 167 additions and 167 deletions

View File

@@ -841,7 +841,7 @@ static CommandCost CheckFlatLandAirport(AirportTileTableIterator tile_iter, DoCo
if (ret.Failed()) return ret;
cost.AddCost(ret);
ret = DoCommand(tile_iter, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile_iter, 0, 0);
if (ret.Failed()) return ret;
cost.AddCost(ret);
}
@@ -921,14 +921,14 @@ static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag fl
affected_vehicles.push_back(v);
}
}
CommandCost ret = DoCommand(tile_cur, 0, track, flags, CMD_REMOVE_SINGLE_RAIL);
CommandCost ret = DoCommand(flags, CMD_REMOVE_SINGLE_RAIL, tile_cur, 0, track);
if (ret.Failed()) return ret;
cost.AddCost(ret);
/* With flags & ~DC_EXEC CmdLandscapeClear would fail since the rail still exists */
continue;
}
}
ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile_cur, 0, 0);
if (ret.Failed()) return ret;
cost.AddCost(ret);
}
@@ -1046,7 +1046,7 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags
cost.AddCost(RoadBuildCost(rt) * 2);
}
} else {
ret = DoCommand(cur_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, cur_tile, 0, 0);
if (ret.Failed()) return ret;
cost.AddCost(ret);
cost.AddCost(RoadBuildCost(rt) * 2);
@@ -1752,7 +1752,7 @@ static CommandCost RemoveRailStation(TileIndex tile, DoCommandFlag flags)
{
/* if there is flooding, remove platforms tile by tile */
if (_current_company == OWNER_WATER) {
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAIL_STATION);
return DoCommand(DC_EXEC, CMD_REMOVE_FROM_RAIL_STATION, tile, 0, 0);
}
Station *st = Station::GetByTile(tile);
@@ -1773,7 +1773,7 @@ static CommandCost RemoveRailWaypoint(TileIndex tile, DoCommandFlag flags)
{
/* if there is flooding, remove waypoints tile by tile */
if (_current_company == OWNER_WATER) {
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAIL_WAYPOINT);
return DoCommand(DC_EXEC, CMD_REMOVE_FROM_RAIL_WAYPOINT, tile, 0, 0);
}
return RemoveRailStation(Waypoint::GetByTile(tile), flags, _price[PR_CLEAR_WAYPOINT_RAIL]);
@@ -2535,7 +2535,7 @@ 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);
ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
if (ret.Failed()) return ret;
cost.AddCost(ret);
@@ -2550,7 +2550,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
/* Get the water class of the water tile before it is cleared.*/
WaterClass wc = GetWaterClass(tile_cur);
ret = DoCommand(tile_cur, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
ret = DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile_cur, 0, 0);
if (ret.Failed()) return ret;
tile_cur += TileOffsByDiagDir(direction);
@@ -4240,12 +4240,12 @@ static void ChangeTileOwner_Station(TileIndex tile, Owner old_owner, Owner new_o
} else {
if (IsDriveThroughStopTile(tile)) {
/* Remove the drive-through road stop */
DoCommand(tile, 1 | 1 << 8, (GetStationType(tile) == STATION_TRUCK) ? ROADSTOP_TRUCK : ROADSTOP_BUS, DC_EXEC | DC_BANKRUPT, CMD_REMOVE_ROAD_STOP);
DoCommand(DC_EXEC | DC_BANKRUPT, CMD_REMOVE_ROAD_STOP, tile, 1 | 1 << 8, (GetStationType(tile) == STATION_TRUCK) ? ROADSTOP_TRUCK : ROADSTOP_BUS);
assert(IsTileType(tile, MP_ROAD));
/* Change owner of tile and all roadtypes */
ChangeTileOwner(tile, old_owner, new_owner);
} else {
DoCommand(tile, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
DoCommand(DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
/* Set tile owner of water under (now removed) buoy and dock to OWNER_NONE.
* Update owner of buoy if it was not removed (was in orders).
* Do not update when owned by OWNER_WATER (sea and rivers). */
@@ -4362,7 +4362,7 @@ static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, in
}
}
}
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
return DoCommand(flags, CMD_LANDSCAPE_CLEAR, tile, 0, 0);
}
/**