OpenTTD Source: src/vehiclelist.cpp File Reference

OpenTTD Source 15.0-RC2

Functions
vehiclelist.cpp File Reference

Lists of vehicles. More...

`#include "stdafx.h"`
`#include "train.h"`
`#include "vehicle_func.h"`
`#include "vehiclelist.h"`
`#include "vehiclelist_func.h"`
`#include "group.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Functions
void | BuildDepotVehicleList (VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons, bool individual_wagons)
| Generate a list of vehicles inside a depot.
bool | GenerateVehicleSortList (VehicleList *list, const VehicleListIdentifier &vli)
| Generate a list of vehicles based on window type.

## Detailed Description

Lists of vehicles.

Definition in file vehiclelist.cpp.

## Function Documentation

## ◆ BuildDepotVehicleList()

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 nullptr)
  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 43 of file vehiclelist.cpp.

References SpecializedVehicle< T, Type >::First(), SpecializedVehicle< T, Type >::From(), Vehicle::IsArticulatedPart(), GroundVehicle< T, Type >::IsFreeWagon(), GroundVehicle< T, Type >::IsRearDualheaded(), and VEH_TRAIN.

Referenced by CmdDepotMassAutoReplace(), CmdDepotSellAllVehicles(), and CmdMassStartStopVehicle().

## ◆ GenerateVehicleSortList()

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 70 of file vehiclelist.cpp.

References ALL_GROUP, VehicleListIdentifier::company, FindVehiclesWithOrder(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::GetIfValid(), Vehicle::group_id, GroupIsInGroup(), Vehicle::IsPrimaryVehicle(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Iterate(), NearestDepot, Vehicle::NextShared(), Vehicle::owner, BaseVehicle::type, VehicleListIdentifier::type, VL_DEPOT_LIST, VL_GROUP_LIST, VL_SHARED_ORDERS, VL_STANDARD, VL_STATION_LIST, and VehicleListIdentifier::vtype.

Referenced by CmdAddVehicleGroup(), CmdMassStartStopVehicle(), and SendAllVehiclesToDepot().