70 static const uint RVC_DEFAULT_START_FRAME = 0;
71 static const uint RVC_TURN_AROUND_START_FRAME = 1;
72 static const uint RVC_DEPOT_START_FRAME = 6;
73 static const uint RVC_START_FRAME_AFTER_LONG_TRAM = 21;
74 static const uint RVC_TURN_AROUND_START_FRAME_SHORT_TRAM = 16;
76 static const uint RVC_DRIVE_THROUGH_STOP_FRAME = 11;
77 static const uint RVC_DEPOT_STOP_FRAME = 11;
119 uint
Crash(
bool flooded =
false);
279 const RoadVehicle *rv = this->
First();
293 if (this->direction != rv->
direction)
return true;
301 #define FOR_ALL_ROADVEHICLES(var) FOR_ALL_VEHICLES_OF_TYPE(RoadVehicle, var) VehicleSettings vehicle
options for vehicles
Vehicle is stopped by the player.
VehicleCargoList cargo
The cargo this vehicle is carrying.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Enums and other types related to roads.
Functions for NewGRF engines.
bool Tick()
Calls the tick handler of the vehicle.
uint8 weight
Weight of a single unit of this cargo type in 1/16 ton (62.5 kg).
AccelStatus
What is the status of our acceleration?
static const uint RDE_TURNED
We just finished turning.
DirectionByte direction
facing
static bool IsReversingRoadTrackdir(Trackdir dir)
Checks whether the trackdir means that we are reversing.
uint16 GetPower() const
Allows to know the power value that this vehicle will use.
The vehicle is at the opposite side of the road.
int GetCurrentMaxSpeed() const
Calculates the maximum speed of the vehicle under its current conditions.
The vehicle is in a drive-through road stop.
AccelStatus GetAccelerationStatus() const
Checks the current acceleration status of this vehicle.
uint16 cur_speed
current speed
int GetDisplayMaxSpeed() const
Gets the maximum speed in km-ish/h that can be sent into SetDParam for string processing.
bool TileMayHaveSlopedTrack() const
Checks if the vehicle is at a tile that can be sloped.
RoadVehicle()
We don't want GCC to zero our struct! It already is zeroed and has an index!
static const uint RDE_NEXT_TILE
State information about the Road Vehicle controller.
Only used when retrieving move data.
ExpensesType GetExpenseType(bool income) const
Sets the expense type associated to this vehicle type.
void PreDestructor()
Destroy all stuff that (still) needs the virtual functions to work properly.
uint32 GetSlopeSteepness() const
Returns the slope steepness used by this vehicle.
RoadVehicle * First() const
Get the first vehicle in the chain.
RoadType
The different roadtypes we support.
uint16 GetMaxTrackSpeed() const
Gets the maximum speed allowed by the track for this vehicle.
EngineImageType
Visualisation contexts of vehicles and engines.
uint StoredCount() const
Returns sum of cargo on board the vehicle (ie not only reserved).
byte overtaking
Set to RVSB_DRIVE_SIDE when overtaking, otherwise 0.
uint16 cached_max_speed
Maximum speed of the consist (minimum of the max speed of all vehicles in the consist).
Direction
Defines the 8 directions on the map.
RoadVehicleStates
Road vehicle states.
TrackBits
Bitfield corresponding to Track.
Buses, trucks and trams belong to this class.
The vehicle is in a road stop.
int UpdateSpeed()
This function looks at the vehicle and updates its speed (cur_speed and subspeed) variables...
Income from road vehicles.
void OnNewDay()
Calls the new day handler of the vehicle.
The vehicle is in a tunnel and/or bridge.
T * Next() const
Get next vehicle in the chain.
byte GetAirDragArea() const
Gets the area used for calculating air drag.
Trackdir GetVehicleTrackdir() const
Returns the Trackdir on which the vehicle is currently located.
bool IsArticulatedPart() const
Check if the vehicle is an articulated part of an engine.
Trackdir
Enumeration for tracks and directions.
Only used while in a road stop.
The vehicle is in a depot.
CargoID cargo_type
type of cargo this vehicle is carrying
bool IsFrontEngine() const
Check if the vehicle is a front engine.
TileIndex tile
Current tile index.
ExpensesType
Types of expenses.
bool HasToUseGetSlopePixelZ()
Road vehicles have to use GetSlopePixelZ() to compute their height if they are reversing because in t...
uint16 GetPoweredPartPower(const RoadVehicle *head) const
Returns a value if this articulated part is powered.
virtual ~RoadVehicle()
We want to 'destruct' the right class.
Sprite sequence for a vehicle part.
uint Crash(bool flooded=false)
Crash the (whole) vehicle chain.
byte GetTractiveEffort() const
Allows to know the tractive effort value that this vehicle will use.
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse)
Find the closest depot for this vehicle and tell us the location, DestinationID and whether we should...
We want to go faster, if possible of course.
int GetDisplayImageWidth(Point *offset=NULL) const
Get the width of a road vehicle image in the GUI.
uint16 crashed_ctr
Animation counter when the vehicle has crashed.
RoadTypes
The different roadtypes we support, but then a bitmask of them.
byte GetAirDrag() const
Gets the air drag coefficient of this vehicle.
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
bool IsInDepot() const
Check whether the vehicle is in the depot.
void MarkDirty()
Marks the vehicles to be redrawn and updates cached variables.
uint16 last_speed
The last speed we did display, so we only have to redraw when this changes.
static const byte RV_OVERTAKE_TIMEOUT
The number of ticks a vehicle has for overtaking.
The vehicle is in a drive-through road stop.
bool IsBus() const
Check whether a roadvehicle is a bus.
Running costs road vehicles.
int GetAccelerationType() const
Allows to know the acceleration type of a vehicle.
Only bits 0 and 3 are used to encode the trackdir for road stops.
void RoadVehUpdateCache(RoadVehicle *v, bool same_length=false)
Update the cache of a road vehicle.
uint32 GetRollingFriction() const
Returns the rolling friction coefficient of this vehicle.
uint16 EngineID
Unique identification number of an engine.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
uint32 TileIndex
The index/ID of a Tile.
Only set when a vehicle has entered the stop.
Money GetRunningCost() const
Gets the running cost of a vehicle.
static TrackBits TrackStatusToTrackBits(TrackStatus ts)
Returns the present-track-information of a TrackStatus.
void GetRoadVehSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
Get the size of the sprite of a road vehicle sprite heading west (used for lists).
TileIndex GetOrderStationLocation(StationID station)
Determine the location for the station where the vehicle goes to next.
Transport by road vehicle.
The vehicle is in a road stop.
Types/functions related to cargoes.
Coordinates of a point in 2D.
The mask used to extract track dirs.
Tractive effort coefficient in 1/256.
EngineID engine_type
The type of engine used for this vehicle.
void UpdateDeltaXY(Direction direction)
Updates the x and y offsets and the size of the sprite used for this vehicle.
uint8 roadveh_slope_steepness
Steepness of hills for road vehicles when using realistic acceleration.
bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
Different conversion functions from one kind of track to another.
int GetDisplaySpeed() const
Gets the speed in km-ish/h that can be sent into SetDParam for string processing. ...
Base class for all vehicles that move through ground.
VehicleCache vcache
Cache of often used vehicle values.
Base class and functions for all vehicles that move through ground.
void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const
Gets the sprite to show for the given direction.
GroundVehicleCache gcache
Cache of often calculated values.
byte overtaking_ctr
The length of the current overtake attempt.
uint16 GetCurrentSpeed() const
Calculates the current speed of this vehicle.
uint16 GetWeight() const
Allows to know the weight value that this vehicle will use.