|
@@ -687,13 +687,13 @@ void ClearSnowLine()
|
|
|
* @param flags of operation to conduct
|
|
|
* @param tile tile to clear
|
|
|
* @return the cost of this operation or an error
|
|
|
*/
|
|
|
CommandCost CmdLandscapeClear(DoCommandFlag flags, TileIndex tile)
|
|
|
{
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
CommandCost cost(EXPENSES_T_DEMOLITION);
|
|
|
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);
|
|
|
do_clear = true;
|
|
|
cost.AddCost(GetWaterClass(tile) == WATER_CLASS_CANAL ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER]);
|
|
@@ -738,13 +738,13 @@ CommandCost CmdLandscapeClear(DoCommandF
|
|
|
*/
|
|
|
std::tuple<CommandCost, Money> CmdClearArea(DoCommandFlag flags, TileIndex tile, TileIndex start_tile, bool diagonal)
|
|
|
{
|
|
|
if (start_tile >= MapSize()) return { CMD_ERROR, 0 };
|
|
|
|
|
|
Money money = GetAvailableMoneyForCommand();
|
|
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
|
|
CommandCost cost(EXPENSES_T_DEMOLITION);
|
|
|
CommandCost last_error = CMD_ERROR;
|
|
|
bool had_success = false;
|
|
|
|
|
|
const Company *c = (flags & (DC_AUTO | DC_BANKRUPT)) ? nullptr : Company::GetIfValid(_current_company);
|
|
|
int limit = (c == nullptr ? INT32_MAX : GB(c->clear_limit, 16, 16));
|
|
|
|