Feature: Add NotRoadTypes (NRT)
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user