Merge branch 'master' into jgrpp-nrt

Merge NRT feature

# Conflicts:
#	docs/landscape.html
#	docs/landscape_grid.html
#	src/bridge_map.h
#	src/build_vehicle_gui.cpp
#	src/company_base.h
#	src/company_cmd.cpp
#	src/misc_gui.cpp
#	src/newgrf.cpp
#	src/newgrf_engine.cpp
#	src/pathfinder/follow_track.hpp
#	src/pathfinder/npf/npf.cpp
#	src/road_cmd.cpp
#	src/road_func.h
#	src/road_gui.cpp
#	src/road_map.h
#	src/road_type.h
#	src/roadveh_cmd.cpp
#	src/saveload/afterload.cpp
#	src/saveload/company_sl.cpp
#	src/script/api/script_bridge.cpp
#	src/table/newgrf_debug_data.h
#	src/tile_cmd.h
#	src/town_cmd.cpp
#	src/tunnel_map.h
#	src/tunnelbridge_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2019-07-11 19:45:56 +01:00
177 changed files with 4839 additions and 1461 deletions

View File

@@ -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>
@@ -116,8 +117,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.
byte critical_breakdown_count; ///< Counter for the number of critical breakdowns since last service
@@ -280,7 +281,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;
@@ -310,7 +311,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;
}
/**
@@ -319,7 +320,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;