Class defining several overloaded accessors so we don't have to cast vehicle types that often. More...
#include <vehicle_base.h>
Public Member Functions | |
FORCEINLINE | SpecializedVehicle () |
Set vehicle type correctly. | |
FORCEINLINE T * | First () const |
Get the first vehicle in the chain. | |
FORCEINLINE T * | Last () |
Get the last vehicle in the chain. | |
FORCEINLINE const T * | Last () const |
Get the last vehicle in the chain. | |
FORCEINLINE T * | Next () const |
Get next vehicle in the chain. | |
FORCEINLINE T * | Previous () const |
Get previous vehicle in the chain. | |
FORCEINLINE void | UpdateViewport (bool moved, bool turned) |
Update vehicle sprite- and position caches. | |
Static Public Member Functions | |
static FORCEINLINE bool | IsValidID (size_t index) |
Tests whether given index is a valid index for vehicle of this type. | |
static FORCEINLINE T * | Get (size_t index) |
Gets vehicle with given index. | |
static FORCEINLINE T * | GetIfValid (size_t index) |
Returns vehicle if the index is a valid index for this vehicle type. | |
static FORCEINLINE T * | From (Vehicle *v) |
Converts a Vehicle to SpecializedVehicle with type checking. | |
static FORCEINLINE const T * | From (const Vehicle *v) |
Converts a const Vehicle to const SpecializedVehicle with type checking. | |
Static Public Attributes | |
static const VehicleType | EXPECTED_TYPE = Type |
Specialized type. |
Class defining several overloaded accessors so we don't have to cast vehicle types that often.
Definition at line 644 of file vehicle_base.h.
FORCEINLINE T* SpecializedVehicle< T, Type >::First | ( | ) | const [inline] |
Get the first vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 656 of file vehicle_base.h.
Referenced by BuildDepotVehicleList(), GroundVehicle< T, Type >::CargoChanged(), CheckTrainsLengths(), CmdAutoreplaceVehicle(), CmdBuildRailWagon(), CmdMoveRailVehicle(), CmdReverseTrainDirection(), CmdSellRailWagon(), DeleteLastWagon(), FindTrainOnTrackEnum(), SpecializedVehicle< RoadVehicle, Type >::First(), FollowTrainReservation(), GroundVehicle< T, Type >::PowerChanged(), RemoveRoadStop(), RoadVehAccelerate(), and VehicleEnter_Track().
static FORCEINLINE const T* SpecializedVehicle< T, Type >::From | ( | const Vehicle * | v | ) | [inline, static] |
Converts a const Vehicle to const SpecializedVehicle with type checking.
v | Vehicle pointer |
Definition at line 727 of file vehicle_base.h.
static FORCEINLINE T* SpecializedVehicle< T, Type >::From | ( | Vehicle * | v | ) | [inline, static] |
Converts a Vehicle to SpecializedVehicle with type checking.
v | Vehicle pointer |
Definition at line 716 of file vehicle_base.h.
Referenced by GroundVehicle< T, Type >::GetAcceleration(), and GroundVehicle< T, Type >::PowerChanged().
static FORCEINLINE T* SpecializedVehicle< T, Type >::Get | ( | size_t | index | ) | [inline, static] |
Gets vehicle with given index.
Reimplemented from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >.
Definition at line 697 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::Get(), SpecializedVehicle< RoadVehicle, Type >::GetIfValid(), and SpecializedVehicle< RoadVehicle, Type >::IsValidID().
static FORCEINLINE T* SpecializedVehicle< T, Type >::GetIfValid | ( | size_t | index | ) | [inline, static] |
Returns vehicle if the index is a valid index for this vehicle type.
Reimplemented from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >.
Definition at line 706 of file vehicle_base.h.
static FORCEINLINE bool SpecializedVehicle< T, Type >::IsValidID | ( | size_t | index | ) | [inline, static] |
Tests whether given index is a valid index for vehicle of this type.
index | tested index |
Reimplemented from Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool >.
Definition at line 688 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::GetIfValid(), and SpecializedVehicle< RoadVehicle, Type >::IsValidID().
FORCEINLINE const T* SpecializedVehicle< T, Type >::Last | ( | ) | const [inline] |
Get the last vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 668 of file vehicle_base.h.
FORCEINLINE T* SpecializedVehicle< T, Type >::Last | ( | ) | [inline] |
Get the last vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 662 of file vehicle_base.h.
Referenced by AdvanceWagonsAfterSwap(), AdvanceWagonsBeforeSwap(), CmdBuildRailWagon(), InsertInConsist(), SpecializedVehicle< RoadVehicle, Type >::Last(), NPFTrainCheckReverse(), NPFTrainFindNearestDepot(), RemoveFromConsist(), YapfTrainCheckReverse(), and YapfTrainFindNearestDepot().
FORCEINLINE T* SpecializedVehicle< T, Type >::Next | ( | ) | const [inline] |
Get next vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 674 of file vehicle_base.h.
Referenced by AdvanceWagonsAfterSwap(), AdvanceWagonsBeforeSwap(), AircraftController(), CheckTrainAttachment(), CheckTrainsLengths(), CmdBuildRailStation(), CmdBuildRoadVehicle(), ConvertOldMultiheadToNew(), Train::Crash(), CrashAirplane(), DeleteLastWagon(), DrawAircraftDetails(), DrawRoadVehImage(), DrawTrainDetails(), DrawTrainImage(), RefitWindow::DrawWidget(), GetCargoSummaryOfArticulatedVehicle(), GetLengthOfArticulatedVehicle(), Train::GetNextVehicle(), VehicleDetailsWindow::GetRoadVehDetailsHeight(), GetVehicleSet(), GetVehicleWidth(), HandleAircraftEnterHangar(), GroundVehicle< RoadVehicle, VEH_ROAD >::HasArticulatedPart(), InsertInConsist(), Train::IsInDepot(), RoadVehicle::IsStoppedInDepot(), MakeTrainBackup(), Train::MarkDirty(), RoadVehicle::MarkDirty(), Aircraft::MarkDirty(), SpecializedVehicle< RoadVehicle, Type >::Next(), NormaliseDualHeads(), NormaliseSubtypes(), DepotWindow::OnPaint(), RemoveFromConsist(), RemoveFromRailBaseStation(), Train::ReserveTrackUnderConsist(), SetAircraftPosition(), SetTrainGroupID(), UpdateOldAircraft(), UpdateTrainGroupID(), and VehicleEnter_Track().
FORCEINLINE T* SpecializedVehicle< T, Type >::Previous | ( | ) | const [inline] |
Get previous vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 680 of file vehicle_base.h.
Referenced by AdvanceWagonsAfterSwap(), AdvanceWagonsBeforeSwap(), Train::GetFirstEnginePart(), Train::GetPrevVehicle(), NormaliseSubtypes(), SpecializedVehicle< RoadVehicle, Type >::Previous(), RemoveFromConsist(), and RestoreTrainBackup().
FORCEINLINE void SpecializedVehicle< T, Type >::UpdateViewport | ( | bool | moved, | |
bool | turned | |||
) | [inline] |
Update vehicle sprite- and position caches.
moved | Was the vehicle moved? | |
turned | Did the vehicle direction change? |
Definition at line 738 of file vehicle_base.h.
Referenced by Train::MarkDirty(), RoadVehicle::MarkDirty(), SetAircraftPosition(), GroundVehicle< RoadVehicle, VEH_ROAD >::UpdateInclination(), and UpdateStatusAfterSwap().