mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-24 20:12:42 +00:00
Codechange: enum-class-ify Commands
This commit is contained in:
@@ -1132,7 +1132,7 @@ static void ChopLumberMillTrees(Industry *i)
|
||||
if (_settings_client.sound.ambient) SndPlayTileFx(SND_38_LUMBER_MILL_1, tile);
|
||||
|
||||
AutoRestoreBackup<CompanyID> cur_company(_current_company, OWNER_NONE);
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do(DoCommandFlag::Execute, tile);
|
||||
Command<Commands::LandscapeClear>::Do(DoCommandFlag::Execute, tile);
|
||||
|
||||
/* Add according value to waiting cargo. */
|
||||
itp->waiting = ClampTo<uint16_t>(itp->waiting + ScaleByCargoScale(45, false));
|
||||
@@ -1504,13 +1504,13 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil
|
||||
|
||||
/* Clear the tiles as OWNER_TOWN to not affect town rating, and to not clear protected buildings */
|
||||
Backup<CompanyID> cur_company(_current_company, OWNER_TOWN);
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do({}, cur_tile);
|
||||
ret = Command<Commands::LandscapeClear>::Do({}, cur_tile);
|
||||
cur_company.Restore();
|
||||
|
||||
if (ret.Failed()) return ret;
|
||||
} else {
|
||||
/* Clear the tiles, but do not affect town ratings */
|
||||
ret = Command<CMD_LANDSCAPE_CLEAR>::Do({DoCommandFlag::Auto, DoCommandFlag::NoTestTownRating, DoCommandFlag::NoModifyTownRating}, cur_tile);
|
||||
ret = Command<Commands::LandscapeClear>::Do({DoCommandFlag::Auto, DoCommandFlag::NoTestTownRating, DoCommandFlag::NoModifyTownRating}, cur_tile);
|
||||
if (ret.Failed()) return ret;
|
||||
}
|
||||
}
|
||||
@@ -1658,7 +1658,7 @@ static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlags flags
|
||||
}
|
||||
/* This is not 100% correct check, but the best we can do without modifying the map.
|
||||
* What is missing, is if the difference in height is more than 1.. */
|
||||
if (std::get<0>(Command<CMD_TERRAFORM_LAND>::Do(DoCommandFlags{flags}.Reset(DoCommandFlag::Execute), tile_walk, SLOPE_N, curh <= h)).Failed()) {
|
||||
if (std::get<0>(Command<Commands::TerraformLand>::Do(DoCommandFlags{flags}.Reset(DoCommandFlag::Execute), tile_walk, SLOPE_N, curh <= h)).Failed()) {
|
||||
cur_company.Restore();
|
||||
return false;
|
||||
}
|
||||
@@ -1673,7 +1673,7 @@ static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlags flags
|
||||
/* We give the terraforming for free here, because we can't calculate
|
||||
* exact cost in the test-round, and as we all know, that will cause
|
||||
* a nice assert if they don't match ;) */
|
||||
Command<CMD_TERRAFORM_LAND>::Do(flags, tile_walk, SLOPE_N, curh <= h);
|
||||
Command<Commands::TerraformLand>::Do(flags, tile_walk, SLOPE_N, curh <= h);
|
||||
curh += (curh > h) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
@@ -1947,7 +1947,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type,
|
||||
|
||||
WaterClass wc = (IsWaterTile(cur_tile) ? GetWaterClass(cur_tile) : WaterClass::Invalid);
|
||||
|
||||
Command<CMD_LANDSCAPE_CLEAR>::Do({DoCommandFlag::Execute, DoCommandFlag::NoTestTownRating, DoCommandFlag::NoModifyTownRating}, cur_tile);
|
||||
Command<Commands::LandscapeClear>::Do({DoCommandFlag::Execute, DoCommandFlag::NoTestTownRating, DoCommandFlag::NoModifyTownRating}, cur_tile);
|
||||
|
||||
MakeIndustry(cur_tile, i->index, it.gfx, Random(), wc);
|
||||
|
||||
@@ -3259,7 +3259,7 @@ static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlags flags,
|
||||
}
|
||||
}
|
||||
}
|
||||
return Command<CMD_LANDSCAPE_CLEAR>::Do(flags, tile);
|
||||
return Command<Commands::LandscapeClear>::Do(flags, tile);
|
||||
}
|
||||
|
||||
extern const TileTypeProcs _tile_type_industry_procs = {
|
||||
|
||||
Reference in New Issue
Block a user