summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-01-21 01:07:15 +0000
committerbjarni <bjarni@openttd.org>2007-01-21 01:07:15 +0000
commit518c4cdfce47fd86ef3e77df8685a34c251d608f (patch)
tree09c1059d8a41c14216fb938e065edefaf3716fcc /src/vehicle_gui.cpp
parent7871ce1879d3dba99cdfecc50a41d571a8f7438a (diff)
downloadopenttd-518c4cdfce47fd86ef3e77df8685a34c251d608f.tar.xz
(svn r8295) -Cleanup: merged arguments station, order and depot_airport_index for GenerateVehicleSortList() and BuildVehicleList() into one uint16 argument
It turned out that all 3 arguments were the same at all the places those functions are called, so there was no point in having more than one
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index edc430d53..a9dc9f6a0 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -138,13 +138,13 @@ void ResortVehicleLists(void)
}
}
-static void BuildVehicleList(vehiclelist_d* vl, PlayerID owner, StationID station, OrderID order, uint16 depot_airport_index, uint16 window_type)
+static void BuildVehicleList(vehiclelist_d* vl, PlayerID owner, uint16 index, uint16 window_type)
{
if (!(vl->l.flags & VL_REBUILD)) return;
- DEBUG(misc, 3, "Building vehicle list for player %d at station %d", owner, station);
+ DEBUG(misc, 3, "Building vehicle list for player %d at station %d", owner, index);
- vl->l.list_length = GenerateVehicleSortList(&vl->sort_list, &vl->length_of_sort_list, vl->vehicle_type, owner, station, order, depot_airport_index, window_type);
+ vl->l.list_length = GenerateVehicleSortList(&vl->sort_list, &vl->length_of_sort_list, vl->vehicle_type, owner, index, window_type);
vl->l.flags &= ~VL_REBUILD;
vl->l.flags |= VL_RESORT;
@@ -1590,11 +1590,9 @@ static void DrawVehicleListWindow(Window *w)
const PlayerID owner = (PlayerID)w->caption_color;
const Player *p = GetPlayer(owner);
const uint16 window_type = w->window_number & VLW_MASK;
- const StationID station = (window_type == VLW_STATION_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
- const OrderID order = (window_type == VLW_SHARED_ORDERS) ? GB(w->window_number, 16, 16) : INVALID_ORDER;
- const uint16 depot_airport_index = (window_type == VLW_DEPOT_LIST) ? GB(w->window_number, 16, 16) : INVALID_STATION;
+ const uint16 index = GB(w->window_number, 16, 16);
- BuildVehicleList(vl, owner, station, order, depot_airport_index, window_type);
+ BuildVehicleList(vl, owner, index, window_type);
SortVehicleList(vl);
SetVScrollCount(w, vl->l.list_length);
@@ -1616,7 +1614,7 @@ static void DrawVehicleListWindow(Window *w)
break;
case VLW_STATION_LIST: /* Station Name */
- SetDParam(0, station);
+ SetDParam(0, index);
SetDParam(1, w->vscroll.count);
break;
@@ -1629,9 +1627,9 @@ static void DrawVehicleListWindow(Window *w)
default: NOT_REACHED(); break;
}
if (vl->vehicle_type == VEH_Aircraft) {
- SetDParam(1, depot_airport_index); // Airport name
+ SetDParam(1, index); // Airport name
} else {
- SetDParam(1, GetDepot(depot_airport_index)->town_index);
+ SetDParam(1, GetDepot(index)->town_index);
}
SetDParam(2, w->vscroll.count);
break;