Include setting name in command log for setting change commands

This commit is contained in:
Jonathan G Rennison
2021-06-15 18:52:40 +01:00
parent a8ce0ac787
commit eeece0928c
3 changed files with 32 additions and 1 deletions

View File

@@ -2363,6 +2363,14 @@ CommandCost CmdChangeSetting(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
return CommandCost();
}
const char *GetSettingNameByIndex(uint32 idx)
{
const SettingDesc *sd = GetSettingDescription(idx);
if (sd == nullptr) return nullptr;
return sd->desc.name;
}
/**
* Change one of the per-company settings.
* @param tile unused
@@ -2400,6 +2408,13 @@ CommandCost CmdChangeCompanySetting(TileIndex tile, DoCommandFlag flags, uint32
return CommandCost();
}
const char *GetCompanySettingNameByIndex(uint32 idx)
{
if (idx >= lengthof(_company_settings)) return nullptr;
return _company_settings[idx].desc.name;
}
/**
* Top function to save the new value of an element of the Settings struct
* @param index offset in the SettingDesc array of the Settings struct which