(svn r18947) -Fix [FS#1510]: after clicking move up/move down in the newgrf/ai the selected item could be out of range

This commit is contained in:
yexo
2010-01-29 15:45:53 +00:00
parent a668e801e4
commit 81882039e3
2 changed files with 8 additions and 2 deletions

View File

@@ -604,6 +604,7 @@ struct AIConfigWindow : public Window {
if (this->selected_slot > 1) {
Swap(_settings_newgame.ai_config[this->selected_slot], _settings_newgame.ai_config[this->selected_slot - 1]);
this->selected_slot--;
this->vscroll.ScrollTowards(this->selected_slot);
this->InvalidateData();
}
break;
@@ -612,6 +613,7 @@ struct AIConfigWindow : public Window {
if (this->selected_slot < _settings_newgame.difficulty.max_no_competitors) {
Swap(_settings_newgame.ai_config[this->selected_slot], _settings_newgame.ai_config[this->selected_slot + 1]);
this->selected_slot++;
this->vscroll.ScrollTowards(this->selected_slot);
this->InvalidateData();
}
break;