summaryrefslogtreecommitdiff
path: root/src/build_vehicle_gui.cpp
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-02-07 19:10:19 +0000
committerbjarni <bjarni@openttd.org>2007-02-07 19:10:19 +0000
commit037d6367349afa5a27ddf2cf015f6490167cf786 (patch)
treeb16bae58b03b0c68fe0ab88a8311dd7f6406238a /src/build_vehicle_gui.cpp
parent5666d8d7272ff24116049757dc2405b55cfd4b97 (diff)
downloadopenttd-037d6367349afa5a27ddf2cf015f6490167cf786.tar.xz
(svn r8621) -Codechange: assigned new numbers to the VEH_(type) enum so that VEH_Train is 0, VEH_Road is 1 and so on
This means that "v->type" can be used as array indexes instead of VehTypeToIndex() (or "v->type - VEH_Train/0x10 as the code still used in some places) Surprisingly this can be done without changing the savegame format
Diffstat (limited to 'src/build_vehicle_gui.cpp')
-rw-r--r--src/build_vehicle_gui.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index e67fc6dd5..e38c852bc 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -712,7 +712,7 @@ static void GenerateBuildList(Window *w)
break;
}
_internal_sort_order = bv->descending_sort_order;
- EngList_Sort(&bv->eng_list, _sorter[VehTypeToIndex(bv->vehicle_type)][bv->sort_criteria]);
+ EngList_Sort(&bv->eng_list, _sorter[bv->vehicle_type][bv->sort_criteria]);
}
static void DrawVehicleEngine(byte type, int x, int y, EngineID engine, SpriteID pal)
@@ -799,7 +799,7 @@ static void DrawBuildVehicleWindow(Window *w)
DrawVehiclePurchaseInfo(2, wi->top + 1, wi->right - wi->left - 2, bv->sel_engine);
}
- DrawString(85, 15, _sort_listing[VehTypeToIndex(bv->vehicle_type)][bv->sort_criteria], 0x10);
+ DrawString(85, 15, _sort_listing[bv->vehicle_type][bv->sort_criteria], 0x10);
DoDrawString(bv->descending_sort_order ? DOWNARROW : UPARROW, 69, 15, 0x10);
}
@@ -810,7 +810,7 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
switch (e->we.click.widget) {
case BUILD_VEHICLE_WIDGET_SORT_ASSENDING_DESCENDING:
bv->descending_sort_order ^= true;
- _last_sort_order[VehTypeToIndex(bv->vehicle_type)] = bv->descending_sort_order;
+ _last_sort_order[bv->vehicle_type] = bv->descending_sort_order;
bv->regenerate_list = true;
SetWindowDirty(w);
break;
@@ -824,7 +824,7 @@ static void BuildVehicleClickEvent(Window *w, WindowEvent *e)
}
case BUILD_VEHICLE_WIDGET_SORT_TEXT: case BUILD_VEHICLE_WIDGET_SORT_DROPDOWN: // Select sorting criteria dropdown menu
- ShowDropDownMenu(w, _sort_listing[VehTypeToIndex(bv->vehicle_type)], bv->sort_criteria, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, 0, 0);
+ ShowDropDownMenu(w, _sort_listing[bv->vehicle_type], bv->sort_criteria, BUILD_VEHICLE_WIDGET_SORT_DROPDOWN, 0, 0);
break;
case BUILD_VEHICLE_WIDGET_BUILD: {
@@ -912,7 +912,7 @@ static void NewVehicleWndProc(Window *w, WindowEvent *e)
case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
if (bv->sort_criteria != e->we.dropdown.index) {
bv->sort_criteria = e->we.dropdown.index;
- _last_sort_criteria[VehTypeToIndex(bv->vehicle_type)] = bv->sort_criteria;
+ _last_sort_criteria[bv->vehicle_type] = bv->sort_criteria;
bv->regenerate_list = true;
}
SetWindowDirty(w);
@@ -961,8 +961,8 @@ void ShowBuildVehicleWindow(TileIndex tile, byte type)
bv->vehicle_type = type;
bv->regenerate_list = false;
- bv->sort_criteria = _last_sort_criteria[VehTypeToIndex(type)];
- bv->descending_sort_order = _last_sort_order[VehTypeToIndex(type)];
+ bv->sort_criteria = _last_sort_criteria[type];
+ bv->descending_sort_order = _last_sort_order[type];
switch (type) {
case VEH_Train: