OpenTTD Source  20241108-master-g80f628063a
settings_cmd.h File Reference

Command definitions related to settings. More...

#include "command_type.h"

Go to the source code of this file.

Functions

CommandCost CmdChangeSetting (DoCommandFlag flags, const std::string &name, int32_t value)
 Network-safe changing of settings (server-only). More...
 
CommandCost CmdChangeCompanySetting (DoCommandFlag flags, const std::string &name, int32_t value)
 Change one of the per-company settings. More...
 

Detailed Description

Command definitions related to settings.

Definition in file settings_cmd.h.

Function Documentation

◆ CmdChangeCompanySetting()

CommandCost CmdChangeCompanySetting ( DoCommandFlag  flags,
const std::string &  name,
int32_t  value 
)

Change one of the per-company settings.

Parameters
flagsoperation to perform
namethe name of the company setting to change
valuethe new value for the setting The new value is properly clamped to its minimum/maximum when setting
Returns
the cost of this operation or an error

Definition at line 1722 of file settings.cpp.

References _current_company, SettingDesc::AsIntSetting(), IntSettingDesc::ChangeValue(), CMD_ERROR, DC_EXEC, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), GetCompanySettingFromName(), SettingDesc::IsIntSetting(), and settings.

◆ CmdChangeSetting()

CommandCost CmdChangeSetting ( DoCommandFlag  flags,
const std::string &  name,
int32_t  value 
)

Network-safe changing of settings (server-only).

Parameters
flagsoperation to perform
namethe name of the setting to change
valuethe new value for the setting The new value is properly clamped to its minimum/maximum when setting
Returns
the cost of this operation or an error
See also
_settings

Definition at line 1696 of file settings.cpp.

References SettingDesc::AsIntSetting(), IntSettingDesc::ChangeValue(), CMD_ERROR, DC_EXEC, GetGameSettings(), GetSettingFromName(), SettingDesc::IsEditable(), SettingDesc::IsIntSetting(), SettingDesc::save, SlIsObjectCurrentlyValid(), SaveLoad::version_from, and SaveLoad::version_to.