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:
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "../newgrf_house.h"
|
||||
#include "../newgrf_engine.h"
|
||||
#include "../newgrf_roadtype.h"
|
||||
|
||||
/* Helper for filling property tables */
|
||||
#define NIP(prop, base, variable, type, name) { name, (ptrdiff_t)cpp_offsetof(base, variable), cpp_sizeof(base, variable), prop, type }
|
||||
@@ -58,7 +59,7 @@ static const NIVariable _niv_vehicles[] = {
|
||||
NIV(0x47, "vehicle cargo info"),
|
||||
NIV(0x48, "vehicle type info"),
|
||||
NIV(0x49, "year of construction"),
|
||||
NIV(0x4A, "current rail type info"),
|
||||
NIV(0x4A, "current rail/road type info"),
|
||||
NIV(0x4B, "long date of last service"),
|
||||
NIV(0x4C, "current max speed"),
|
||||
NIV(0x4D, "position in articulated vehicle"),
|
||||
@@ -676,6 +677,48 @@ static const NIFeature _nif_station_struct = {
|
||||
new NIHStationStruct(),
|
||||
};
|
||||
|
||||
/*** NewGRF road types ***/
|
||||
|
||||
static const NIVariable _niv_roadtypes[] = {
|
||||
NIV(0x40, "terrain type"),
|
||||
NIV(0x41, "enhanced tunnels"),
|
||||
NIV(0x42, "level crossing status"),
|
||||
NIV(0x43, "construction date"),
|
||||
NIV(0x44, "town zone"),
|
||||
NIV_END()
|
||||
};
|
||||
|
||||
class NIHRoadType : public NIHelper {
|
||||
bool IsInspectable(uint index) const override { return true; }
|
||||
uint GetParent(uint index) const override { return UINT32_MAX; }
|
||||
const void *GetInstance(uint index) const override { return nullptr; }
|
||||
const void *GetSpec(uint index) const override { return nullptr; }
|
||||
void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); }
|
||||
uint32 GetGRFID(uint index) const override { return 0; }
|
||||
|
||||
uint Resolve(uint index, uint var, uint param, bool *avail) const override
|
||||
{
|
||||
/* There is no unique GRFFile for the tile. Multiple GRFs can define different parts of the railtype.
|
||||
* However, currently the NewGRF Debug GUI does not display variables depending on the GRF (like 0x7F) anyway. */
|
||||
RoadTypeResolverObject ro(nullptr, index, TCX_NORMAL, ROTSG_END);
|
||||
return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail);
|
||||
}
|
||||
};
|
||||
|
||||
static const NIFeature _nif_roadtype = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
_niv_roadtypes,
|
||||
new NIHRoadType(),
|
||||
};
|
||||
|
||||
static const NIFeature _nif_tramtype = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
_niv_roadtypes,
|
||||
new NIHRoadType(),
|
||||
};
|
||||
|
||||
/** Table with all NIFeatures. */
|
||||
static const NIFeature * const _nifeatures[] = {
|
||||
&_nif_vehicle, // GSF_TRAINS
|
||||
@@ -696,6 +739,8 @@ static const NIFeature * const _nifeatures[] = {
|
||||
&_nif_object, // GSF_OBJECTS
|
||||
&_nif_railtype, // GSF_RAILTYPES
|
||||
&_nif_airporttile, // GSF_AIRPORTTILES
|
||||
&_nif_roadtype, // GSF_ROADTYPES
|
||||
&_nif_tramtype, // GSF_TRAMTYPES
|
||||
&_nif_town, // GSF_FAKE_TOWNS
|
||||
&_nif_station_struct, // GSF_FAKE_STATION_STRUCT
|
||||
};
|
||||
|
Reference in New Issue
Block a user