Mercurial > hg > openttd
changeset 15841:a641e1314195 draft
(svn r20523) -Fix [FS#4040]: Do not print a colon for AI settings with empty name.
Please note that this is only meant for compatiblity to make settings of 'old' AIs still look nice.
Usage of this 'compatibility feature' is not recommended, as selected lines cannot be highlighted this way as it is done for the NewGRF settings.
author | frosch <frosch@openttd.org> |
---|---|
date | Tue, 17 Aug 2010 09:49:31 +0000 |
parents | 2223f3a6ef60 |
children | 38820b8d3895 |
files | src/ai/ai_gui.cpp |
diffstat | 1 files changed, 17 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -303,23 +303,33 @@ int current_value = config->GetSetting((*it).name); bool editable = (_game_mode == GM_MENU) || ((it->flags & AICONFIG_INGAME) != 0); - SetDParamStr(0, (*it).description); + StringID str; + TextColour colour; + uint idx = 0; + if (StrEmpty((*it).description)) { + str = STR_JUST_STRING; + colour = TC_ORANGE; + } else { + str = STR_AI_SETTINGS_SETTING; + colour = TC_LIGHT_BLUE; + SetDParamStr(idx++, (*it).description); + } if (((*it).flags & AICONFIG_BOOLEAN) != 0) { DrawFrameRect(buttons_left, y + 2, buttons_left + 19, y + 10, (current_value != 0) ? COLOUR_GREEN : COLOUR_RED, (current_value != 0) ? FR_LOWERED : FR_NONE); - SetDParam(1, current_value == 0 ? STR_CONFIG_SETTING_OFF : STR_CONFIG_SETTING_ON); + SetDParam(idx++, current_value == 0 ? STR_CONFIG_SETTING_OFF : STR_CONFIG_SETTING_ON); } else { DrawArrowButtons(buttons_left, y + 2, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + (this->clicked_increase != rtl) : 0, editable && current_value > (*it).min_value, editable && current_value < (*it).max_value); if (it->labels != NULL && it->labels->Find(current_value) != it->labels->End()) { - SetDParam(1, STR_JUST_RAW_STRING); - SetDParamStr(2, it->labels->Find(current_value)->second); + SetDParam(idx++, STR_JUST_RAW_STRING); + SetDParamStr(idx++, it->labels->Find(current_value)->second); } else { - SetDParam(1, STR_JUST_INT); - SetDParam(2, current_value); + SetDParam(idx++, STR_JUST_INT); + SetDParam(idx++, current_value); } } - DrawString(text_left, text_right, y + WD_MATRIX_TOP, STR_AI_SETTINGS_SETTING, TC_LIGHT_BLUE); + DrawString(text_left, text_right, y + WD_MATRIX_TOP, str, colour); y += this->line_height; } }