1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-10 06:52:05 +01:00

Change: Log changes to sandbox settings. (#13267)

One of the features of cheats is that there is a record of a cheat being used.

As cheats are slowly ending up in settings instead, add a flag so that changes to these sandbox settings are logged.
This commit is contained in:
Peter Nelson
2025-01-03 23:12:49 +00:00
committed by GitHub
parent ef87acc1ff
commit d38ecd6525
3 changed files with 3 additions and 1 deletions

View File

@@ -1604,7 +1604,7 @@ void IntSettingDesc::ChangeValue(const void *object, int32_t newval) const
this->Write(object, newval);
if (this->post_callback != nullptr) this->post_callback(newval);
if (this->flags & SF_NO_NETWORK) {
if (HasFlag(this->flags, SF_NO_NETWORK) || HasFlag(this->flags, SF_SANDBOX)) {
_gamelog.StartAction(GLAT_SETTING);
_gamelog.Setting(this->GetName(), oldval, newval);
_gamelog.StopAction();

View File

@@ -27,6 +27,7 @@ enum SettingFlag : uint16_t {
SF_NOT_IN_SAVE = 1 << 10, ///< Do not save with savegame, basically client-based.
SF_NOT_IN_CONFIG = 1 << 11, ///< Do not save to config file.
SF_NO_NETWORK_SYNC = 1 << 12, ///< Do not synchronize over network (but it is saved if SF_NOT_IN_SAVE is not set).
SF_SANDBOX = 1 << 13, ///< This setting is a sandbox setting.
};
DECLARE_ENUM_AS_BIT_SET(SettingFlag)

View File

@@ -301,6 +301,7 @@ cat = SC_BASIC
[SDT_BOOL]
var = difficulty.infinite_money
flags = SF_SANDBOX
def = false
str = STR_CONFIG_SETTING_INFINITE_MONEY
strhelp = STR_CONFIG_SETTING_INFINITE_MONEY_HELPTEXT