Class defining several overloaded accessors so we don't have to cast vehicle types that often. More...
#include <vehicle_base.h>
Public Types | |
typedef SpecializedVehicle< T, Type > | SpecializedVehicleBase |
Our type. | |
Public Member Functions | |
SpecializedVehicle () | |
Set vehicle type correctly. | |
T * | First () const |
Get the first vehicle in the chain. | |
T * | Last () |
Get the last vehicle in the chain. | |
const T * | Last () const |
Get the last vehicle in the chain. | |
T * | Next () const |
Get next vehicle in the chain. | |
T * | Previous () const |
Get previous vehicle in the chain. | |
T * | GetNextArticulatedPart () |
Get the next part of an articulated engine. | |
T * | GetNextArticulatedPart () const |
Get the next part of an articulated engine. | |
T * | GetFirstEnginePart () |
Get the first part of an articulated engine. | |
const T * | GetFirstEnginePart () const |
Get the first part of an articulated engine. | |
T * | GetLastEnginePart () |
Get the last part of an articulated engine. | |
T * | GetNextVehicle () const |
Get the next real (non-articulated part) vehicle in the consist. | |
T * | GetPrevVehicle () const |
Get the previous real (non-articulated part) vehicle in the consist. | |
void | UpdateViewport (bool force_update, bool update_delta) |
Update vehicle sprite- and position caches. | |
Static Public Member Functions | |
static bool | IsValidID (size_t index) |
Tests whether given index is a valid index for vehicle of this type. | |
static T * | Get (size_t index) |
Gets vehicle with given index. | |
static T * | GetIfValid (size_t index) |
Returns vehicle if the index is a valid index for this vehicle type. | |
static T * | From (Vehicle *v) |
Converts a Vehicle to SpecializedVehicle with type checking. | |
static 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 853 of file vehicle_base.h.
T* SpecializedVehicle< T, Type >::First | ( | ) | const [inline] |
Get the first vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 867 of file vehicle_base.h.
Referenced by GroundVehicle< T, Type >::CargoChanged(), SpecializedVehicle< RoadVehicle, Type >::First(), FINAL::HasToUseGetSlopePixelZ(), and GroundVehicle< T, Type >::PowerChanged().
static T* SpecializedVehicle< T, Type >::From | ( | Vehicle * | v | ) | [inline, static] |
Converts a Vehicle to SpecializedVehicle with type checking.
v | Vehicle pointer |
Definition at line 970 of file vehicle_base.h.
Referenced by CmdSellRailWagon(), GroundVehicle< T, Type >::GetAcceleration(), GroundVehicle< T, Type >::PowerChanged(), and TrainApproachingCrossingEnum().
static 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 981 of file vehicle_base.h.
static T* SpecializedVehicle< T, Type >::Get | ( | size_t | index | ) | [inline, static] |
Gets vehicle with given index.
Definition at line 951 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::Get(), SpecializedVehicle< RoadVehicle, Type >::GetIfValid(), GetTrainStopLocation(), FINAL::GetWeight(), and SpecializedVehicle< RoadVehicle, Type >::IsValidID().
T* SpecializedVehicle< T, Type >::GetFirstEnginePart | ( | ) | [inline] |
Get the first part of an articulated engine.
Reimplemented from Vehicle.
Definition at line 911 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::GetFirstEnginePart().
const T* SpecializedVehicle< T, Type >::GetFirstEnginePart | ( | ) | const [inline] |
Get the first part of an articulated engine.
Reimplemented from Vehicle.
Definition at line 917 of file vehicle_base.h.
static T* SpecializedVehicle< T, Type >::GetIfValid | ( | size_t | index | ) | [inline, static] |
Returns vehicle if the index is a valid index for this vehicle type.
Definition at line 960 of file vehicle_base.h.
Referenced by CmdForceTrainProceed(), CmdMoveRailVehicle(), CmdReverseTrainDirection(), and CmdTurnRoadVeh().
T* SpecializedVehicle< T, Type >::GetLastEnginePart | ( | ) | [inline] |
Get the last part of an articulated engine.
Reimplemented from Vehicle.
Definition at line 923 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::GetLastEnginePart().
T* SpecializedVehicle< T, Type >::GetNextArticulatedPart | ( | ) | [inline] |
Get the next part of an articulated engine.
Definition at line 898 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::GetNextArticulatedPart().
T* SpecializedVehicle< T, Type >::GetNextArticulatedPart | ( | ) | const [inline] |
Get the next part of an articulated engine.
Reimplemented from Vehicle.
Definition at line 905 of file vehicle_base.h.
T* SpecializedVehicle< T, Type >::GetNextVehicle | ( | ) | const [inline] |
Get the next real (non-articulated part) vehicle in the consist.
Reimplemented from Vehicle.
Definition at line 929 of file vehicle_base.h.
Referenced by FINAL::GetNextUnit(), and SpecializedVehicle< RoadVehicle, Type >::GetNextVehicle().
T* SpecializedVehicle< T, Type >::GetPrevVehicle | ( | ) | const [inline] |
Get the previous real (non-articulated part) vehicle in the consist.
Reimplemented from Vehicle.
Definition at line 935 of file vehicle_base.h.
Referenced by FINAL::GetPrevUnit(), and SpecializedVehicle< RoadVehicle, Type >::GetPrevVehicle().
static 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 |
Definition at line 942 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::GetIfValid(), and SpecializedVehicle< RoadVehicle, Type >::IsValidID().
T* SpecializedVehicle< T, Type >::Last | ( | ) | [inline] |
Get the last vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 873 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::Last().
const T* SpecializedVehicle< T, Type >::Last | ( | ) | const [inline] |
Get the last vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 879 of file vehicle_base.h.
T* SpecializedVehicle< T, Type >::Next | ( | ) | const [inline] |
Get next vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 885 of file vehicle_base.h.
Referenced by FINAL::CalcNextVehicleOffset(), and SpecializedVehicle< RoadVehicle, Type >::Next().
T* SpecializedVehicle< T, Type >::Previous | ( | ) | const [inline] |
Get previous vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 891 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::Previous().
void SpecializedVehicle< T, Type >::UpdateViewport | ( | bool | force_update, | |
bool | update_delta | |||
) | [inline] |
Update vehicle sprite- and position caches.
force_update | Force updating the vehicle on the viewport. | |
update_delta | Also update the delta? |
Definition at line 992 of file vehicle_base.h.
Referenced by GroundVehicle< RoadVehicle, VEH_ROAD >::UpdateInclination().