1
0
Fork 0

Fix f66baa44: index was off by one (#8433)

i++ in the 3rd part of a for() is post, not pre. Oops.
pull/8434/head
Patric Stout 2020-12-25 19:57:13 +01:00 committed by GitHub
parent f66baa444f
commit e6e91a345c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -127,7 +127,7 @@ struct AIListWindow : public Window {
DrawString(r.left + WD_MATRIX_LEFT, r.right - WD_MATRIX_LEFT, y + WD_MATRIX_TOP, this->slot == OWNER_DEITY ? STR_AI_CONFIG_NONE : STR_AI_CONFIG_RANDOM_AI, this->selected == -1 ? TC_WHITE : TC_ORANGE);
y += this->line_height;
}
int i = 1;
int i = 0;
for (const auto &item : *this->info_list) {
i++;
if (this->vscroll->IsVisible(i)) {
@ -139,7 +139,7 @@ struct AIListWindow : public Window {
}
case WID_AIL_INFO_BG: {
AIInfo *selected_info = nullptr;
int i = 1;
int i = 0;
for (const auto &item : *this->info_list) {
i++;
if (this->selected == i - 1) selected_info = static_cast<AIInfo *>(item.second);