OpenTTD Source  14.0-RC3
roadveh.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef ROADVEH_H
11 #define ROADVEH_H
12 
13 #include "ground_vehicle.hpp"
14 #include "engine_base.h"
15 #include "cargotype.h"
16 #include "track_func.h"
17 #include "road.h"
18 #include "road_map.h"
19 #include "newgrf_engine.h"
20 
21 struct RoadVehicle;
22 
25  /*
26  * Lower 4 bits are used for vehicle track direction. (Trackdirs)
27  * When in a road stop (bit 5 or bit 6 set) these bits give the
28  * track direction of the entry to the road stop.
29  * As the entry direction will always be a diagonal
30  * direction (X_NE, Y_SE, X_SW or Y_NW) only bits 0 and 3
31  * are needed to hold this direction. Bit 1 is then used to show
32  * that the vehicle is using the second road stop bay.
33  * Bit 2 is then used for drive-through stops to show the vehicle
34  * is stopping at this road stop.
35  */
36 
37  /* Numeric values */
38  RVSB_IN_DEPOT = 0xFE,
39  RVSB_WORMHOLE = 0xFF,
40 
41  /* Bit numbers */
47 
48  /* Bit sets of the above specified bits */
50  RVSB_IN_ROAD_STOP_END = RVSB_IN_ROAD_STOP + TRACKDIR_END,
52  RVSB_IN_DT_ROAD_STOP_END = RVSB_IN_DT_ROAD_STOP + TRACKDIR_END,
53 
55 
58 };
59 
61 static const uint RDE_NEXT_TILE = 0x80;
62 static const uint RDE_TURNED = 0x40;
63 
64 /* Start frames for when a vehicle enters a tile/changes its state.
65  * The start frame is different for vehicles that turned around or
66  * are leaving the depot as the do not start at the edge of the tile.
67  * For trams there are a few different start frames as there are two
68  * places where trams can turn. */
69 static const uint RVC_DEFAULT_START_FRAME = 0;
70 static const uint RVC_TURN_AROUND_START_FRAME = 1;
71 static const uint RVC_DEPOT_START_FRAME = 6;
72 static const uint RVC_START_FRAME_AFTER_LONG_TRAM = 21;
73 static const uint RVC_TURN_AROUND_START_FRAME_SHORT_TRAM = 16;
74 /* Stop frame for a vehicle in a drive-through stop */
75 static const uint RVC_DRIVE_THROUGH_STOP_FRAME = 11;
76 static const uint RVC_DEPOT_STOP_FRAME = 11;
77 
79 static const byte RV_OVERTAKE_TIMEOUT = 35;
80 
81 void RoadVehUpdateCache(RoadVehicle *v, bool same_length = false);
82 void GetRoadVehSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type);
83 
85  std::deque<Trackdir> td;
86  std::deque<TileIndex> tile;
87 
88  inline bool empty() const { return this->td.empty(); }
89 
90  inline size_t size() const
91  {
92  assert(this->td.size() == this->tile.size());
93  return this->td.size();
94  }
95 
96  inline void clear()
97  {
98  this->td.clear();
99  this->tile.clear();
100  }
101 };
102 
106 struct RoadVehicle final : public GroundVehicle<RoadVehicle, VEH_ROAD> {
108  byte state;
109  byte frame;
110  uint16_t blocked_ctr;
111  byte overtaking;
113  uint16_t crashed_ctr;
114  byte reverse_ctr;
115 
118 
120 
124  virtual ~RoadVehicle() { this->PreDestructor(); }
125 
126  friend struct GroundVehicle<RoadVehicle, VEH_ROAD>; // GroundVehicle needs to use the acceleration functions defined at RoadVehicle.
127 
128  void MarkDirty() override;
129  void UpdateDeltaXY() override;
130  ExpensesType GetExpenseType(bool income) const override { return income ? EXPENSES_ROADVEH_REVENUE : EXPENSES_ROADVEH_RUN; }
131  bool IsPrimaryVehicle() const override { return this->IsFrontEngine(); }
132  void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const override;
133  int GetDisplaySpeed() const override { return this->gcache.last_speed / 2; }
134  int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed / 2; }
135  Money GetRunningCost() const override;
136  int GetDisplayImageWidth(Point *offset = nullptr) const;
137  bool IsInDepot() const override { return this->state == RVSB_IN_DEPOT; }
138  bool Tick() override;
139  void OnNewCalendarDay() override;
140  void OnNewEconomyDay() override;
141  uint Crash(bool flooded = false) override;
142  Trackdir GetVehicleTrackdir() const override;
143  TileIndex GetOrderStationLocation(StationID station) override;
144  ClosestDepot FindClosestDepot() override;
145 
146  bool IsBus() const;
147 
148  int GetCurrentMaxSpeed() const override;
149  int UpdateSpeed();
150  void SetDestTile(TileIndex tile) override;
151 
152 protected: // These functions should not be called outside acceleration code.
153 
158  inline uint16_t GetPower() const
159  {
160  /* Power is not added for articulated parts */
161  if (!this->IsArticulatedPart()) {
162  /* Road vehicle power is in units of 10 HP. */
163  return 10 * GetVehicleProperty(this, PROP_ROADVEH_POWER, RoadVehInfo(this->engine_type)->power);
164  }
165  return 0;
166  }
167 
172  inline uint16_t GetPoweredPartPower(const RoadVehicle *) const
173  {
174  return 0;
175  }
176 
181  inline uint16_t GetWeight() const
182  {
183  uint16_t weight = CargoSpec::Get(this->cargo_type)->WeightOfNUnits(this->cargo.StoredCount());
184 
185  /* Vehicle weight is not added for articulated parts. */
186  if (!this->IsArticulatedPart()) {
187  /* Road vehicle weight is in units of 1/4 t. */
188  weight += GetVehicleProperty(this, PROP_ROADVEH_WEIGHT, RoadVehInfo(this->engine_type)->weight) / 4;
189  }
190 
191  return weight;
192  }
193 
198  uint16_t GetMaxWeight() const override;
199 
204  inline byte GetTractiveEffort() const
205  {
206  /* The tractive effort coefficient is in units of 1/256. */
207  return GetVehicleProperty(this, PROP_ROADVEH_TRACTIVE_EFFORT, RoadVehInfo(this->engine_type)->tractive_effort);
208  }
209 
214  inline byte GetAirDragArea() const
215  {
216  return 6;
217  }
218 
223  inline byte GetAirDrag() const
224  {
225  return RoadVehInfo(this->engine_type)->air_drag;
226  }
227 
233  {
234  return (this->vehstatus & VS_STOPPED) ? AS_BRAKE : AS_ACCEL;
235  }
236 
241  inline uint16_t GetCurrentSpeed() const
242  {
243  return this->cur_speed / 2;
244  }
245 
250  inline uint32_t GetRollingFriction() const
251  {
252  /* Trams have a slightly greater friction coefficient than trains.
253  * The rest of road vehicles have bigger values. */
254  uint32_t coeff = RoadTypeIsTram(this->roadtype) ? 40 : 75;
255  /* The friction coefficient increases with speed in a way that
256  * it doubles at 128 km/h, triples at 256 km/h and so on. */
257  return coeff * (128 + this->GetCurrentSpeed()) / 128;
258  }
259 
264  inline int GetAccelerationType() const
265  {
266  return 0;
267  }
268 
273  inline uint32_t GetSlopeSteepness() const
274  {
276  }
277 
282  inline uint16_t GetMaxTrackSpeed() const
283  {
284  return GetRoadTypeInfo(GetRoadType(this->tile, GetRoadTramType(this->roadtype)))->max_speed;
285  }
286 
291  inline bool TileMayHaveSlopedTrack() const
292  {
293  TrackStatus ts = GetTileTrackStatus(this->tile, TRANSPORT_ROAD, GetRoadTramType(this->roadtype));
294  TrackBits trackbits = TrackStatusToTrackBits(ts);
295 
296  return trackbits == TRACK_BIT_X || trackbits == TRACK_BIT_Y;
297  }
298 
307  {
308  const RoadVehicle *rv = this->First();
309 
310  /* Check if this vehicle is in the same direction as the road under.
311  * We already know it has either GVF_GOINGUP_BIT or GVF_GOINGDOWN_BIT set. */
312 
314  /* If the first vehicle is reversing, this vehicle may be reversing too
315  * (especially if this is the first, and maybe the only, vehicle).*/
316  return true;
317  }
318 
319  while (rv != this) {
320  /* If any previous vehicle has different direction,
321  * we may be in the middle of reversing. */
322  if (this->direction != rv->direction) return true;
323  rv = rv->Next();
324  }
325 
326  return false;
327  }
328 };
329 
330 #endif /* ROADVEH_H */
RoadVehicle::overtaking
byte overtaking
Set to RVSB_DRIVE_SIDE when overtaking, otherwise 0.
Definition: roadveh.h:111
RoadVehicle
Buses, trucks and trams belong to this class.
Definition: roadveh.h:106
RoadVehicle::~RoadVehicle
virtual ~RoadVehicle()
We want to 'destruct' the right class.
Definition: roadveh.h:124
Vehicle::IsFrontEngine
debug_inline bool IsFrontEngine() const
Check if the vehicle is a front engine.
Definition: vehicle_base.h:936
VehicleCargoList::StoredCount
uint StoredCount() const
Returns sum of cargo on board the vehicle (ie not only reserved).
Definition: cargopacket.h:434
RoadVehicle::state
byte state
Definition: roadveh.h:108
EXPENSES_ROADVEH_RUN
@ EXPENSES_ROADVEH_RUN
Running costs road vehicles.
Definition: economy_type.h:176
Vehicle::PreDestructor
void PreDestructor()
Destroy all stuff that (still) needs the virtual functions to work properly.
Definition: vehicle.cpp:826
Direction
Direction
Defines the 8 directions on the map.
Definition: direction_type.h:24
RoadVehicle::HasToUseGetSlopePixelZ
bool HasToUseGetSlopePixelZ()
Road vehicles have to use GetSlopePixelZ() to compute their height if they are reversing because in t...
Definition: roadveh.h:306
PROP_ROADVEH_TRACTIVE_EFFORT
@ PROP_ROADVEH_TRACTIVE_EFFORT
Tractive effort coefficient in 1/256.
Definition: newgrf_properties.h:39
RoadVehicle::GetPoweredPartPower
uint16_t GetPoweredPartPower(const RoadVehicle *) const
Returns a value if this articulated part is powered.
Definition: roadveh.h:172
RoadVehicle::GetAccelerationStatus
AccelStatus GetAccelerationStatus() const
Checks the current acceleration status of this vehicle.
Definition: roadveh.h:232
SpecializedVehicle::Next
T * Next() const
Get next vehicle in the chain.
Definition: vehicle_base.h:1121
RoadVehicle::UpdateSpeed
int UpdateSpeed()
This function looks at the vehicle and updates its speed (cur_speed and subspeed) variables.
Definition: roadveh_cmd.cpp:732
RDE_NEXT_TILE
static const uint RDE_NEXT_TILE
State information about the Road Vehicle controller.
Definition: roadveh.h:61
Vehicle::vehstatus
byte vehstatus
Status.
Definition: vehicle_base.h:349
RVSB_IN_ROAD_STOP
@ RVSB_IN_ROAD_STOP
The vehicle is in a road stop.
Definition: roadveh.h:49
CargoSpec::Get
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
Definition: cargotype.h:131
RoadVehicle::path
RoadVehPathCache path
Cached path.
Definition: roadveh.h:107
RoadVehicle::GetSlopeSteepness
uint32_t GetSlopeSteepness() const
Returns the slope steepness used by this vehicle.
Definition: roadveh.h:273
RoadVehicle::overtaking_ctr
byte overtaking_ctr
The length of the current overtake attempt.
Definition: roadveh.h:112
RoadVehicle::GetAccelerationType
int GetAccelerationType() const
Allows to know the acceleration type of a vehicle.
Definition: roadveh.h:264
RDE_TURNED
static const uint RDE_TURNED
We just finished turning.
Definition: roadveh.h:62
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
AS_ACCEL
@ AS_ACCEL
We want to go faster, if possible of course.
Definition: ground_vehicle.hpp:21
RoadVehicle::roadtype
RoadType roadtype
Roadtype of this vehicle.
Definition: roadveh.h:116
EngineImageType
EngineImageType
Visualisation contexts of vehicles and engines.
Definition: vehicle_type.h:85
VEH_ROAD
@ VEH_ROAD
Road vehicle type.
Definition: vehicle_type.h:25
RVS_USING_SECOND_BAY
@ RVS_USING_SECOND_BAY
Only used while in a road stop.
Definition: roadveh.h:42
RoadVehicle::UpdateDeltaXY
void UpdateDeltaXY() override
Updates the x and y offsets and the size of the sprite used for this vehicle.
Definition: roadveh_cmd.cpp:411
RoadVehicleStates
RoadVehicleStates
Road vehicle states.
Definition: roadveh.h:24
GroundVehicleCache::last_speed
uint16_t last_speed
The last speed we did display, so we only have to redraw when this changes.
Definition: ground_vehicle.hpp:47
RVSB_IN_DT_ROAD_STOP
@ RVSB_IN_DT_ROAD_STOP
The vehicle is in a drive-through road stop.
Definition: roadveh.h:51
GetTileTrackStatus
TrackStatus GetTileTrackStatus(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side)
Returns information about trackdirs and signal states.
Definition: landscape.cpp:556
Vehicle::IsArticulatedPart
bool IsArticulatedPart() const
Check if the vehicle is an articulated part of an engine.
Definition: vehicle_base.h:945
RVS_DRIVE_SIDE
@ RVS_DRIVE_SIDE
Only used when retrieving move data.
Definition: roadveh.h:44
Vehicle::GetImage
virtual void GetImage([[maybe_unused]] Direction direction, [[maybe_unused]] EngineImageType image_type, [[maybe_unused]] VehicleSpriteSeq *result) const
Gets the sprite to show for the given direction.
Definition: vehicle_base.h:482
VehicleCache::cached_max_speed
uint16_t cached_max_speed
Maximum speed of the consist (minimum of the max speed of all vehicles in the consist).
Definition: vehicle_base.h:124
RoadVehicle::GetAirDrag
byte GetAirDrag() const
Gets the air drag coefficient of this vehicle.
Definition: roadveh.h:223
RoadVehicle::GetMaxWeight
uint16_t GetMaxWeight() const override
Calculates the weight value that this vehicle will have when fully loaded with its current cargo.
Definition: roadveh_cmd.cpp:1775
RoadVehicle::OnNewEconomyDay
void OnNewEconomyDay() override
Economy day handler.
Definition: roadveh_cmd.cpp:1728
RoadVehicle::disaster_vehicle
VehicleID disaster_vehicle
NOSAVE: Disaster vehicle targetting this vehicle.
Definition: roadveh.h:119
RoadVehicle::GetDisplaySpeed
int GetDisplaySpeed() const override
Gets the speed in km-ish/h that can be sent into SetDParam for string processing.
Definition: roadveh.h:133
RoadVehicle::RoadVehicle
RoadVehicle()
We don't want GCC to zero our struct! It already is zeroed and has an index!
Definition: roadveh.h:122
newgrf_engine.h
RoadTypes
RoadTypes
The different roadtypes we support, but then a bitmask of them.
Definition: road_type.h:38
Vehicle::tile
TileIndex tile
Current tile index.
Definition: vehicle_base.h:260
INVALID_VEHICLE
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
Definition: vehicle_type.h:54
RoadVehicle::GetRunningCost
Money GetRunningCost() const override
Gets the running cost of a vehicle.
Definition: roadveh_cmd.cpp:1645
Vehicle::engine_type
EngineID engine_type
The type of engine used for this vehicle.
Definition: vehicle_base.h:319
RoadVehicle::GetDisplayMaxSpeed
int GetDisplayMaxSpeed() const override
Gets the maximum speed in km-ish/h that can be sent into SetDParam for string processing.
Definition: roadveh.h:134
VehicleSpriteSeq
Sprite sequence for a vehicle part.
Definition: vehicle_base.h:131
Vehicle::cargo
VehicleCargoList cargo
The cargo this vehicle is carrying.
Definition: vehicle_base.h:341
GroundVehicle< RoadVehicle, VEH_ROAD >::gcache
GroundVehicleCache gcache
Cache of often calculated values.
Definition: ground_vehicle.hpp:80
Vehicle::GetExpenseType
virtual ExpensesType GetExpenseType([[maybe_unused]] bool income) const
Sets the expense type associated to this vehicle type.
Definition: vehicle_base.h:462
RoadVehicle::IsInDepot
bool IsInDepot() const override
Check whether the vehicle is in the depot.
Definition: roadveh.h:137
RVSB_TRACKDIR_MASK
@ RVSB_TRACKDIR_MASK
The mask used to extract track dirs.
Definition: roadveh.h:56
Vehicle::cur_speed
uint16_t cur_speed
current speed
Definition: vehicle_base.h:324
RoadVehicleInfo::air_drag
uint8_t air_drag
Coefficient of air drag.
Definition: engine_type.h:125
_settings_game
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition: settings.cpp:55
RVS_ENTERED_STOP
@ RVS_ENTERED_STOP
Only set when a vehicle has entered the stop.
Definition: roadveh.h:43
RoadVehicle::GetCurrentMaxSpeed
int GetCurrentMaxSpeed() const override
Calculates the maximum speed of the vehicle under its current conditions.
Definition: roadveh_cmd.cpp:442
VS_STOPPED
@ VS_STOPPED
Vehicle is stopped by the player.
Definition: vehicle_base.h:34
RoadVehicle::Crash
uint Crash(bool flooded=false) override
Crash the (whole) vehicle chain.
Definition: roadveh_cmd.cpp:535
TRACK_BIT_X
@ TRACK_BIT_X
X-axis track.
Definition: track_type.h:37
RVSB_DRIVE_SIDE
@ RVSB_DRIVE_SIDE
The vehicle is at the opposite side of the road.
Definition: roadveh.h:54
RoadVehicle::Tick
bool Tick() override
Calls the tick handler of the vehicle.
Definition: roadveh_cmd.cpp:1656
RVS_IN_ROAD_STOP
@ RVS_IN_ROAD_STOP
The vehicle is in a road stop.
Definition: roadveh.h:45
VehicleID
uint32_t VehicleID
The type all our vehicle IDs have.
Definition: vehicle_type.h:16
RoadVehicle::compatible_roadtypes
RoadTypes compatible_roadtypes
Roadtypes this consist is powered on.
Definition: roadveh.h:117
road.h
RoadVehicle::MarkDirty
void MarkDirty() override
Marks the vehicles to be redrawn and updates cached variables.
Definition: roadveh_cmd.cpp:402
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
TrackStatusToTrackBits
TrackBits TrackStatusToTrackBits(TrackStatus ts)
Returns the present-track-information of a TrackStatus.
Definition: track_func.h:363
RoadVehicle::GetVehicleTrackdir
Trackdir GetVehicleTrackdir() const override
Returns the Trackdir on which the vehicle is currently located.
Definition: roadveh_cmd.cpp:1753
RoadVehicle::TileMayHaveSlopedTrack
bool TileMayHaveSlopedTrack() const
Checks if the vehicle is at a tile that can be sloped.
Definition: roadveh.h:291
road_map.h
Vehicle::direction
Direction direction
facing
Definition: vehicle_base.h:303
GetRoadTypeInfo
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
Definition: road.h:227
RoadVehicle::GetWeight
uint16_t GetWeight() const
Allows to know the weight value that this vehicle will use.
Definition: roadveh.h:181
RoadVehicle::GetTractiveEffort
byte GetTractiveEffort() const
Allows to know the tractive effort value that this vehicle will use.
Definition: roadveh.h:204
Vehicle::vcache
VehicleCache vcache
Cache of often used vehicle values.
Definition: vehicle_base.h:362
RoadVehicle::OnNewCalendarDay
void OnNewCalendarDay() override
Calandar day handler.
Definition: roadveh_cmd.cpp:1721
RoadVehUpdateCache
void RoadVehUpdateCache(RoadVehicle *v, bool same_length=false)
Update the cache of a road vehicle.
Definition: roadveh_cmd.cpp:219
RoadVehicle::GetDisplayImageWidth
int GetDisplayImageWidth(Point *offset=nullptr) const
Get the width of a road vehicle image in the GUI.
Definition: roadveh_cmd.cpp:94
RoadVehPathCache
Definition: roadveh.h:84
GetRoadVehSpriteSize
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).
Definition: roadveh_cmd.cpp:172
GroundVehicle
Base class for all vehicles that move through ground.
Definition: ground_vehicle.hpp:79
cargotype.h
TRACKDIR_END
@ TRACKDIR_END
Used for iterations.
Definition: track_type.h:85
RoadType
RoadType
The different roadtypes we support.
Definition: road_type.h:25
track_func.h
IsReversingRoadTrackdir
bool IsReversingRoadTrackdir(Trackdir dir)
Checks whether the trackdir means that we are reversing.
Definition: track_func.h:673
ClosestDepot
Structure to return information about the closest depot location, and whether it could be found.
Definition: vehicle_base.h:226
RoadVehicle::GetAirDragArea
byte GetAirDragArea() const
Gets the area used for calculating air drag.
Definition: roadveh.h:214
TrackBits
TrackBits
Allow incrementing of Track variables.
Definition: track_type.h:35
ground_vehicle.hpp
RoadTypeInfo::max_speed
uint16_t max_speed
Maximum speed for vehicles travelling on this road type.
Definition: road.h:142
RoadVehicle::GetPower
uint16_t GetPower() const
Allows to know the power value that this vehicle will use.
Definition: roadveh.h:158
RVSB_WORMHOLE
@ RVSB_WORMHOLE
The vehicle is in a tunnel and/or bridge.
Definition: roadveh.h:39
RoadVehicle::FindClosestDepot
ClosestDepot FindClosestDepot() override
Find the closest depot for this vehicle and tell us the location, DestinationID and whether we should...
Definition: roadveh_cmd.cpp:353
RV_OVERTAKE_TIMEOUT
static const byte RV_OVERTAKE_TIMEOUT
The number of ticks a vehicle has for overtaking.
Definition: roadveh.h:79
OverflowSafeInt< int64_t >
RoadVehicle::IsBus
bool IsBus() const
Check whether a roadvehicle is a bus.
Definition: roadveh_cmd.cpp:83
engine_base.h
TRANSPORT_ROAD
@ TRANSPORT_ROAD
Transport by road vehicle.
Definition: transport_type.h:28
Vehicle::cargo_type
CargoID cargo_type
type of cargo this vehicle is carrying
Definition: vehicle_base.h:337
RoadVehicle::GetRollingFriction
uint32_t GetRollingFriction() const
Returns the rolling friction coefficient of this vehicle.
Definition: roadveh.h:250
RoadVehicle::crashed_ctr
uint16_t crashed_ctr
Animation counter when the vehicle has crashed.
Definition: roadveh.h:113
RVS_IN_DT_ROAD_STOP
@ RVS_IN_DT_ROAD_STOP
The vehicle is in a drive-through road stop.
Definition: roadveh.h:46
TRACK_BIT_Y
@ TRACK_BIT_Y
Y-axis track.
Definition: track_type.h:38
GameSettings::vehicle
VehicleSettings vehicle
options for vehicles
Definition: settings_type.h:626
EngineID
uint16_t EngineID
Unique identification number of an engine.
Definition: engine_type.h:21
Trackdir
Trackdir
Enumeration for tracks and directions.
Definition: track_type.h:67
PROP_ROADVEH_POWER
@ PROP_ROADVEH_POWER
Power in 10 HP.
Definition: newgrf_properties.h:36
Vehicle::GetOrderStationLocation
virtual TileIndex GetOrderStationLocation([[maybe_unused]] StationID station)
Determine the location for the station where the vehicle goes to next.
Definition: vehicle_base.h:789
RoadVehicle::GetMaxTrackSpeed
uint16_t GetMaxTrackSpeed() const
Gets the maximum speed allowed by the track for this vehicle.
Definition: roadveh.h:282
RoadVehicle::IsPrimaryVehicle
bool IsPrimaryVehicle() const override
Whether this is the primary vehicle in the chain.
Definition: roadveh.h:131
SpecializedVehicle< RoadVehicle, Type >::First
RoadVehicle * First() const
Get the first vehicle in the chain.
Definition: vehicle_base.h:1103
AS_BRAKE
@ AS_BRAKE
We want to stop.
Definition: ground_vehicle.hpp:22
ExpensesType
ExpensesType
Types of expenses.
Definition: economy_type.h:172
RVSB_IN_DEPOT
@ RVSB_IN_DEPOT
The vehicle is in a depot.
Definition: roadveh.h:38
VehicleSettings::roadveh_slope_steepness
uint8_t roadveh_slope_steepness
Steepness of hills for road vehicles when using realistic acceleration.
Definition: settings_type.h:520
EXPENSES_ROADVEH_REVENUE
@ EXPENSES_ROADVEH_REVENUE
Revenue from road vehicles.
Definition: economy_type.h:181
RoadVehicle::GetCurrentSpeed
uint16_t GetCurrentSpeed() const
Calculates the current speed of this vehicle.
Definition: roadveh.h:241
AccelStatus
AccelStatus
What is the status of our acceleration?
Definition: ground_vehicle.hpp:20
RVSB_ROAD_STOP_TRACKDIR_MASK
@ RVSB_ROAD_STOP_TRACKDIR_MASK
Only bits 0 and 3 are used to encode the trackdir for road stops.
Definition: roadveh.h:57
PROP_ROADVEH_WEIGHT
@ PROP_ROADVEH_WEIGHT
Weight in 1/4 t.
Definition: newgrf_properties.h:37