Feature: Add NotRoadTypes (NRT)
This commit is contained in:
@@ -669,7 +669,7 @@ static const AircraftVehicleInfo _orig_aircraft_vehicle_info[] = {
|
||||
* Tractive effort coefficient by default is the same as TTDPatch, 0.30*256=76
|
||||
* Air drag value depends on the top speed of the vehicle.
|
||||
*/
|
||||
#define ROV(a, b, c, d, e, f, g, h) { a, b, c, PR_RUNNING_ROADVEH, d, e, f, g, h, 76, 0, VE_DEFAULT, 0 }
|
||||
#define ROV(a, b, c, d, e, f, g, h) { a, b, c, PR_RUNNING_ROADVEH, d, e, f, g, h, 76, 0, VE_DEFAULT, 0, ROADTYPE_ROAD }
|
||||
static const RoadVehicleInfo _orig_road_vehicle_info[] = {
|
||||
/* image_index sfx max_speed power
|
||||
* | cost_factor | | capacity |
|
||||
|
@@ -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"),
|
||||
@@ -554,6 +555,48 @@ static const NIFeature _nif_town = {
|
||||
new NIHTown(),
|
||||
};
|
||||
|
||||
/*** 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
|
||||
@@ -574,6 +617,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
|
||||
};
|
||||
assert_compile(lengthof(_nifeatures) == GSF_FAKE_END);
|
||||
|
@@ -156,7 +156,7 @@ static const RailtypeInfo _original_railtypes[] = {
|
||||
STR_RAIL_MENU_ELRAIL_CONSTRUCTION,
|
||||
STR_BUY_VEHICLE_TRAIN_ELRAIL_CAPTION,
|
||||
STR_REPLACE_ELRAIL_VEHICLES,
|
||||
STR_ENGINE_PREVIEW_RAILROAD_LOCOMOTIVE,
|
||||
STR_ENGINE_PREVIEW_ELRAIL_LOCOMOTIVE,
|
||||
},
|
||||
|
||||
/* Offset of snow tiles */
|
||||
|
@@ -41,35 +41,6 @@ static const DrawTileSprites _road_depot[] = {
|
||||
{ {0xA4A, PAL_NONE}, _road_depot_NW }
|
||||
};
|
||||
|
||||
static const DrawTileSeqStruct _tram_depot_NE[] = {
|
||||
TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x35) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
|
||||
TILE_SEQ_END()
|
||||
};
|
||||
|
||||
static const DrawTileSeqStruct _tram_depot_SE[] = {
|
||||
TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x31) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 1, 16)
|
||||
TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x32) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
|
||||
TILE_SEQ_END()
|
||||
};
|
||||
|
||||
static const DrawTileSeqStruct _tram_depot_SW[] = {
|
||||
TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x33) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 0, 16, 1)
|
||||
TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x34) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 0, 15, 16, 1)
|
||||
TILE_SEQ_END()
|
||||
};
|
||||
|
||||
static const DrawTileSeqStruct _tram_depot_NW[] = {
|
||||
TILE_SEQ_LINE((SPR_TRAMWAY_BASE + 0x36) | (1 << PALETTE_MODIFIER_COLOUR), PAL_NONE, 15, 0, 1, 16)
|
||||
TILE_SEQ_END()
|
||||
};
|
||||
|
||||
static const DrawTileSprites _tram_depot[] = {
|
||||
{ {0xA4A, PAL_NONE}, _tram_depot_NE },
|
||||
{ {0xA4A, PAL_NONE}, _tram_depot_SE },
|
||||
{ {0xA4A, PAL_NONE}, _tram_depot_SW },
|
||||
{ {0xA4A, PAL_NONE}, _tram_depot_NW }
|
||||
};
|
||||
|
||||
/* Sprite layout for level crossings. The SpriteIDs are actually offsets
|
||||
* from the base SpriteID returned from the NewGRF sprite resolver. */
|
||||
static const DrawTileSeqStruct _crossing_layout_ALL[] = {
|
||||
|
183
src/table/roadtypes.h
Normal file
183
src/table/roadtypes.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* 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.
|
||||
* 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.
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file roadtypes.h
|
||||
* All the roadtype-specific information is stored here.
|
||||
*/
|
||||
|
||||
#ifndef ROADTYPES_H
|
||||
#define ROADTYPES_H
|
||||
|
||||
/**
|
||||
* Global Roadtype definition
|
||||
*/
|
||||
static const RoadTypeInfo _original_roadtypes[] = {
|
||||
/* Road */
|
||||
{
|
||||
/* GUI sprites */
|
||||
{
|
||||
SPR_IMG_ROAD_X_DIR,
|
||||
SPR_IMG_ROAD_Y_DIR,
|
||||
SPR_IMG_AUTOROAD,
|
||||
SPR_IMG_ROAD_DEPOT,
|
||||
SPR_IMG_ROAD_TUNNEL,
|
||||
SPR_IMG_CONVERT_ROAD,
|
||||
},
|
||||
|
||||
{
|
||||
SPR_CURSOR_ROAD_NESW,
|
||||
SPR_CURSOR_ROAD_NWSE,
|
||||
SPR_CURSOR_AUTOROAD,
|
||||
SPR_CURSOR_ROAD_DEPOT,
|
||||
SPR_CURSOR_TUNNEL_RAIL,
|
||||
SPR_CURSOR_CONVERT_ROAD,
|
||||
},
|
||||
|
||||
/* strings */
|
||||
{
|
||||
STR_ROAD_NAME_ROAD,
|
||||
STR_ROAD_TOOLBAR_ROAD_CONSTRUCTION_CAPTION,
|
||||
STR_ROAD_MENU_ROAD_CONSTRUCTION,
|
||||
STR_BUY_VEHICLE_ROAD_VEHICLE_CAPTION,
|
||||
STR_REPLACE_ROAD_VEHICLES,
|
||||
STR_ENGINE_PREVIEW_ROAD_VEHICLE,
|
||||
|
||||
STR_ERROR_CAN_T_BUILD_ROAD_HERE,
|
||||
STR_ERROR_CAN_T_REMOVE_ROAD_FROM,
|
||||
STR_ERROR_CAN_T_BUILD_ROAD_DEPOT,
|
||||
{ STR_ERROR_CAN_T_BUILD_BUS_STATION, STR_ERROR_CAN_T_BUILD_TRUCK_STATION },
|
||||
{ STR_ERROR_CAN_T_REMOVE_BUS_STATION, STR_ERROR_CAN_T_REMOVE_TRUCK_STATION },
|
||||
STR_ERROR_CAN_T_CONVERT_ROAD,
|
||||
{ STR_STATION_BUILD_BUS_ORIENTATION, STR_STATION_BUILD_TRUCK_ORIENTATION },
|
||||
{ STR_STATION_BUILD_BUS_ORIENTATION_TOOLTIP, STR_STATION_BUILD_TRUCK_ORIENTATION_TOOLTIP },
|
||||
},
|
||||
|
||||
/* Powered roadtypes */
|
||||
ROADTYPES_ROAD,
|
||||
|
||||
/* flags */
|
||||
ROTFB_TOWN_BUILD,
|
||||
|
||||
/* cost multiplier */
|
||||
8,
|
||||
|
||||
/* maintenance cost multiplier */
|
||||
16,
|
||||
|
||||
/* max speed */
|
||||
0,
|
||||
|
||||
/* road type label */
|
||||
'ROAD',
|
||||
|
||||
/* alternate labels */
|
||||
RoadTypeLabelList(),
|
||||
|
||||
/* map colour */
|
||||
0x01,
|
||||
|
||||
/* introduction date */
|
||||
MIN_YEAR,
|
||||
|
||||
/* roadtypes required for this to be introduced */
|
||||
ROADTYPES_NONE,
|
||||
|
||||
/* introduction road types */
|
||||
ROADTYPES_ROAD,
|
||||
|
||||
/* sort order */
|
||||
0x07,
|
||||
|
||||
{ nullptr },
|
||||
{ nullptr },
|
||||
},
|
||||
|
||||
/* Electrified Tram */
|
||||
{
|
||||
/* GUI sprites */
|
||||
{
|
||||
SPR_IMG_TRAMWAY_X_DIR,
|
||||
SPR_IMG_TRAMWAY_Y_DIR,
|
||||
SPR_IMG_AUTOTRAM,
|
||||
SPR_IMG_ROAD_DEPOT,
|
||||
SPR_IMG_ROAD_TUNNEL,
|
||||
SPR_IMG_CONVERT_TRAM,
|
||||
},
|
||||
|
||||
{
|
||||
SPR_CURSOR_TRAMWAY_NESW,
|
||||
SPR_CURSOR_TRAMWAY_NWSE,
|
||||
SPR_CURSOR_AUTOTRAM,
|
||||
SPR_CURSOR_ROAD_DEPOT,
|
||||
SPR_CURSOR_TUNNEL_RAIL,
|
||||
SPR_CURSOR_CONVERT_TRAM,
|
||||
},
|
||||
|
||||
/* strings */
|
||||
{
|
||||
STR_ROAD_NAME_TRAM,
|
||||
STR_ROAD_TOOLBAR_TRAM_CONSTRUCTION_CAPTION,
|
||||
STR_ROAD_MENU_TRAM_CONSTRUCTION,
|
||||
STR_BUY_VEHICLE_TRAM_VEHICLE_CAPTION,
|
||||
STR_REPLACE_TRAM_VEHICLES,
|
||||
STR_ENGINE_PREVIEW_TRAM_VEHICLE,
|
||||
|
||||
STR_ERROR_CAN_T_BUILD_TRAMWAY_HERE,
|
||||
STR_ERROR_CAN_T_REMOVE_TRAMWAY_FROM,
|
||||
STR_ERROR_CAN_T_BUILD_TRAM_DEPOT,
|
||||
{ STR_ERROR_CAN_T_BUILD_PASSENGER_TRAM_STATION, STR_ERROR_CAN_T_BUILD_CARGO_TRAM_STATION },
|
||||
{ STR_ERROR_CAN_T_REMOVE_PASSENGER_TRAM_STATION, STR_ERROR_CAN_T_REMOVE_CARGO_TRAM_STATION },
|
||||
STR_ERROR_CAN_T_CONVERT_TRAMWAY,
|
||||
{ STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION, STR_STATION_BUILD_CARGO_TRAM_ORIENTATION },
|
||||
{ STR_STATION_BUILD_PASSENGER_TRAM_ORIENTATION_TOOLTIP, STR_STATION_BUILD_CARGO_TRAM_ORIENTATION_TOOLTIP },
|
||||
},
|
||||
|
||||
/* Powered roadtypes */
|
||||
ROADTYPES_TRAM,
|
||||
|
||||
/* flags */
|
||||
ROTFB_CATENARY | ROTFB_NO_HOUSES,
|
||||
|
||||
/* cost multiplier */
|
||||
16,
|
||||
|
||||
/* maintenance cost multiplier */
|
||||
24,
|
||||
|
||||
/* max speed */
|
||||
0,
|
||||
|
||||
/* road type label */
|
||||
'ELRL',
|
||||
|
||||
/* alternate labels */
|
||||
RoadTypeLabelList(),
|
||||
|
||||
/* map colour */
|
||||
0x01,
|
||||
|
||||
/* introduction date */
|
||||
INVALID_DATE,
|
||||
|
||||
/* roadtypes required for this to be introduced */
|
||||
ROADTYPES_NONE,
|
||||
|
||||
/* introduction road types */
|
||||
ROADTYPES_TRAM,
|
||||
|
||||
/* sort order */
|
||||
0x17,
|
||||
|
||||
{ nullptr },
|
||||
{ nullptr },
|
||||
},
|
||||
};
|
||||
|
||||
#endif /* ROADTYPES_H */
|
@@ -56,7 +56,7 @@ static const SpriteID SPR_LARGE_SMALL_WINDOW = 682;
|
||||
|
||||
/** Extra graphic spritenumbers */
|
||||
static const SpriteID SPR_OPENTTD_BASE = 4896;
|
||||
static const uint16 OPENTTD_SPRITE_COUNT = 179;
|
||||
static const uint16 OPENTTD_SPRITE_COUNT = 184;
|
||||
|
||||
/* Halftile-selection sprites */
|
||||
static const SpriteID SPR_HALFTILE_SELECTION_FLAT = SPR_OPENTTD_BASE;
|
||||
@@ -273,13 +273,15 @@ static const SpriteID SPR_TRAMWAY_BUS_STOP_DT_X_W = SPR_TRAMWAY_BASE + 24;
|
||||
static const SpriteID SPR_TRAMWAY_BUS_STOP_DT_X_E = SPR_TRAMWAY_BASE + 26;
|
||||
static const SpriteID SPR_TRAMWAY_PAVED_STRAIGHT_Y = SPR_TRAMWAY_BASE + 46;
|
||||
static const SpriteID SPR_TRAMWAY_PAVED_STRAIGHT_X = SPR_TRAMWAY_BASE + 47;
|
||||
static const SpriteID SPR_TRAMWAY_DEPOT_WITH_TRACK = SPR_TRAMWAY_BASE + 49;
|
||||
static const SpriteID SPR_TRAMWAY_BACK_WIRES_STRAIGHT = SPR_TRAMWAY_BASE + 55;
|
||||
static const SpriteID SPR_TRAMWAY_FRONT_WIRES_STRAIGHT = SPR_TRAMWAY_BASE + 56;
|
||||
static const SpriteID SPR_TRAMWAY_BACK_WIRES_SLOPED = SPR_TRAMWAY_BASE + 72;
|
||||
static const SpriteID SPR_TRAMWAY_FRONT_WIRES_SLOPED = SPR_TRAMWAY_BASE + 68;
|
||||
static const SpriteID SPR_TRAMWAY_TUNNEL_WIRES = SPR_TRAMWAY_BASE + 80;
|
||||
static const SpriteID SPR_TRAMWAY_BRIDGE = SPR_TRAMWAY_BASE + 107;
|
||||
static const uint16 TRAMWAY_SPRITE_COUNT = 113;
|
||||
static const SpriteID SPR_TRAMWAY_DEPOT_NO_TRACK = SPR_TRAMWAY_BASE + 113;
|
||||
static const uint16 TRAMWAY_SPRITE_COUNT = 119;
|
||||
|
||||
/** One way road sprites */
|
||||
static const SpriteID SPR_ONEWAY_BASE = SPR_TRAMWAY_BASE + TRAMWAY_SPRITE_COUNT;
|
||||
@@ -563,6 +565,7 @@ static const SpriteID SPR_ROAD_SLOPE_START = 1343;
|
||||
static const SpriteID SPR_ROAD_Y_SNOW = 1351;
|
||||
static const SpriteID SPR_ROAD_X_SNOW = 1352;
|
||||
/* see _road_sloped_sprites_offset in road_cmd.cpp for offsets for sloped road tiles */
|
||||
static const SpriteID SPR_ROAD_DEPOT = 1408;
|
||||
|
||||
static const SpriteID SPR_EXCAVATION_X = 1414;
|
||||
static const SpriteID SPR_EXCAVATION_Y = 1415;
|
||||
@@ -1099,6 +1102,7 @@ static const SpriteID SPR_IMG_ZOOMIN = 735;
|
||||
static const SpriteID SPR_IMG_ZOOMOUT = 736;
|
||||
static const SpriteID SPR_IMG_BUILDRAIL = 727;
|
||||
static const SpriteID SPR_IMG_BUILDROAD = 728;
|
||||
static const SpriteID SPR_IMG_BUILDTRAMS = SPR_OPENTTD_BASE + 179;
|
||||
static const SpriteID SPR_IMG_BUILDWATER = 729;
|
||||
static const SpriteID SPR_IMG_BUILDAIR = 730;
|
||||
static const SpriteID SPR_IMG_LANDSCAPING = 4083;
|
||||
@@ -1343,6 +1347,11 @@ static const SpriteID SPR_IMG_GOAL = SPR_OPENTTD_BASE + 171;
|
||||
static const SpriteID SPR_IMG_GOAL_COMPLETED = SPR_OPENTTD_BASE + 172;
|
||||
static const SpriteID SPR_IMG_GOAL_BROKEN_REF= SPR_OPENTTD_BASE + 173;
|
||||
|
||||
static const SpriteID SPR_IMG_CONVERT_ROAD = SPR_OPENTTD_BASE + 180;
|
||||
static const CursorID SPR_CURSOR_CONVERT_ROAD = SPR_OPENTTD_BASE + 181;
|
||||
static const SpriteID SPR_IMG_CONVERT_TRAM = SPR_OPENTTD_BASE + 182;
|
||||
static const CursorID SPR_CURSOR_CONVERT_TRAM = SPR_OPENTTD_BASE + 183;
|
||||
|
||||
/* intro_gui.cpp, genworld_gui.cpp */
|
||||
static const SpriteID SPR_SELECT_TEMPERATE = 4882;
|
||||
static const SpriteID SPR_SELECT_TEMPERATE_PUSHED = 4883;
|
||||
|
Reference in New Issue
Block a user