1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-21 11:22:45 +01:00

Codechange: Use EnumBitSet for IndustryControlFlags.

This commit is contained in:
Peter Nelson
2025-02-06 02:52:07 +00:00
committed by Peter Nelson
parent 965a45812a
commit 50b384032d
6 changed files with 26 additions and 29 deletions

View File

@@ -245,7 +245,7 @@
{
const Industry *i = Industry::GetIfValid(industry_id);
if (i == nullptr) return 0;
return i->ctlflags;
return i->ctlflags.base();
}
/* static */ bool ScriptIndustry::SetControlFlags(IndustryID industry_id, SQInteger control_flags)
@@ -253,7 +253,7 @@
EnforceDeityMode(false);
if (!IsValidIndustry(industry_id)) return false;
return ScriptObject::Command<CMD_INDUSTRY_SET_FLAGS>::Do(industry_id, (::IndustryControlFlags)control_flags & ::INDCTL_MASK);
return ScriptObject::Command<CMD_INDUSTRY_SET_FLAGS>::Do(industry_id, ::IndustryControlFlags(control_flags));
}
/* static */ ScriptCompany::CompanyID ScriptIndustry::GetExclusiveSupplier(IndustryID industry_id)

View File

@@ -37,20 +37,20 @@ public:
* When industry production change is evaluated, rolls to decrease are ignored.
* This also prevents industry closure due to production dropping to the lowest level.
*/
INDCTL_NO_PRODUCTION_DECREASE = ::INDCTL_NO_PRODUCTION_DECREASE,
INDCTL_NO_PRODUCTION_DECREASE = ::IndustryControlFlags{::IndustryControlFlag::NoProductionDecrease}.base(),
/**
* When industry production change is evaluated, rolls to increase are ignored.
*/
INDCTL_NO_PRODUCTION_INCREASE = ::INDCTL_NO_PRODUCTION_INCREASE,
INDCTL_NO_PRODUCTION_INCREASE = ::IndustryControlFlags{::IndustryControlFlag::NoProductionIncrease}.base(),
/**
* Industry can not close regardless of production level or time since last delivery.
* This does not prevent a closure already announced.
*/
INDCTL_NO_CLOSURE = ::INDCTL_NO_CLOSURE,
INDCTL_NO_CLOSURE = ::IndustryControlFlags{::IndustryControlFlag::NoClosure}.base(),
/**
* Indicates that the production level of the industry is controlled by a game script.
*/
INDCTL_EXTERNAL_PROD_LEVEL = ::INDCTL_EXTERNAL_PROD_LEVEL,
INDCTL_EXTERNAL_PROD_LEVEL = ::IndustryControlFlags{::IndustryControlFlag::ExternalProdLevel}.base(),
};
/**