Mercurial > hg > openttd
changeset 4457:9b4d102dc829 draft
(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
author | bjarni <bjarni@openttd.org> |
---|---|
date | Wed, 30 Aug 2006 18:35:02 +0000 |
parents | 374f1bfde037 |
children | 90b8f0ff256f |
files | vehicle_gui.c |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -1214,7 +1214,6 @@ { 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 @@ 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 @@ 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; }