Index: src/ai/ai_gui.cpp
===================================================================
--- src/ai/ai_gui.cpp (revision 27553)
+++ src/ai/ai_gui.cpp (working copy)
@@ -675,8 +675,7 @@
EndContainer(),
NWidget(WWT_FRAME, COLOUR_MAUVE), SetDataTip(STR_AI_CONFIG_AI, STR_NULL), SetPadding(0, 5, 0, 5),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 112), SetFill(1, 0), SetMatrixDataTip(1, 8, STR_AI_CONFIG_AILIST_TOOLTIP), SetScrollbar(WID_AIC_SCROLLBAR),
- NWidget(NWID_VSCROLLBAR, COLOUR_MAUVE, WID_AIC_SCROLLBAR),
+ NWidget(WWT_MATRIX, COLOUR_MAUVE, WID_AIC_LIST), SetMinimalSize(288, 210), SetFill(1, 0), SetMatrixDataTip(1, 15, STR_AI_CONFIG_AILIST_TOOLTIP),
EndContainer(),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 9),
@@ -711,16 +710,11 @@
struct AIConfigWindow : public Window {
CompanyID selected_slot; ///< The currently selected AI slot or \c INVALID_COMPANY.
int line_height; ///< Height of a single AI-name line.
- Scrollbar *vscroll; ///< Cache of the vertical scrollbar.
AIConfigWindow() : Window(&_ai_config_desc)
{
this->InitNested(WN_GAME_OPTIONS_AI); // Initializes 'this->line_height' as a side effect.
- this->vscroll = this->GetScrollbar(WID_AIC_SCROLLBAR);
this->selected_slot = INVALID_COMPANY;
- NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_AIC_LIST);
- this->vscroll->SetCapacity(nwi->current_y / this->line_height);
- this->vscroll->SetCount(MAX_COMPANIES);
this->OnInvalidateData(0);
}
@@ -764,7 +758,7 @@
case WID_AIC_LIST:
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
- size->height = 8 * this->line_height;
+ size->height = 15 * this->line_height;
break;
}
}
@@ -809,7 +803,7 @@
case WID_AIC_LIST: {
int y = r.top;
- for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < MAX_COMPANIES; i++) {
+ for (int i = 0; i < MAX_COMPANIES; i++) {
StringID text;
if ((_game_mode != GM_NORMAL && i == 0) || (_game_mode == GM_NORMAL && Company::IsValidHumanID(i))) {
@@ -860,7 +854,7 @@
}
case WID_AIC_LIST: { // Select a slot
- this->selected_slot = (CompanyID)this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height);
+ this->selected_slot = (CompanyID)this->GetRowFromWidget(pt.y, widget, 0, this->line_height);
this->InvalidateData();
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
break;
@@ -870,7 +864,6 @@
if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot - 1))) {
Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot - 1]);
this->selected_slot--;
- this->vscroll->ScrollTowards(this->selected_slot);
this->InvalidateData();
}
break;
@@ -879,7 +872,6 @@
if (IsEditable(this->selected_slot) && IsEditable((CompanyID)(this->selected_slot + 1))) {
Swap(GetGameSettings().ai_config[this->selected_slot], GetGameSettings().ai_config[this->selected_slot + 1]);
this->selected_slot++;
- this->vscroll->ScrollTowards(this->selected_slot);
this->InvalidateData();
}
break;
Index: src/script/api/game/game_window.hpp.sq
===================================================================
--- src/script/api/game/game_window.hpp.sq (revision 27553)
+++ src/script/api/game/game_window.hpp.sq (working copy)
@@ -176,7 +176,6 @@
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_NUMBER, "WID_AIC_NUMBER");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_GAMELIST, "WID_AIC_GAMELIST");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_LIST, "WID_AIC_LIST");
- SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_SCROLLBAR, "WID_AIC_SCROLLBAR");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_MOVE_UP, "WID_AIC_MOVE_UP");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_MOVE_DOWN, "WID_AIC_MOVE_DOWN");
SQGSWindow.DefSQConst(engine, ScriptWindow::WID_AIC_CHANGE, "WID_AIC_CHANGE");
Index: src/script/api/script_window.hpp
===================================================================
--- src/script/api/script_window.hpp (revision 27553)
+++ src/script/api/script_window.hpp (working copy)
@@ -867,7 +867,6 @@
WID_AIC_NUMBER = ::WID_AIC_NUMBER, ///< Number of AIs.
WID_AIC_GAMELIST = ::WID_AIC_GAMELIST, ///< List with current selected GameScript.
WID_AIC_LIST = ::WID_AIC_LIST, ///< List with currently selected AIs.
- WID_AIC_SCROLLBAR = ::WID_AIC_SCROLLBAR, ///< Scrollbar to scroll through the selected AIs.
WID_AIC_MOVE_UP = ::WID_AIC_MOVE_UP, ///< Move up button.
WID_AIC_MOVE_DOWN = ::WID_AIC_MOVE_DOWN, ///< Move down button.
WID_AIC_CHANGE = ::WID_AIC_CHANGE, ///< Select another AI button.
Index: src/widgets/ai_widget.h
===================================================================
--- src/widgets/ai_widget.h (revision 27553)
+++ src/widgets/ai_widget.h (working copy)
@@ -42,7 +42,6 @@
WID_AIC_NUMBER, ///< Number of AIs.
WID_AIC_GAMELIST, ///< List with current selected GameScript.
WID_AIC_LIST, ///< List with currently selected AIs.
- WID_AIC_SCROLLBAR, ///< Scrollbar to scroll through the selected AIs.
WID_AIC_MOVE_UP, ///< Move up button.
WID_AIC_MOVE_DOWN, ///< Move down button.
WID_AIC_CHANGE, ///< Select another AI button.