Mercurial > hg > openttd
changeset 14198:246988971bd7 draft
(svn r18749) -Fix [FS#3491]: the AI's name and version in the debug panel weren't properly centered
author | rubidium <rubidium@openttd.org> |
---|---|
date | Thu, 07 Jan 2010 11:48:59 +0000 |
parents | 06812674f0fc |
children | e4aab18f4d6c |
files | src/ai/ai_gui.cpp src/lang/english.txt |
diffstat | 2 files changed, 18 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -815,7 +815,23 @@ } } 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 @@ 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 @@ 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),
--- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3205,6 +3205,7 @@ # 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