Fix #8316: Make sort industries by production and transported with a cargo filter...
[openttd-github.git] / src / vehiclelist.h
blob6cb2588ea6a77de763ec62c9174745425dc739e0
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file vehiclelist.h Functions and type for generating vehicle lists. */
10 #ifndef VEHICLELIST_H
11 #define VEHICLELIST_H
13 #include "core/smallvec_type.hpp"
14 #include "vehicle_type.h"
15 #include "company_type.h"
16 #include "tile_type.h"
18 /** Vehicle List type flags */
19 enum VehicleListType {
20 VL_STANDARD,
21 VL_SHARED_ORDERS,
22 VL_STATION_LIST,
23 VL_DEPOT_LIST,
24 VL_GROUP_LIST,
25 VLT_END
28 /** The information about a vehicle list. */
29 struct VehicleListIdentifier {
30 VehicleListType type; ///< The type of vehicle list.
31 VehicleType vtype; ///< The vehicle type associated with this list.
32 CompanyID company; ///< The company associated with this list.
33 uint32 index; ///< A vehicle list type specific index.
35 uint32 Pack() const;
36 bool UnpackIfValid(uint32 data);
37 static VehicleListIdentifier UnPack(uint32 data);
39 /**
40 * Create a simple vehicle list.
41 * @param type List type.
42 * @param vtype Vehicle type associated with this list.
43 * @param company Company associated with this list.
44 * @param index Optional type specific index.
46 VehicleListIdentifier(VehicleListType type, VehicleType vtype, CompanyID company, uint index = 0) :
47 type(type), vtype(vtype), company(company), index(index) {}
49 VehicleListIdentifier() : type(), vtype(), company(), index() {}
52 /** A list of vehicles. */
53 typedef std::vector<const Vehicle *> VehicleList;
55 bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &identifier);
56 void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list, bool individual_wagons = false);
57 uint GetUnitNumberDigits(VehicleList &vehicles);
59 #endif /* VEHICLELIST_H */