diff options
author | peter1138 <peter1138@openttd.org> | 2006-10-01 14:55:53 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-10-01 14:55:53 +0000 |
commit | 8d5c98ee873525a5dc06cb9fe3a40ec31870d2fe (patch) | |
tree | 86a4573de41b756ef6311c07873f44faad2e6b39 | |
parent | c1f29c5ab3a5ce5f5ee485bb74514d8f05584d9d (diff) | |
download | openttd-8d5c98ee873525a5dc06cb9fe3a40ec31870d2fe.tar.xz |
(svn r6607) - Fix (r6601): Fix selection of refit type when the list is scrolled.
-rw-r--r-- | vehicle_gui.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c index 57e6adf49..b70cc3ad4 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -294,14 +294,14 @@ static RefitOption *DrawVehicleRefitWindow(const RefitList *list, int sel, uint uint i; /* Draw the list, and find the selected cargo (by its position in list) */ - for (i = pos; i < num_lines && i < pos + rows; i++) { + for (i = 0; i < num_lines; i++) { byte colour = 16; if (sel == 0) { selected = &refit[i]; colour = 12; } - if (i >= pos && y < rows * 10) { + if (i >= pos && i < pos + rows) { /* Draw the cargo name */ int last_x = DrawString(2, y, _cargoc.names_s[_local_cargo_id_ctype[refit[i].cargo]], colour); @@ -367,7 +367,7 @@ static void VehicleRefitWndProc(Window *w, WindowEvent *e) case 3: { // listbox int y = e->we.click.pt.y - w->widget[3].top; if (y >= 0) { - WP(w,refit_d).sel = y / (int)w->resize.step_height; + WP(w,refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos; SetWindowDirty(w); } } break; |