mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-29 07:04:35 +01:00
Codechange: Remove unnecessary 'return_cmd_error` macro. (#13160)
This macro is a leftover from when errors used to be packed into a single int32_t. `return CommandCost` is clearer, and doesn't need a macro.
This commit is contained in:
@@ -656,14 +656,14 @@ CommandCost CmdLandscapeClear(DoCommandFlag flags, TileIndex tile)
|
||||
bool do_clear = false;
|
||||
/* Test for stuff which results in water when cleared. Then add the cost to also clear the water. */
|
||||
if ((flags & DC_FORCE_CLEAR_TILE) && HasTileWaterClass(tile) && IsTileOnWater(tile) && !IsWaterTile(tile) && !IsCoastTile(tile)) {
|
||||
if ((flags & DC_AUTO) && GetWaterClass(tile) == WATER_CLASS_CANAL) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
|
||||
if ((flags & DC_AUTO) && GetWaterClass(tile) == WATER_CLASS_CANAL) return CommandCost(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
|
||||
do_clear = true;
|
||||
cost.AddCost(GetWaterClass(tile) == WATER_CLASS_CANAL ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER]);
|
||||
}
|
||||
|
||||
Company *c = (flags & (DC_AUTO | DC_BANKRUPT)) ? nullptr : Company::GetIfValid(_current_company);
|
||||
if (c != nullptr && (int)GB(c->clear_limit, 16, 16) < 1) {
|
||||
return_cmd_error(STR_ERROR_CLEARING_LIMIT_REACHED);
|
||||
return CommandCost(STR_ERROR_CLEARING_LIMIT_REACHED);
|
||||
}
|
||||
|
||||
const ClearedObjectArea *coa = FindClearedObject(tile);
|
||||
@@ -677,7 +677,7 @@ CommandCost CmdLandscapeClear(DoCommandFlag flags, TileIndex tile)
|
||||
|
||||
/* If a object is removed, it leaves either bare land or water. */
|
||||
if ((flags & DC_NO_WATER) && HasTileWaterClass(tile) && IsTileOnWater(tile)) {
|
||||
return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||
return CommandCost(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||
}
|
||||
} else {
|
||||
cost.AddCost(_tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags));
|
||||
|
||||
Reference in New Issue
Block a user