Settings: Add a guiproc callback for general settings GUI operations
This commit is contained in:
@@ -843,15 +843,7 @@ struct SettingEntry : BaseSettingEntry {
|
||||
virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible);
|
||||
|
||||
void SetButtons(byte new_val);
|
||||
|
||||
/**
|
||||
* Get the help text of a single setting.
|
||||
* @return The requested help text.
|
||||
*/
|
||||
inline StringID GetHelpText() const
|
||||
{
|
||||
return this->setting->desc.str_help;
|
||||
}
|
||||
StringID GetHelpText() const;
|
||||
|
||||
struct SetValueDParamsTempData {
|
||||
char buffer[512];
|
||||
@@ -868,6 +860,24 @@ private:
|
||||
bool IsVisibleByRestrictionMode(RestrictionMode mode) const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the help text of a single setting.
|
||||
* @return The requested help text.
|
||||
*/
|
||||
StringID SettingEntry::GetHelpText() const
|
||||
{
|
||||
StringID str = this->setting->desc.str_help;
|
||||
if (this->setting->desc.guiproc != nullptr) {
|
||||
SettingOnGuiCtrlData data;
|
||||
data.type = SOGCT_DESCRIPTION_TEXT;
|
||||
data.text = str;
|
||||
if (this->setting->desc.guiproc(data)) {
|
||||
str = data.text;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/** Cargodist per-cargo setting */
|
||||
struct CargoDestPerCargoSettingEntry : SettingEntry {
|
||||
CargoID cargo;
|
||||
|
Reference in New Issue
Block a user