From 9e42d2c51bb771d1187c40d3f3d565f1bd46adfb Mon Sep 17 00:00:00 2001 From: bjarni Date: Wed, 30 Aug 2006 18:35:02 +0000 Subject: [PATCH] (svn r6240) -Code cleanup: in PlayerVehWndProc: replaced size_of_row with w->resize.step_height it was only used twice, so there was no reason to calculate it for each event --- vehicle_gui.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/vehicle_gui.c b/vehicle_gui.c index 2b3e3131ba..bab1cff134 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -1214,7 +1214,6 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) { vehiclelist_d *vl = &WP(w, vehiclelist_d); const byte vehicle_type = GB(w->window_number, 11, 5); - const byte size_of_row = (vehicle_type == VEH_Aircraft || vehicle_type == VEH_Ship) ? PLY_WND_PRC__SIZE_OF_ROW_BIG : PLY_WND_PRC__SIZE_OF_ROW_SMALL; switch (e->event) { case WE_PAINT: { @@ -1372,7 +1371,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) ShowDropDownMenu(w, _vehicle_sort_listing, vl->sort_type, 5, 0, 0); return; case 7: { /* Matrix to show vehicles */ - uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / size_of_row; + uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / w->resize.step_height; const Vehicle *v; if (id_v >= w->vscroll.cap) return; // click out of bounds @@ -1468,7 +1467,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) case WE_RESIZE: /* Update the scroll + matrix */ if (vehicle_type == VEH_Train) w->hscroll.cap += e->sizing.diff.x; - w->vscroll.cap += e->sizing.diff.y / size_of_row; + w->vscroll.cap += e->sizing.diff.y / w->resize.step_height; w->widget[7].unkA = (w->vscroll.cap << 8) + 1; break; }