GroundVehicle< T, Type > Struct Template Reference

Base class for all vehicles that move through ground. More...

#include <ground_vehicle.hpp>

Inheritance diagram for GroundVehicle< T, Type >:
SpecializedVehicle< T, Type > Vehicle Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_vehicle_pool > BaseVehicle

Public Member Functions

 GroundVehicle ()
 The constructor at SpecializedVehicle must be called.
void PowerChanged ()
 Recalculates the cached total power of a vehicle.
void CargoChanged ()
 Recalculates the cached weight of a vehicle and its parts.
int GetAcceleration () const
 Calculates the acceleration of the vehicle under its current conditions.
FORCEINLINE int32 GetSlopeResistance () const
 Calculates the total slope resistance for this vehicle.
FORCEINLINE byte UpdateInclination (bool new_tile, bool turned)
 Checks if the vehicle is in a slope and sets the required flags in that case.

Data Fields

GroundVehicleCache gcache
 Cache of often calculated values.
uint16 gv_flags

Detailed Description

template<class T, VehicleType Type>
struct GroundVehicle< T, Type >

Base class for all vehicles that move through ground.

Child classes must define all of the following functions. These functions are not defined as pure virtual functions at this class to improve performance.

virtual uint16 GetPower() const = 0; virtual uint16 GetPoweredPartPower(const T *head) const = 0; virtual uint16 GetWeight() const = 0; virtual byte GetTractiveEffort() const = 0; virtual byte GetAirDrag() const = 0; virtual byte GetAirDragArea() const = 0; virtual AccelStatus GetAccelerationStatus() const = 0; virtual uint16 GetCurrentSpeed() const = 0; virtual uint32 GetRollingFriction() const = 0; virtual int GetAccelerationType() const = 0; virtual int32 GetSlopeSteepness() const = 0; virtual int GetDisplayMaxSpeed() const = 0; virtual uint16 GetMaxTrackSpeed() const = 0; virtual bool TileMayHaveSlopedTrack() const = 0;

Definition at line 74 of file ground_vehicle.hpp.


Member Function Documentation

template<class T , VehicleType Type>
void GroundVehicle< T, Type >::CargoChanged (  )  [inline]
template<class T , VehicleType Type>
int GroundVehicle< T, Type >::GetAcceleration (  )  const [inline]
template<class T, VehicleType Type>
FORCEINLINE int32 GroundVehicle< T, Type >::GetSlopeResistance (  )  const [inline]

Calculates the total slope resistance for this vehicle.

Returns:
Slope resistance.

Definition at line 91 of file ground_vehicle.hpp.

Referenced by GroundVehicle< T, Type >::GetAcceleration().

template<class T , VehicleType Type>
void GroundVehicle< T, Type >::PowerChanged (  )  [inline]
template<class T, VehicleType Type>
FORCEINLINE byte GroundVehicle< T, Type >::UpdateInclination ( bool  new_tile,
bool  turned 
) [inline]

Checks if the vehicle is in a slope and sets the required flags in that case.

Parameters:
new_tile True if the vehicle reached a new tile.
turned Indicates if the vehicle has turned.
Returns:
Old height of the vehicle.

Definition at line 112 of file ground_vehicle.hpp.


Field Documentation

template<class T, VehicleType Type>
uint16 GroundVehicle< T, Type >::gv_flags

The documentation for this struct was generated from the following files:

Generated on Fri Dec 31 17:16:31 2010 for OpenTTD by  doxygen 1.6.1