diff options
author | Yexo <yexo@openttd.org> | 2009-02-02 22:57:22 +0000 |
---|---|---|
committer | Yexo <yexo@openttd.org> | 2009-02-02 22:57:22 +0000 |
commit | a5807f4a77a5a50013ad990ce5d9e65e4598f31a (patch) | |
tree | fc22e19a8aa2d253e5a61e9d1e50ba9aa55c3d32 | |
parent | 5e6e4417a5adea1e2573e6d29e974d6a4426a8c6 (diff) | |
download | openttd-a5807f4a77a5a50013ad990ce5d9e65e4598f31a.tar.xz |
(svn r15322) -Fix (r15175): The AI list window didn't display information about the selected AI if it wasn't visible.
-rw-r--r-- | src/ai/ai_gui.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 4c34531df..a07ac4ede 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -75,9 +75,6 @@ struct AIListWindow : public Window { this->DrawWidgets(); /* Draw a list of all available AIs. */ - AIInfoList::const_iterator it = this->ai_info_list->begin(); - int i = 1; - for (; i < this->vscroll.pos; i++) it++; int y = this->widget[AIL_WIDGET_LIST].top; /* First AI in the list is hardcoded to random */ if (this->vscroll.pos == 0) { @@ -85,10 +82,13 @@ struct AIListWindow : public Window { y += 14; } AIInfo *selected_info = NULL; - for (; i < this->vscroll.pos + this->vscroll.cap && it != this->ai_info_list->end(); i++, it++) { + AIInfoList::const_iterator it = this->ai_info_list->begin(); + for (int i = 1; it != this->ai_info_list->end(); i++, it++) { if (this->selected == i - 1) selected_info = (*it).second; - DoDrawStringTruncated((*it).second->GetName(), 4, y + 3, (this->selected == i - 1) ? TC_WHITE : TC_BLACK, this->width - 8); - y += 14; + if (IsInsideBS(i, this->vscroll.pos, this->vscroll.cap)) { + DoDrawStringTruncated((*it).second->GetName(), 4, y + 3, (this->selected == i - 1) ? TC_WHITE : TC_BLACK, this->width - 8); + y += 14; + } } /* Some info about the currently selected AI. */ |