1
0
Fork 0

(svn r15322) -Fix (r15175): The AI list window didn't display information about the selected AI if it wasn't visible.

release/0.7
Yexo 2009-02-02 22:57:22 +00:00
parent 5e6e4417a5
commit a5807f4a77
1 changed files with 6 additions and 6 deletions

View File

@ -75,9 +75,6 @@ struct AIListWindow : public Window {
this->DrawWidgets(); this->DrawWidgets();
/* Draw a list of all available AIs. */ /* 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; int y = this->widget[AIL_WIDGET_LIST].top;
/* First AI in the list is hardcoded to random */ /* First AI in the list is hardcoded to random */
if (this->vscroll.pos == 0) { if (this->vscroll.pos == 0) {
@ -85,11 +82,14 @@ struct AIListWindow : public Window {
y += 14; y += 14;
} }
AIInfo *selected_info = NULL; 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; if (this->selected == i - 1) selected_info = (*it).second;
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); DoDrawStringTruncated((*it).second->GetName(), 4, y + 3, (this->selected == i - 1) ? TC_WHITE : TC_BLACK, this->width - 8);
y += 14; y += 14;
} }
}
/* Some info about the currently selected AI. */ /* Some info about the currently selected AI. */
if (selected_info != NULL) { if (selected_info != NULL) {