# vehiclelist.h File Reference

Functions and type for generating vehicle lists. More...

`#include "core/smallvec_type.hpp"`
`#include "vehicle_type.h"`
`#include "company_type.h"`
`#include "tile_type.h"`

Go to the source code of this file.

## Typedefs
typedef SmallVector< const Vehicle *, 32 > | VehicleList
## Functions
bool | GenerateVehicleSortList (VehicleList *list, VehicleType type, Owner owner, uint32 index, uint16 window_type)
| Generate a list of vehicles based on window type.
void | BuildDepotVehicleList (VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list, bool individual_wagons=false)
| Generate a list of vehicles inside a depot.

## Detailed Description

Functions and type for generating vehicle lists.

Definition in file vehiclelist.h.

## Function Documentation

void BuildDepotVehicleList | ( | VehicleType | type,
|  | TileIndex | tile,
|  | VehicleList * | engines,
|  | VehicleList * | wagons,
|  | bool | individual_wagons |
| ) |  |  |

Generate a list of vehicles inside a depot.

Parameters:

  | type | Type of vehicle
  | tile | The tile the depot is located on
  | engines | Pointer to list to add vehicles to
  | wagons | Pointer to list to add wagons to (can be NULL)
  | individual_wagons | If true add every wagon to wagons which is not attached to an engine. If false only add the first wagon of every row.

Definition at line 25 of file vehiclelist.cpp.

References SmallVector< T, S >::Append(), SmallVector< T, S >::Clear(), SmallVector< T, S >::Compact(), SpecializedVehicle< T, Type >::First(), SpecializedVehicle< Train, VEH_TRAIN >::From(), Train::IsArticulatedPart(), Train::IsFreeWagon(), Vehicle::IsInDepot(), Vehicle::IsPrimaryVehicle(), Train::IsRearDualheaded(), Vehicle::tile, TRACK_BIT_DEPOT, BaseVehicle::type, and VEH_TRAIN.

Referenced by CmdDepotMassAutoReplace(), CmdDepotSellAllVehicles(), CmdMassStartStopVehicle(), and DepotWindow::OnPaint().

bool GenerateVehicleSortList | ( | VehicleList * | list,
|  | VehicleType | type,
|  | Owner | owner,
|  | uint32 | index,
|  | uint16 | window_type |
| ) |  |  |

Generate a list of vehicles based on window type.

Parameters:

  | list | Pointer to list to add vehicles to
  | type | Type of vehicle
  | owner | Company to generate list for
  | index | This parameter has different meanings depending on window_type VLW_STATION_LIST: index of station to generate a list for VLW_SHARED_ORDERS: index of order to generate a list for VLW_STANDARD: not used VLW_DEPOT_LIST: TileIndex of the depot/hangar to make the list for VLW_GROUP_LIST: index of group to generate a list for VLW_WAYPOINT_LIST: index of waypoint to generate a list for
  | window_type | The type of window the list is for, using the VLW_ flags in vehicle_gui.h

Returns:
  false if invalid list is requested

Definition at line 81 of file vehiclelist.cpp.

References SmallVector< T, S >::Append(), SmallVector< T, S >::Clear(), SmallVector< T, S >::Compact(), Order::GetDepotActionType(), Order::GetDestination(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >::GetIfValid(), Vehicle::group_id, Vehicle::IsPrimaryVehicle(), Order::IsType(), Vehicle::NextShared(), ODATFB_NEAREST_DEPOT, and BaseVehicle::type.

Referenced by CmdMassStartStopVehicle(), and SendAllVehiclesToDepot().