summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2021-04-21 15:22:45 +0100
committerMichael Lutz <michi@icosahedron.de>2021-04-21 23:12:10 +0200
commit2a0365b3d992fb602fd91b218b4a8647ddb46975 (patch)
tree54ec865630b8292ce84eb47fff78f407411926ab /src/ai
parent96b78bc2cd9790e89228c53b4803a78320fc20bd (diff)
downloadopenttd-2a0365b3d992fb602fd91b218b4a8647ddb46975.tar.xz
Cleanup: Remove unnecessary parameter of GetScrolledRowFromWidget()
Line height defaults to the resize height of the relevant widget, which is set in all cases. Therefore it is not necessary to specify this value every time. Additionally fixes scrolled padding for the framerate window.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/ai_gui.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 14fc65cc8..49e37621e 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -190,7 +190,7 @@ struct AIListWindow : public Window {
{
switch (widget) {
case WID_AIL_LIST: { // Select one of the AIs
- int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_AIL_LIST, 0, this->line_height) - 1;
+ int sel = this->vscroll->GetScrolledRowFromWidget(pt.y, this, WID_AIL_LIST) - 1;
if (sel < (int)this->info_list->size()) {
this->selected = sel;
this->SetDirty();
@@ -784,6 +784,7 @@ struct AIConfigWindow : public Window {
case WID_AIC_LIST:
this->line_height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
+ resize->height = this->line_height;
size->height = 8 * this->line_height;
break;
@@ -895,7 +896,7 @@ struct AIConfigWindow : public Window {
}
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->vscroll->GetScrolledRowFromWidget(pt.y, this, widget);
this->InvalidateData();
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
break;