diff options
author | peter1138 <peter1138@openttd.org> | 2019-04-06 07:46:15 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-05-01 21:36:27 +0200 |
commit | c02ef3e4564b7b54d49f0827d2d7625cbc38f335 (patch) | |
tree | 1c0ee62b6ce55124b247daaafa42300bfaa932e7 /src/roadveh.h | |
parent | 21edf67f89c60351d5a0d84625455aa296b6b950 (diff) | |
download | openttd-c02ef3e4564b7b54d49f0827d2d7625cbc38f335.tar.xz |
Feature: Add NotRoadTypes (NRT)
Diffstat (limited to 'src/roadveh.h')
-rw-r--r-- | src/roadveh.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/roadveh.h b/src/roadveh.h index 7c8f32d0f..02eb48c8c 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -16,7 +16,8 @@ #include "engine_base.h" #include "cargotype.h" #include "track_func.h" -#include "road_type.h" +#include "road.h" +#include "road_map.h" #include "newgrf_engine.h" #include <deque> @@ -115,8 +116,8 @@ struct RoadVehicle FINAL : public GroundVehicle<RoadVehicle, VEH_ROAD> { uint16 crashed_ctr; ///< Animation counter when the vehicle has crashed. @see RoadVehIsCrashed byte reverse_ctr; - RoadType roadtype; - RoadTypes compatible_roadtypes; + RoadType roadtype; //!< Roadtype of this vehicle. + RoadTypes compatible_roadtypes; //!< Roadtypes this consist is powered on. /** We don't want GCC to zero our struct! It already is zeroed and has an index! */ RoadVehicle() : GroundVehicleBase() {} @@ -244,7 +245,7 @@ protected: // These functions should not be called outside acceleration code. { /* Trams have a slightly greater friction coefficient than trains. * The rest of road vehicles have bigger values. */ - uint32 coeff = (this->roadtype == ROADTYPE_TRAM) ? 40 : 75; + uint32 coeff = RoadTypeIsTram(this->roadtype) ? 40 : 75; /* The friction coefficient increases with speed in a way that * it doubles at 128 km/h, triples at 256 km/h and so on. */ return coeff * (128 + this->GetCurrentSpeed()) / 128; @@ -274,7 +275,7 @@ protected: // These functions should not be called outside acceleration code. */ inline uint16 GetMaxTrackSpeed() const { - return 0; + return GetRoadTypeInfo(GetRoadType(this->tile, GetRoadTramType(this->roadtype)))->max_speed; } /** @@ -283,7 +284,7 @@ protected: // These functions should not be called outside acceleration code. */ inline bool TileMayHaveSlopedTrack() const { - TrackStatus ts = GetTileTrackStatus(this->tile, TRANSPORT_ROAD, this->compatible_roadtypes); + TrackStatus ts = GetTileTrackStatus(this->tile, TRANSPORT_ROAD, GetRoadTramType(this->roadtype)); TrackBits trackbits = TrackStatusToTrackBits(ts); return trackbits == TRACK_BIT_X || trackbits == TRACK_BIT_Y; |