25 assert(this->
vtype < (1 << 2));
26 assert(this->
index < (1 << 20));
27 assert(this->
type < VLT_END);
28 assert_compile(VLT_END <= (1 << 3));
30 return c << 28 | this->
type << 23 | this->
vtype << 26 | this->
index;
40 byte c =
GB(data, 28, 4);
46 return this->
type < VLT_END;
72 if (wagons !=
nullptr && wagons != engines) wagons->clear();
76 if (v->type != type)
continue;
77 if (v->tile != tile)
continue;
85 if (individual_wagons || t->
IsFreeWagon()) wagons->push_back(t);
92 if (!v->IsInDepot())
continue;
96 if (!v->IsPrimaryVehicle())
continue;
98 engines->push_back(v);
103 engines->shrink_to_fit();
104 if (wagons !=
nullptr && wagons != engines) wagons->shrink_to_fit();
118 case VL_STATION_LIST:
120 if (v->type == vli.
vtype && v->IsPrimaryVehicle()) {
123 FOR_VEHICLE_ORDERS(v, order) {
124 if ((order->
IsType(OT_GOTO_STATION) || order->
IsType(OT_GOTO_WAYPOINT) || order->
IsType(OT_IMPLICIT))
134 case VL_SHARED_ORDERS: {
148 if (v->type == vli.
vtype && v->IsPrimaryVehicle() &&
159 if (v->type == vli.
vtype && v->owner == vli.
company && v->IsPrimaryVehicle()) {
167 if (v->type == vli.
vtype && v->IsPrimaryVehicle()) {
170 FOR_VEHICLE_ORDERS(v, order) {
180 default:
return false;
183 list->shrink_to_fit();
Owner
Enum for all companies/owners.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
CompanyID company
The company associated with this list.
The information about a vehicle list.
Functions and type for generating vehicle lists.
Base for the train class.
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.
VehicleType
Available vehicle types.
bool UnpackIfValid(uint32 data)
Unpack a VehicleListIdentifier from a single uint32.
T * First() const
Get the first vehicle in the chain.
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.
static Train * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
OrderDepotActionFlags GetDepotActionType() const
What are we going to do when in the depot.
The tile has no ownership.
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
uint32 index
A vehicle list type specific index.
bool IsType(OrderType type) const
Check whether this order is of the given type.
Definition of base types and functions in a cross-platform compatible way.
bool IsArticulatedPart() const
Check if the vehicle is an articulated part of an engine.
A number of safeguards to prevent using unsafe methods.
static VehicleListIdentifier UnPack(uint32 data)
Decode a packed vehicle list identifier into a new one.
bool IsRearDualheaded() const
Tell if we are dealing with the rear end of a multiheaded engine.
'Train' is either a loco or a wagon.
DestinationID GetDestination() const
Gets the destination of this order.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
uint32 TileIndex
The index/ID of a Tile.
uint32 Pack() const
Pack a VehicleListIdentifier in a single uint32.
Send the vehicle to the nearest depot.
VehicleListType type
The type of vehicle list.
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
VehicleType type
Type of vehicle.
VehicleListType
Vehicle List type flags.
bool IsFreeWagon() const
Check if the vehicle is a free wagon (got no engine in front of it).
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
std::vector< const Vehicle * > VehicleList
A list of vehicles.
VehicleType vtype
The vehicle type associated with this list.
static const GroupID ALL_GROUP
All vehicles are in this group.