summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-01-07 11:48:59 +0000
committerrubidium <rubidium@openttd.org>2010-01-07 11:48:59 +0000
commit882b23d3ee663c40d332d6fa457d9d2a26b0f945 (patch)
treecf268d0c56a962f387d108001246eddf3759c8e5 /src/ai
parent0e404038f27544fe7ebad2127b1651cd471732b6 (diff)
downloadopenttd-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/ai')
-rw-r--r--src/ai/ai_gui.cpp28
1 files changed, 17 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),