1 /* $Id: vehiclelist.h 26112 2013-11-25 16:36:11Z rubidium $ */
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/>.
10 /** @file vehiclelist.h Functions and type for generating vehicle lists. */
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
{
31 /** The information about a vehicle list. */
32 struct VehicleListIdentifier
{
33 VehicleListType type
; ///< The type of vehicle list.
34 VehicleType vtype
; ///< The vehicle type associated with this list.
35 CompanyID company
; ///< The company associated with this list.
36 uint32 index
; ///< A vehicle list type specific index.
39 bool UnpackIfValid(uint32 data
);
40 static VehicleListIdentifier
UnPack(uint32 data
);
43 * Create a simple vehicle list.
44 * @param type List type.
45 * @param vtype Vehicle type associated with this list.
46 * @param company Company associated with this list.
47 * @param index Optional type specific index.
49 VehicleListIdentifier(VehicleListType type
, VehicleType vtype
, CompanyID company
, uint index
= 0) :
50 type(type
), vtype(vtype
), company(company
), index(index
) {}
52 VehicleListIdentifier() : type(), vtype(), company(), index() {}
55 /** A list of vehicles. */
56 typedef SmallVector
<const Vehicle
*, 32> VehicleList
;
58 bool GenerateVehicleSortList(VehicleList
*list
, const VehicleListIdentifier
&identifier
);
59 void BuildDepotVehicleList(VehicleType type
, TileIndex tile
, VehicleList
*engine_list
, VehicleList
*wagon_list
, bool individual_wagons
= false);
60 uint
GetUnitNumberDigits(VehicleList
&vehicles
);
62 #endif /* VEHICLELIST_H */