Codechange: Use EnumBitSet for DoCommandFlags

This commit is contained in:
Rubidium
2025-02-13 23:35:52 +01:00
committed by rubidium42
parent f309b90a1d
commit c3d5e6d2a0
95 changed files with 871 additions and 873 deletions

View File

@@ -1724,7 +1724,7 @@ std::vector<const SettingDesc *> GetFilteredSettingCollection(std::function<bool
* @return the cost of this operation or an error
* @see _settings
*/
CommandCost CmdChangeSetting(DoCommandFlag flags, const std::string &name, int32_t value)
CommandCost CmdChangeSetting(DoCommandFlags flags, const std::string &name, int32_t value)
{
if (name.empty()) return CMD_ERROR;
const SettingDesc *sd = GetSettingFromName(name);
@@ -1735,7 +1735,7 @@ CommandCost CmdChangeSetting(DoCommandFlag flags, const std::string &name, int32
if (!sd->IsEditable(true)) return CMD_ERROR;
if (flags & DC_EXEC) {
if (flags.Test(DoCommandFlag::Execute)) {
sd->AsIntSetting()->ChangeValue(&GetGameSettings(), value);
}
@@ -1750,7 +1750,7 @@ CommandCost CmdChangeSetting(DoCommandFlag flags, const std::string &name, int32
* The new value is properly clamped to its minimum/maximum when setting
* @return the cost of this operation or an error
*/
CommandCost CmdChangeCompanySetting(DoCommandFlag flags, const std::string &name, int32_t value)
CommandCost CmdChangeCompanySetting(DoCommandFlags flags, const std::string &name, int32_t value)
{
if (name.empty()) return CMD_ERROR;
const SettingDesc *sd = GetCompanySettingFromName(name);
@@ -1758,7 +1758,7 @@ CommandCost CmdChangeCompanySetting(DoCommandFlag flags, const std::string &name
if (sd == nullptr) return CMD_ERROR;
if (!sd->IsIntSetting()) return CMD_ERROR;
if (flags & DC_EXEC) {
if (flags.Test(DoCommandFlag::Execute)) {
sd->AsIntSetting()->ChangeValue(&Company::Get(_current_company)->settings, value);
}