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 885 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 899 of file vehicle_base.h.
Referenced by AfterLoadGame(), BuildDepotVehicleList(), GroundVehicle< T, Type >::CargoChanged(), CheckTrainsLengths(), CmdAutoreplaceVehicle(), CmdBuildRailWagon(), CmdMoveRailVehicle(), CmdReverseTrainDirection(), CmdSellRailWagon(), DeleteLastWagon(), FindTrainCollideEnum(), FindTrainOnTrackEnum(), SpecializedVehicle< RoadVehicle, Type >::First(), FollowTrainReservation(), GroundVehicle< T, Type >::IsChainInDepot(), GroundVehicle< T, Type >::PowerChanged(), RemoveRoadStop(), TrainController(), and VehicleEnter_Track().
static T* SpecializedVehicle< T, Type >::From | ( | Vehicle * | v | ) | [inline, static] |
Converts a Vehicle to SpecializedVehicle with type checking.
v | Vehicle pointer |
Definition at line 1002 of file vehicle_base.h.
Referenced by GroundVehicle< T, Type >::GetAcceleration(), and GroundVehicle< T, Type >::PowerChanged().
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 1013 of file vehicle_base.h.
static T* SpecializedVehicle< T, Type >::Get | ( | size_t | index | ) | [inline, static] |
Gets vehicle with given index.
Definition at line 983 of file vehicle_base.h.
Referenced by SpecializedVehicle< RoadVehicle, Type >::Get(), SpecializedVehicle< RoadVehicle, Type >::GetIfValid(), 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 943 of file vehicle_base.h.
Referenced by CmdMoveRailVehicle(), CmdSellRailWagon(), SpecializedVehicle< RoadVehicle, Type >::GetFirstEnginePart(), and GetVehicleSet().
const T* SpecializedVehicle< T, Type >::GetFirstEnginePart | ( | ) | const [inline] |
Get the first part of an articulated engine.
Reimplemented from Vehicle.
Definition at line 949 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 992 of file vehicle_base.h.
T* SpecializedVehicle< T, Type >::GetLastEnginePart | ( | ) | [inline] |
Get the last part of an articulated engine.
Reimplemented from Vehicle.
Definition at line 955 of file vehicle_base.h.
Referenced by CmdMoveRailVehicle(), SpecializedVehicle< RoadVehicle, Type >::GetLastEnginePart(), and RemoveFromConsist().
T* SpecializedVehicle< T, Type >::GetNextArticulatedPart | ( | ) | [inline] |
Get the next part of an articulated engine.
Definition at line 930 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 937 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 961 of file vehicle_base.h.
Referenced by ArrangeTrains(), ConnectMultiheadedTrains(), DrawTrainDetails(), Train::GetNextUnit(), SpecializedVehicle< RoadVehicle, Type >::GetNextVehicle(), Train::GetRunningCost(), GetTrainDetailsWndVScroll(), and NormaliseDualHeads().
T* SpecializedVehicle< T, Type >::GetPrevVehicle | ( | ) | const [inline] |
Get the previous real (non-articulated part) vehicle in the consist.
Reimplemented from Vehicle.
Definition at line 967 of file vehicle_base.h.
Referenced by Train::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 974 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 905 of file vehicle_base.h.
Referenced by AdvanceWagonsAfterSwap(), AdvanceWagonsBeforeSwap(), CmdBuildRailWagon(), InsertInConsist(), SpecializedVehicle< RoadVehicle, Type >::Last(), NPFTrainCheckReverse(), NPFTrainFindNearestDepot(), RemoveFromConsist(), YapfTrainCheckReverse(), and YapfTrainFindNearestDepot().
const T* SpecializedVehicle< T, Type >::Last | ( | ) | const [inline] |
Get the last vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 911 of file vehicle_base.h.
T* SpecializedVehicle< T, Type >::Next | ( | ) | const [inline] |
Get next vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 917 of file vehicle_base.h.
Referenced by AdvanceWagonsAfterSwap(), AdvanceWagonsBeforeSwap(), AircraftController(), AircraftLeaveHangar(), ChangeTrainDirRandomly(), CheckTrainAttachment(), CheckTrainsLengths(), CheckTrainStayInDepot(), CmdBuildRailStation(), CmdBuildRoadVehicle(), ConvertOldMultiheadToNew(), Train::Crash(), CrashAirplane(), DeleteLastRoadVeh(), DeleteLastWagon(), DrawAircraftDetails(), DrawRoadVehImage(), DrawTrainDetails(), DrawTrainImage(), RefitWindow::DrawWidget(), FixupTrainLengths(), FreeTrainTrackReservation(), GetCargoSummaryOfArticulatedVehicle(), GetLengthOfArticulatedVehicle(), VehicleDetailsWindow::GetRoadVehDetailsHeight(), GetVehicleSet(), GetVehicleWidth(), HandleAircraftEnterHangar(), HandleCrashedTrain(), RoadVehicle::HasToUseGetSlopePixelZ(), InsertInConsist(), MakeTrainBackup(), Train::MarkDirty(), RoadVehicle::MarkDirty(), Aircraft::MarkDirty(), SpecializedVehicle< RoadVehicle, Type >::Next(), NormaliseDualHeads(), NormaliseSubtypes(), DepotWindow::OnPaint(), RemoveFromConsist(), RemoveFromRailBaseStation(), Train::ReserveTrackUnderConsist(), ReverseTrainDirection(), ReverseTrainSwapVeh(), RoadVehIsCrashed(), RoadVehUpdateCache(), SetAircraftPosition(), SetTrainGroupID(), TrainController(), UpdateAircraftCache(), UpdateOldAircraft(), UpdateTrainGroupID(), and VehicleEnter_Track().
T* SpecializedVehicle< T, Type >::Previous | ( | ) | const [inline] |
Get previous vehicle in the chain.
Reimplemented from Vehicle.
Definition at line 923 of file vehicle_base.h.
Referenced by AdvanceWagonsAfterSwap(), AdvanceWagonsBeforeSwap(), NormaliseSubtypes(), SpecializedVehicle< RoadVehicle, Type >::Previous(), RemoveFromConsist(), RestoreTrainBackup(), and TrainController().
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 1024 of file vehicle_base.h.
Referenced by CheckTrainStayInDepot(), Train::MarkDirty(), RoadVehicle::MarkDirty(), ReverseTrainDirection(), SetAircraftPosition(), GroundVehicle< RoadVehicle, VEH_ROAD >::UpdateInclination(), UpdateStatusAfterSwap(), and VehicleEnterDepot().