summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aircraft_gui.c4
-rw-r--r--roadveh_gui.c4
-rw-r--r--ship_gui.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c
index c2242a570..48a5f9c80 100644
--- a/aircraft_gui.c
+++ b/aircraft_gui.c
@@ -742,7 +742,7 @@ static int GetVehicleFromAircraftDepotWndPt(Window *w, int x, int y, Vehicle **v
xt = x / 74;
xm = x % 74;
- if (xt >= 4)
+ if (xt >= w->hscroll.cap)
return 1;
row = (y - 14) / 24;
@@ -750,7 +750,7 @@ static int GetVehicleFromAircraftDepotWndPt(Window *w, int x, int y, Vehicle **v
if (row >= w->vscroll.cap)
return 1;
- pos = (row + w->vscroll.pos) * 4 + xt;
+ pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
tile = w->window_number;
FOR_ALL_VEHICLES(v) {
diff --git a/roadveh_gui.c b/roadveh_gui.c
index 5fad9f8a0..d2ae1ceea 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -551,14 +551,14 @@ static int GetVehicleFromRoadDepotWndPt(Window *w, int x, int y, Vehicle **veh)
xt = x / 56;
xm = x % 56;
- if (xt >= 5)
+ if (xt >= w->hscroll.cap)
return 1;
row = (y - 14) / 14;
if (row >= w->vscroll.cap)
return 1;
- pos = (row + w->vscroll.pos) * 5 + xt;
+ pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
tile = w->window_number;
FOR_ALL_VEHICLES(v) {
diff --git a/ship_gui.c b/ship_gui.c
index 2f2fe9019..3495a1652 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -684,7 +684,7 @@ static int GetVehicleFromShipDepotWndPt(Window *w, int x, int y, Vehicle **veh)
xt = x / 90;
xm = x % 90;
- if (xt >= 5)
+ if (xt >= w->hscroll.cap)
return 1;
row = (y - 14) / 24;
@@ -692,7 +692,7 @@ static int GetVehicleFromShipDepotWndPt(Window *w, int x, int y, Vehicle **veh)
if (row >= w->vscroll.cap)
return 1;
- pos = (row + w->vscroll.pos) * 3 + xt;
+ pos = (row + w->vscroll.pos) * w->hscroll.cap + xt;
tile = w->window_number;
FOR_ALL_VEHICLES(v) {