27 assert(this->
vtype < (1 << 2));
28 assert(this->
index < (1 << 20));
29 assert(this->
type < VLT_END);
30 static_assert(VLT_END <= (1 << 3));
32 return c << 28 | this->
type << 23 | this->
vtype << 26 | this->
index;
46 if (wagons !=
nullptr && wagons != engines) wagons->clear();
49 if (v->type != type || !v->IsInDepot())
continue;
54 if (wagons !=
nullptr && t->
First()->IsFreeWagon()) {
55 if (individual_wagons || t->
IsFreeWagon()) wagons->push_back(t);
60 if (v->IsPrimaryVehicle()) engines->push_back(v);
78 [&vli](
const Order *order) {
return (order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT) || order->IsType(OT_IMPLICIT)) && order->GetDestination() == vli.ToStationID(); },
79 [&list](
const Vehicle *v) { list->push_back(v); }
117 [&vli](
const Order *order) {
return order->IsType(OT_GOTO_DEPOT) && !(order->GetDepotActionType() &
ODATFB_NEAREST_DEPOT) && order->GetDestination() == vli.ToDestinationID(); },
118 [&list](
const Vehicle *v) { list->push_back(v); }
122 default:
return false;
Iterate over all vehicles on a tile.
static constexpr Owner OWNER_NONE
The tile has no ownership.
Base class for groups and group functions.
bool GroupIsInGroup(GroupID search, GroupID group)
Test if GroupID group is a descendant of (or is) GroupID search.
static constexpr GroupID ALL_GROUP
All vehicles are in this group.
@ ODATFB_NEAREST_DEPOT
Send the vehicle to the nearest depot.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
VehicleType type
Type of vehicle.
bool IsRearDualheaded() const
Tell if we are dealing with the rear end of a multiheaded engine.
bool IsFreeWagon() const
Check if the vehicle is a free wagon (got no engine in front of it).
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
static Titem * GetIfValid(auto index)
Returns Titem with given index.
static T * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
T * First() const
Get the first vehicle in the chain.
'Train' is either a loco or a wagon.
The information about a vehicle list.
VehicleListType type
The type of vehicle list.
CompanyID company
The company associated with this list.
WindowNumber ToWindowNumber() const
Pack a VehicleListIdentifier in 32 bits so it can be used as unique WindowNumber.
VehicleType vtype
The vehicle type associated with this list.
uint32_t index
A vehicle list type specific index.
GroupID group_id
Index of group Pool array.
bool IsArticulatedPart() const
Check if the vehicle is an articulated part of an engine.
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
Owner owner
Which company owns the vehicle?
Number to differentiate different windows of the same class.
Base for the train class.
Functions related to vehicles.
VehicleType
Available vehicle types.
@ VEH_TRAIN
Train vehicle type.
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &vli)
Generate a list of vehicles based on window type.
void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons, bool individual_wagons)
Generate a list of vehicles inside a depot.
Functions and type for generating vehicle lists.
std::vector< const Vehicle * > VehicleList
A list of vehicles.
@ VL_GROUP_LIST
Index is the group.
@ VL_STANDARD
Index is the company.
@ VL_STATION_LIST
Index is the station.
@ VL_DEPOT_LIST
Index is the destination (station for hangar of aircraft, depot for others)
@ VL_SHARED_ORDERS
Index is the first vehicle of the shared orders.
Functions and type for generating vehicle lists.
void FindVehiclesWithOrder(VehiclePredicate veh_pred, OrderPredicate ord_pred, VehicleFunc veh_func)
Find vehicles matching an order.