summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-08-13 07:34:28 +0000
committerfrosch <frosch@openttd.org>2010-08-13 07:34:28 +0000
commit7e5309a28a530d1c534dfee837d83469a1be0ea2 (patch)
tree62209dc5b903132c9a971b320e510b08a6358fa7
parentbc96bdb203a74a661a0365d998069cc939a4c06e (diff)
downloadopenttd-7e5309a28a530d1c534dfee837d83469a1be0ea2.tar.xz
(svn r20479) -Change: Use 'Buttons Name: Value' layout for AI and NewGRF parameter GUI.
-rw-r--r--src/ai/ai_gui.cpp19
-rw-r--r--src/ai/ai_info.cpp2
-rw-r--r--src/lang/english.txt2
-rw-r--r--src/newgrf_gui.cpp36
4 files changed, 26 insertions, 33 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 5d7e5f3bd..3cf882451 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -294,10 +294,8 @@ struct AISettingsWindow : public Window {
bool rtl = _dynlang.text_dir == TD_RTL;
uint buttons_left = rtl ? r.right - 23 : r.left + 4;
- uint value_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
- uint value_right = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
- uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 54);
- uint text_right = r.right - (rtl ? 54 : WD_FRAMERECT_RIGHT);
+ uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
+ uint text_right = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
int y = r.top;
@@ -305,20 +303,23 @@ struct AISettingsWindow : public Window {
int current_value = config->GetSetting((*it).name);
bool editable = (_game_mode == GM_MENU) || ((it->flags & AICONFIG_INGAME) != 0);
- uint x = rtl ? r.right : r.left;
+ SetDParamStr(0, (*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);
} 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()) {
- x = DrawString(value_left, value_right, y + WD_MATRIX_TOP, it->labels->Find(current_value)->second, TC_ORANGE);
+ SetDParam(1, STR_JUST_RAW_STRING);
+ SetDParamStr(2, it->labels->Find(current_value)->second);
} else {
- SetDParam(0, current_value);
- x = DrawString(value_left, value_right, y + WD_MATRIX_TOP, STR_JUST_INT, TC_ORANGE);
+ SetDParam(1, STR_JUST_INT);
+ SetDParam(2, current_value);
}
}
- DrawString(max(rtl ? 0U : x + 3, text_left), min(rtl ? x - 3 : r.right, text_right), y + WD_MATRIX_TOP, (*it).description, TC_LIGHT_BLUE);
+ DrawString(text_left, text_right, y + WD_MATRIX_TOP, STR_AI_SETTINGS_SETTING, TC_LIGHT_BLUE);
y += this->line_height;
}
}
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp
index 5ccd934fd..8ee4d4499 100644
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -24,7 +24,7 @@
/** Configuration for AI start date, every AI has this setting. */
AIConfigItem _start_date_config = {
"start_date",
- "The amount of days after the start of the last AI, this AI will start (give or take).",
+ "Number of days to start this AI after the previous one (give or take)",
AI::START_NEXT_MIN,
AI::START_NEXT_MAX,
AI::START_NEXT_MEDIUM,
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 9a29f83ff..61094ee21 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2395,6 +2395,7 @@ STR_NEWGRF_SETTINGS_PARAMETER_QUERY :{BLACK}Enter Ne
STR_NEWGRF_PARAMETERS_CAPTION :{WHITE}Change NewGRF parameters
STR_NEWGRF_PARAMETERS_CLOSE :{BLACK}Close
STR_NEWGRF_PARAMETERS_DEFAULT_NAME :Parameter {NUM}
+STR_NEWGRF_PARAMETERS_SETTING :{STRING1}: {ORANGE}{STRING1}
# NewGRF inspect window
STR_NEWGRF_INSPECT_CAPTION :{WHITE}Inspect - {STRING5}
@@ -3341,6 +3342,7 @@ STR_AI_LIST_CANCEL_TOOLTIP :{BLACK}Don't ch
STR_AI_SETTINGS_CAPTION :{WHITE}AI Parameters
STR_AI_SETTINGS_CLOSE :{BLACK}Close
STR_AI_SETTINGS_RESET :{BLACK}Reset
+STR_AI_SETTINGS_SETTING :{RAW_STRING}: {ORANGE}{STRING1}
# Vehicle loading indicators
STR_PERCENT_UP_SMALL :{TINYFONT}{WHITE}{NUM}%{UPARROW}
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index bc4505283..7ba86b6e9 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -204,10 +204,8 @@ struct NewGRFParametersWindow : public Window {
bool rtl = _dynlang.text_dir == TD_RTL;
uint buttons_left = rtl ? r.right - 23 : r.left + 4;
- uint value_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
- uint value_right = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
- uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 54);
- uint text_right = r.right - (rtl ? 54 : WD_FRAMERECT_RIGHT);
+ uint text_left = r.left + (rtl ? WD_FRAMERECT_LEFT : 28);
+ uint text_right = r.right - (rtl ? 28 : WD_FRAMERECT_RIGHT);
int y = r.top;
for (uint i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < this->grf_config->num_valid_params; i++) {
@@ -216,40 +214,32 @@ struct NewGRFParametersWindow : public Window {
uint32 current_value = par_info->GetValue(this->grf_config);
bool selected = (i == this->clicked_row);
- uint x = rtl ? r.right : r.left;
if (par_info->type == PTYPE_BOOL) {
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(2, par_info->GetValue(this->grf_config) == 0 ? STR_CONFIG_SETTING_OFF : STR_CONFIG_SETTING_ON);
} else if (par_info->type == PTYPE_UINT_ENUM) {
DrawArrowButtons(buttons_left, y + 2, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + (this->clicked_increase != rtl) : 0, current_value > par_info->min_value, current_value < par_info->max_value);
- bool draw_numeric = true;
+ SetDParam(2, STR_JUST_INT);
+ SetDParam(3, current_value);
if (par_info->value_names.Find(current_value) != par_info->value_names.End()) {
const char *label = GetGRFStringFromGRFText(par_info->value_names.Find(current_value)->second);
if (label != NULL) {
- x = DrawString(value_left, value_right, y + WD_MATRIX_TOP, label, TC_ORANGE);
- draw_numeric = false;
+ SetDParam(2, STR_JUST_RAW_STRING);
+ SetDParamStr(3, label);
}
}
- if (draw_numeric) {
- SetDParam(0, current_value);
- x = DrawString(value_left, value_right, y + WD_MATRIX_TOP, STR_JUST_INT, TC_ORANGE);
- }
}
- int left = max(rtl ? 0U : x + 3, text_left);
- int right = min(rtl ? x - 3 : r.right, text_right);
const char *name = GetGRFStringFromGRFText(par_info->name);
if (name != NULL) {
- x = DrawString(left, right, y + WD_MATRIX_TOP, name, selected ? TC_WHITE : TC_LIGHT_BLUE);
+ SetDParam(0, STR_JUST_RAW_STRING);
+ SetDParamStr(1, name);
} else {
- SetDParam(0, i + 1);
- x = DrawString(left, right, y + WD_MATRIX_TOP, STR_NEWGRF_PARAMETERS_DEFAULT_NAME, selected ? TC_WHITE : TC_LIGHT_BLUE);
- }
- if (par_info->type == PTYPE_BOOL) {
- left = max(rtl ? 0U : x + 3, text_left);
- right = min(rtl ? x - 3 : r.right, text_right);
- StringID str = par_info->GetValue(this->grf_config) == 0 ? STR_CONFIG_SETTING_OFF : STR_CONFIG_SETTING_ON;
- DrawString(left, right, y + WD_MATRIX_TOP, str, selected ? TC_WHITE : TC_LIGHT_BLUE);
+ SetDParam(0, STR_NEWGRF_PARAMETERS_DEFAULT_NAME);
+ SetDParam(1, i + 1);
}
+
+ DrawString(text_left, text_right, y + WD_MATRIX_TOP, STR_NEWGRF_PARAMETERS_SETTING, selected ? TC_WHITE : TC_LIGHT_BLUE);
y += this->line_height;
}
}