28 #include "roadveh.h" |
28 #include "roadveh.h" |
29 #include "depot.h" |
29 #include "depot.h" |
30 #include "helpers.hpp" |
30 #include "helpers.hpp" |
31 #include "cargotype.h" |
31 #include "cargotype.h" |
32 |
32 |
33 typedef struct Sorting { |
33 struct Sorting { |
34 Listing aircraft; |
34 Listing aircraft; |
35 Listing roadveh; |
35 Listing roadveh; |
36 Listing ship; |
36 Listing ship; |
37 Listing train; |
37 Listing train; |
38 } Sorting; |
38 }; |
39 |
39 |
40 static Sorting _sorting; |
40 static Sorting _sorting; |
41 |
41 |
42 typedef struct vehiclelist_d { |
42 struct vehiclelist_d { |
43 const Vehicle** sort_list; // List of vehicles (sorted) |
43 const Vehicle** sort_list; // List of vehicles (sorted) |
44 Listing *_sorting; // pointer to the appropiate subcategory of _sorting |
44 Listing *_sorting; // pointer to the appropiate subcategory of _sorting |
45 uint16 length_of_sort_list; // Keeps track of how many vehicle pointers sort list got space for |
45 uint16 length_of_sort_list; // Keeps track of how many vehicle pointers sort list got space for |
46 byte vehicle_type; // The vehicle type that is sorted |
46 byte vehicle_type; // The vehicle type that is sorted |
47 list_d l; // General list struct |
47 list_d l; // General list struct |
48 } vehiclelist_d; |
48 }; |
49 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d)); |
49 assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d)); |
50 |
50 |
51 static bool _internal_sort_order; // descending/ascending |
51 static bool _internal_sort_order; // descending/ascending |
52 |
52 |
53 typedef int CDECL VehicleSortListingTypeFunction(const void*, const void*); |
53 typedef int CDECL VehicleSortListingTypeFunction(const void*, const void*); |
178 pal = PALETTE_TO_GREEN; |
178 pal = PALETTE_TO_GREEN; |
179 } |
179 } |
180 DrawSprite(SPR_BLOT, pal, x, y); |
180 DrawSprite(SPR_BLOT, pal, x, y); |
181 } |
181 } |
182 |
182 |
183 typedef struct RefitOption { |
183 struct RefitOption { |
184 CargoID cargo; |
184 CargoID cargo; |
185 byte subtype; |
185 byte subtype; |
186 uint16 value; |
186 uint16 value; |
187 EngineID engine; |
187 EngineID engine; |
188 } RefitOption; |
188 }; |
189 |
189 |
190 typedef struct RefitList { |
190 struct RefitList { |
191 uint num_lines; |
191 uint num_lines; |
192 RefitOption *items; |
192 RefitOption *items; |
193 } RefitList; |
193 }; |
194 |
194 |
195 static RefitList *BuildRefitList(const Vehicle *v) |
195 static RefitList *BuildRefitList(const Vehicle *v) |
196 { |
196 { |
197 uint max_lines = 256; |
197 uint max_lines = 256; |
198 RefitOption *refit = CallocT<RefitOption>(max_lines); |
198 RefitOption *refit = CallocT<RefitOption>(max_lines); |