OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

Data Structures | Typedefs | Enumerations | Functions
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.

## Data Structures
struct | VehicleListIdentifier
| The information about a vehicle list. More...

## Typedefs
typedef SmallVector< const Vehicle *, 32 > | VehicleList
| A list of vehicles.

## Enumerations
enum | VehicleListType { VL_STANDARD, VL_SHARED_ORDERS, VL_STATION_LIST, VL_DEPOT_LIST, VL_GROUP_LIST, VLT_END }
| Vehicle List type flags.

## Functions
bool | GenerateVehicleSortList (VehicleList *list, const VehicleListIdentifier &identifier)
| 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.
uint | GetUnitNumberDigits (VehicleList &vehicles)
| Get the number of digits the biggest unit number of a set of vehicles has.

## Detailed Description

Functions and type for generating vehicle lists.

Definition in file vehiclelist.h.

## Typedef Documentation

typedef SmallVector<const Vehicle *, 32> VehicleList

A list of vehicles.

Definition at line 54 of 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 69 of file vehiclelist.cpp.

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

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

bool GenerateVehicleSortList | ( | VehicleList * | list,
|  | const VehicleListIdentifier & | vli
| ) |  |

Generate a list of vehicles based on window type.

Parameters

  list | Pointer to list to add vehicles to
  vli | The identifier of this vehicle list.

Returns
  false if invalid list is requested

Definition at line 114 of file vehiclelist.cpp.

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

Referenced by CmdMassStartStopVehicle(), and SendAllVehiclesToDepot().

uint GetUnitNumberDigits | ( | VehicleList & | vehicles | ) |

Get the number of digits the biggest unit number of a set of vehicles has.

Parameters

  vehicles | The list of vehicles.

Returns
  The number of digits to allocate space for.

Definition at line 106 of file vehicle_gui.cpp.

References SmallVector< T, S >::Begin(), and SmallVector< T, S >::End().

Referenced by DepotWindow::OnPaint().