diff options
author | rubidium <rubidium@openttd.org> | 2010-01-07 11:48:59 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-01-07 11:48:59 +0000 |
commit | 882b23d3ee663c40d332d6fa457d9d2a26b0f945 (patch) | |
tree | cf268d0c56a962f387d108001246eddf3759c8e5 /src | |
parent | 0e404038f27544fe7ebad2127b1651cd471732b6 (diff) | |
download | openttd-882b23d3ee663c40d332d6fa457d9d2a26b0f945.tar.xz |
(svn r18749) -Fix [FS#3491]: the AI's name and version in the debug panel weren't properly centered
Diffstat (limited to 'src')
-rw-r--r-- | src/ai/ai_gui.cpp | 28 | ||||
-rw-r--r-- | src/lang/english.txt | 1 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 83c121b0c..255b7f330 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -815,7 +815,23 @@ struct AIDebugWindow : public Window { } } this->last_vscroll_pos = this->vscroll.GetPosition(); + } + virtual void SetStringParameters(int widget) const + { + switch (widget) { + case AID_WIDGET_NAME_TEXT: + if (ai_debug_company == INVALID_COMPANY || !Company::IsValidAiID(ai_debug_company)) { + SetDParam(0, STR_EMPTY); + } else { + const AIInfo *info = Company::Get(ai_debug_company)->ai_info; + assert(info != NULL); + SetDParam(0, STR_AI_DEBUG_NAME_AND_VERSION); + SetDParamStr(1, info->GetName()); + SetDParam(2, info->GetVersion()); + } + break; + } } virtual void DrawWidget(const Rect &r, int widget) const @@ -823,15 +839,6 @@ struct AIDebugWindow : public Window { if (ai_debug_company == INVALID_COMPANY) return; switch (widget) { - case AID_WIDGET_NAME_TEXT: { - /* Draw the AI name */ - AIInfo *info = Company::Get(ai_debug_company)->ai_info; - assert(info != NULL); - char name[1024]; - snprintf(name, sizeof(name), "%s (v%d)", info->GetName(), info->GetVersion()); - DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, name, TC_BLACK, SA_CENTER); - break; - } case AID_WIDGET_LOG_PANEL: { CompanyID old_company = _current_company; _current_company = ai_debug_company; @@ -965,8 +972,7 @@ static const NWidgetPart _nested_ai_debug_widgets[] = { NWidget(NWID_SPACER), SetMinimalSize(0, 1), SetResize(1, 0), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_PANEL, COLOUR_GREY, AID_WIDGET_NAME_TEXT), SetMinimalSize(150, 20), SetResize(1, 0), SetDataTip(0x0, STR_AI_DEBUG_NAME_TOOLTIP), - EndContainer(), + NWidget(WWT_TEXTBTN, COLOUR_GREY, AID_WIDGET_NAME_TEXT), SetMinimalSize(150, 20), SetResize(1, 0), SetDataTip(STR_JUST_STRING, STR_AI_DEBUG_NAME_TOOLTIP), NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, AID_WIDGET_RELOAD_TOGGLE), SetMinimalSize(149, 20), SetDataTip(STR_AI_DEBUG_RELOAD, STR_AI_DEBUG_RELOAD_TOOLTIP), EndContainer(), NWidget(NWID_HORIZONTAL), diff --git a/src/lang/english.txt b/src/lang/english.txt index 5d0966f2a..f1d22acec 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3205,6 +3205,7 @@ STR_DATE_YEAR_TOOLTIP :{BLACK}Select y # AI debug window STR_AI_DEBUG :{WHITE}AI Debug +STR_AI_DEBUG_NAME_AND_VERSION :{BLACK}{RAW_STRING} (v{NUM}) STR_AI_DEBUG_NAME_TOOLTIP :{BLACK}Name of the AI STR_AI_DEBUG_RELOAD :{BLACK}Reload AI STR_AI_DEBUG_RELOAD_TOOLTIP :{BLACK}Kill the AI, reload the script, and restart the AI |