Update readme and changelog for v1.26.0
[openttd-joker.git] / src / vehiclelist.h
blobf330f96b705f3080aa99d840c027e4d8652f54b6
1 /* $Id: vehiclelist.h 26112 2013-11-25 16:36:11Z rubidium $ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file vehiclelist.h Functions and type for generating vehicle lists. */
12 #ifndef VEHICLELIST_H
13 #define VEHICLELIST_H
15 #include "core/smallvec_type.hpp"
16 #include "vehicle_type.h"
17 #include "company_type.h"
18 #include "tile_type.h"
20 /** Vehicle List type flags */
21 enum VehicleListType {
22 VL_STANDARD,
23 VL_SHARED_ORDERS,
24 VL_STATION_LIST,
25 VL_DEPOT_LIST,
26 VL_GROUP_LIST,
27 VL_SLOT_LIST,
28 VLT_END
31 enum VehicleSortType
33 VST_NUMBER,
34 VST_NAME,
35 VST_AGE,
36 VST_PROFIT_THIS_YEAR,
37 VST_PROFIT_LAST_YEAR,
38 VST_PROFIT_LIFETIME,
39 VST_CARGO,
40 VST_RELIABILITY,
41 VST_MAX_SPEED,
42 VST_MODEL,
43 VST_VALUE,
44 VST_LENGTH,
45 VST_TIME_TO_LIVE,
46 VST_TIMETABLE_DELAY,
49 /** The information about a vehicle list. */
50 struct VehicleListIdentifier {
51 VehicleListType type; ///< The type of vehicle list.
52 VehicleType vtype; ///< The vehicle type associated with this list.
53 CompanyID company; ///< The company associated with this list.
54 uint32 index; ///< A vehicle list type specific index.
56 uint32 Pack() const;
57 bool UnpackIfValid(uint32 data);
58 static VehicleListIdentifier UnPack(uint32 data);
60 /**
61 * Create a simple vehicle list.
62 * @param type List type.
63 * @param vtype Vehicle type associated with this list.
64 * @param company Company associated with this list.
65 * @param index Optional type specific index.
67 VehicleListIdentifier(VehicleListType type, VehicleType vtype, CompanyID company, uint index = 0) :
68 type(type), vtype(vtype), company(company), index(index) {}
70 VehicleListIdentifier() : type(), vtype(), company(), index() {}
73 /** A list of vehicles. */
74 typedef SmallVector<const Vehicle *, 32> VehicleList;
76 bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &identifier);
77 void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list, bool individual_wagons = false);
78 uint GetUnitNumberDigits(VehicleList &vehicles);
80 #endif /* VEHICLELIST_H */