mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-12 01:24:54 +00:00
(svn r24860) -Codechange: Add SettingDesc::GetType().
This commit is contained in:
parent
9bce12a0ce
commit
0efd29b71b
@ -748,6 +748,16 @@ bool SettingDesc::IsEditable(bool do_command) const
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of the setting.
|
||||
* @return type of setting
|
||||
*/
|
||||
SettingType SettingDesc::GetType() const
|
||||
{
|
||||
if (this->desc.flags & SGF_PER_COMPANY) return ST_COMPANY;
|
||||
return (this->save.conv & SLF_NOT_IN_SAVE) ? ST_CLIENT : ST_GAME;
|
||||
}
|
||||
|
||||
/* Begin - Callback Functions for the various settings. */
|
||||
|
||||
/** Reposition the main toolbar as the setting changed. */
|
||||
|
@ -1856,12 +1856,11 @@ struct GameSettingsWindow : Window {
|
||||
const SettingDesc *sd = this->last_clicked->d.entry.setting;
|
||||
|
||||
int y = r.top;
|
||||
if (sd->desc.flags & SGF_PER_COMPANY) {
|
||||
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME);
|
||||
} else if (sd->save.conv & SLF_NOT_IN_SAVE) {
|
||||
SetDParam(0, STR_CONFIG_SETTING_TYPE_CLIENT);
|
||||
} else {
|
||||
SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME);
|
||||
switch (sd->GetType()) {
|
||||
case ST_COMPANY: SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_COMPANY_MENU : STR_CONFIG_SETTING_TYPE_COMPANY_INGAME); break;
|
||||
case ST_CLIENT: SetDParam(0, STR_CONFIG_SETTING_TYPE_CLIENT); break;
|
||||
case ST_GAME: SetDParam(0, _game_mode == GM_MENU ? STR_CONFIG_SETTING_TYPE_GAME_MENU : STR_CONFIG_SETTING_TYPE_GAME_INGAME); break;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
DrawString(r.left, r.right, y, STR_CONFIG_SETTING_TYPE);
|
||||
y += FONT_HEIGHT_NORMAL;
|
||||
|
@ -76,6 +76,14 @@ enum SettingCategory {
|
||||
SC_END,
|
||||
};
|
||||
|
||||
/**
|
||||
* Type of settings for filtering.
|
||||
*/
|
||||
enum SettingType {
|
||||
ST_GAME, ///< Game setting.
|
||||
ST_COMPANY, ///< Company setting.
|
||||
ST_CLIENT, ///< Client setting.
|
||||
};
|
||||
|
||||
typedef bool OnChange(int32 var); ///< callback prototype on data modification
|
||||
typedef size_t OnConvert(const char *value); ///< callback prototype for convertion error
|
||||
@ -103,6 +111,7 @@ struct SettingDesc {
|
||||
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
|
||||
|
||||
bool IsEditable(bool do_command = false) const;
|
||||
SettingType GetType() const;
|
||||
};
|
||||
|
||||
/* NOTE: The only difference between SettingDesc and SettingDescGlob is
|
||||
|
Loading…
Reference in New Issue
Block a user