1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-29 07:04:35 +01:00

Codechange: Make Price an enum class.

This commit is contained in:
Cyprian Klimaszewski
2026-01-12 22:22:45 +01:00
committed by rubidium42
parent b556dc24b8
commit 322ce224b4
42 changed files with 325 additions and 326 deletions

View File

@@ -3204,7 +3204,7 @@ Money IndustrySpec::GetConstructionCost() const
{
/* Building raw industries like secondary uses different price base */
return (_price[(_settings_game.construction.raw_industry_construction == 1 && this->IsRawIndustry()) ?
PR_BUILD_INDUSTRY_RAW : PR_BUILD_INDUSTRY] * this->cost_multiplier) >> 8;
Price::BuildIndustryRaw : Price::BuildIndustry] * this->cost_multiplier) >> 8;
}
/**
@@ -3215,7 +3215,7 @@ Money IndustrySpec::GetConstructionCost() const
*/
Money IndustrySpec::GetRemovalCost() const
{
return (_price[PR_CLEAR_INDUSTRY] * this->removal_cost_multiplier) >> 8;
return (_price[Price::ClearIndustry] * this->removal_cost_multiplier) >> 8;
}
/**
@@ -3252,10 +3252,10 @@ static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlags flags,
if (itspec->callback_mask.Test(IndustryTileCallbackMask::Autoslope)) {
/* If the callback fails, allow autoslope. */
uint16_t res = GetIndustryTileCallback(CBID_INDTILE_AUTOSLOPE, 0, 0, gfx, Industry::GetByTile(tile), tile);
if (res == CALLBACK_FAILED || !ConvertBooleanCallback(itspec->grf_prop.grffile, CBID_INDTILE_AUTOSLOPE, res)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
if (res == CALLBACK_FAILED || !ConvertBooleanCallback(itspec->grf_prop.grffile, CBID_INDTILE_AUTOSLOPE, res)) return CommandCost(EXPENSES_CONSTRUCTION, _price[Price::BuildFoundation]);
} else {
/* allow autoslope */
return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]);
return CommandCost(EXPENSES_CONSTRUCTION, _price[Price::BuildFoundation]);
}
}
}