27 assert(this->
vtype < (1 << 2));
28 assert(this->
index < (1 << 20));
29 assert(this->
type < VLT_END);
30 assert_compile(VLT_END <= (1 << 3));
32 return c << 28 | this->
type << 23 | this->
vtype << 26 | this->
index;
42 byte c =
GB(data, 28, 4);
48 return this->
type < VLT_END;
74 if (wagons != NULL && wagons != engines) wagons->
Clear();
79 if (v->
type != type)
continue;
80 if (v->
tile != tile)
continue;
107 if (wagons != NULL && wagons != engines) wagons->
Compact();
123 case VL_STATION_LIST:
128 FOR_VEHICLE_ORDERS(v, order) {
129 if ((order->
IsType(OT_GOTO_STATION) || order->
IsType(OT_GOTO_WAYPOINT) || order->
IsType(OT_IMPLICIT))
139 case VL_SHARED_ORDERS:
174 FOR_VEHICLE_ORDERS(v, order) {
184 default:
return false;
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.
void Clear()
Remove all items from the list.
void Compact()
Compact the list down to the smallest block size boundary.
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.
T * Append(uint to_add=1)
Append an item and return it.
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
VehicleType
Available vehicle types.
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.
TileIndex tile
Current tile index.
The tile has no ownership.
virtual bool IsInDepot() const
Check whether the vehicle is in the depot.
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.
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.
OwnerByte owner
Which company owns the vehicle?
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
VehicleListType
Vehicle List type flags.
bool IsFreeWagon() const
Check if the vehicle is a free wagon (got no engine in front of it).
#define FOR_ALL_VEHICLES(var)
Iterate over all vehicles.
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
Owner
Enum for all companies/owners.
VehicleType vtype
The vehicle type associated with this list.
VehicleTypeByte type
Type of vehicle.
GroupID group_id
Index of group Pool array.
static const GroupID ALL_GROUP
All vehicles are in this group.