summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-05-19 09:40:18 +0000
committerrubidium <rubidium@openttd.org>2007-05-19 09:40:18 +0000
commit7d4be11516e2ef80bcce2a61f08d1cf091401ef1 (patch)
treefcea59953bd1ce2ff5f0302669d3649bf7ca78bb /src/vehicle_gui.cpp
parent816d31f0aac2612ab1b076c5a99480b7534242ae (diff)
downloadopenttd-7d4be11516e2ef80bcce2a61f08d1cf091401ef1.tar.xz
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index f9859e917..03e232205 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -31,6 +31,7 @@
#include "depot.h"
#include "helpers.hpp"
#include "cargotype.h"
+#include "group.h"
struct Sorting {
Listing aircraft;
@@ -41,15 +42,6 @@ struct Sorting {
static Sorting _sorting;
-struct vehiclelist_d {
- const Vehicle** sort_list; // List of vehicles (sorted)
- Listing *_sorting; // pointer to the appropiate subcategory of _sorting
- uint16 length_of_sort_list; // Keeps track of how many vehicle pointers sort list got space for
- VehicleType vehicle_type; // The vehicle type that is sorted
- list_d l; // General list struct
-};
-assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d));
-
static bool _internal_sort_order; // descending/ascending
typedef int CDECL VehicleSortListingTypeFunction(const void*, const void*);
@@ -78,7 +70,7 @@ static VehicleSortListingTypeFunction* const _vehicle_sorter[] = {
&VehicleValueSorter,
};
-static const StringID _vehicle_sort_listing[] = {
+const StringID _vehicle_sort_listing[] = {
STR_SORT_BY_NUMBER,
STR_SORT_BY_DROPDOWN_NAME,
STR_SORT_BY_AGE,
@@ -134,7 +126,7 @@ void ResortVehicleLists()
}
}
-static void BuildVehicleList(vehiclelist_d* vl, PlayerID owner, uint16 index, uint16 window_type)
+void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 window_type)
{
if (!(vl->l.flags & VL_REBUILD)) return;
@@ -146,7 +138,7 @@ static void BuildVehicleList(vehiclelist_d* vl, PlayerID owner, uint16 index, ui
vl->l.flags |= VL_RESORT;
}
-static void SortVehicleList(vehiclelist_d *vl)
+void SortVehicleList(vehiclelist_d *vl)
{
if (!(vl->l.flags & VL_RESORT)) return;
@@ -749,16 +741,6 @@ void ChangeVehicleViewWindow(const Vehicle *from_v, const Vehicle *to_v)
}
}
-/*
- * Start of functions regarding vehicle list windows
- */
-
-enum {
- PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
- PLY_WND_PRC__SIZE_OF_ROW_SMALL = 26,
- PLY_WND_PRC__SIZE_OF_ROW_BIG = 36,
-};
-
enum VehicleListWindowWidgets {
VLW_WIDGET_CLOSEBOX = 0,
VLW_WIDGET_CAPTION,
@@ -926,7 +908,7 @@ static void CreateVehicleListWindow(Window *w)
vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; // Set up resort timer
}
-static void DrawSmallOrderList(const Vehicle *v, int x, int y)
+void DrawSmallOrderList(const Vehicle *v, int x, int y)
{
const Order *order;
int sel, i = 0;
@@ -1275,7 +1257,11 @@ static void ShowVehicleListWindowLocal(PlayerID player, uint16 VLW_flag, Vehicle
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type)
{
- ShowVehicleListWindowLocal(player, VLW_STANDARD, vehicle_type, 0);
+ if (player == _local_player && _patches.advanced_vehicle_list) {
+ ShowPlayerGroup(player, vehicle_type);
+ } else {
+ ShowVehicleListWindowLocal(player, VLW_STANDARD, vehicle_type, 0);
+ }
}
void ShowVehicleListWindow(const Vehicle *v)