OpenTTD Source  1.11.0-beta2
vehiclelist.cpp File Reference
#include "stdafx.h"
#include "train.h"
#include "vehiclelist.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. More...
 
bool GenerateVehicleSortList (VehicleList *list, const VehicleListIdentifier &vli)
 Generate a list of vehicles based on window type. More...
 

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
typeType of vehicle
tileThe tile the depot is located on
enginesPointer to list to add vehicles to
wagonsPointer to list to add wagons to (can be nullptr)
individual_wagonsIf 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 SpecializedVehicle< T, Type >::First(), SpecializedVehicle< Train, Type >::From(), Vehicle::IsArticulatedPart(), GroundVehicle< T, Type >::IsFreeWagon(), GroundVehicle< T, Type >::IsRearDualheaded(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), TRACK_BIT_DEPOT, and VEH_TRAIN.

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

◆ GenerateVehicleSortList()

bool GenerateVehicleSortList ( VehicleList list,
const VehicleListIdentifier vli 
)

Generate a list of vehicles based on window type.

Parameters
listPointer to list to add vehicles to
vliThe identifier of this vehicle list.
Returns
false if invalid list is requested

Definition at line 113 of file vehiclelist.cpp.

References VehicleListIdentifier::type.

Referenced by CmdMassStartStopVehicle(), and SendAllVehiclesToDepot().