Codechange: Use EnumBitSet for DoCommandFlags
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user