diff --git a/src/newgrf/newgrf_act0_roadstops.cpp b/src/newgrf/newgrf_act0_roadstops.cpp index 0fc897b565..d13d74b379 100644 --- a/src/newgrf/newgrf_act0_roadstops.cpp +++ b/src/newgrf/newgrf_act0_roadstops.cpp @@ -49,6 +49,13 @@ static ChangeInfoResult IgnoreRoadStopProperty(uint prop, ByteReader &buf) buf.ReadDWord(); break; + case 0x13: + case 0x14: + buf.ReadWord(); + buf.ReadWord(); + buf.ReadWord(); + break; + case 0x16: // Badge list SkipBadgeList(buf); break; @@ -134,6 +141,18 @@ static ChangeInfoResult RoadStopChangeInfo(uint first, uint last, int prop, Byte rs->flags = static_cast(buf.ReadDWord()); // Future-proofing, size this as 4 bytes, but we only need two byte's worth of flags at present break; + case 0x13: // Bridge height. + for (uint j = 0; j != 6; ++j) { + rs->tilespecs[j].height = buf.ReadByte(); + } + break; + + case 0x14: // Disallow pillars. + for (uint j = 0; j != 6; ++j) { + rs->tilespecs[j].disallowed_pillars = BridgePillarFlags{buf.ReadByte()}; + } + break; + case 0x15: // Cost multipliers rs->build_cost_multiplier = buf.ReadByte(); rs->clear_cost_multiplier = buf.ReadByte(); diff --git a/src/newgrf/newgrf_act0_stations.cpp b/src/newgrf/newgrf_act0_stations.cpp index 38a2df7c05..a06d4c50b1 100644 --- a/src/newgrf/newgrf_act0_stations.cpp +++ b/src/newgrf/newgrf_act0_stations.cpp @@ -268,11 +268,11 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR break; } - case 0x1B: // Minimum bridge height (not implemented) - buf.ReadWord(); - buf.ReadWord(); - buf.ReadWord(); - buf.ReadWord(); + case 0x1B: // Minimum bridge height (old variable) + if (statspec->tilespecs.size() < 8) statspec->tilespecs.resize(8); + for (int j = 0; j < 8; ++j) { + statspec->tilespecs[j].height = buf.ReadByte(); + } break; case 0x1C: // Station Name @@ -296,6 +296,24 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR statspec->badges = ReadBadgeList(buf, GSF_STATIONS); break; + case 0x20: { // Minimum bridge height (extended) + uint16_t tiles = buf.ReadExtendedByte(); + if (statspec->tilespecs.size() < tiles) statspec->tilespecs.resize(tiles); + for (int j = 0; j != tiles; ++j) { + statspec->tilespecs[j].height = buf.ReadByte(); + } + break; + } + + case 0x21: { // Disallowed bridge pillars + uint16_t tiles = buf.ReadExtendedByte(); + if (statspec->tilespecs.size() < tiles) statspec->tilespecs.resize(tiles); + for (int j = 0; j != tiles; ++j) { + statspec->tilespecs[j].disallowed_pillars = BridgePillarFlags{buf.ReadByte()}; + } + break; + } + default: ret = CIR_UNKNOWN; break; diff --git a/src/newgrf_roadstop.h b/src/newgrf_roadstop.h index 690c9adadb..3c4908ed8b 100644 --- a/src/newgrf_roadstop.h +++ b/src/newgrf_roadstop.h @@ -12,6 +12,7 @@ #ifndef NEWGRF_ROADSTATION_H #define NEWGRF_ROADSTATION_H +#include "bridge_type.h" #include "newgrf_animation_type.h" #include "newgrf_spritegroup.h" #include "newgrf_badge_type.h" @@ -138,12 +139,17 @@ struct RoadStopSpec : NewGRFSpecBase { AnimationInfo animation; - uint8_t bridge_height[6]; ///< Minimum height for a bridge above, 0 for none - uint8_t bridge_disallowed_pillars[6]; ///< Disallowed pillar flags for a bridge above + struct TileSpec { + uint8_t height = 0; ///< Minimum height for a bridge above, 0 for none + BridgePillarFlags disallowed_pillars = BRIDGEPILLARFLAGS_ALL; ///< Disallowed pillar flags for a bridge above + }; + std::array tilespecs{}; ///< Per tile information. uint8_t build_cost_multiplier = 16; ///< Build cost multiplier per tile. uint8_t clear_cost_multiplier = 16; ///< Clear cost multiplier per tile. + uint8_t height; ///< The height of this structure, in heightlevels; max MAX_TILE_HEIGHT. + std::vector badges; /** diff --git a/src/newgrf_station.h b/src/newgrf_station.h index 52e0a53200..d99e0a8faf 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -10,6 +10,7 @@ #ifndef NEWGRF_STATION_H #define NEWGRF_STATION_H +#include "bridge_type.h" #include "core/enum_type.hpp" #include "newgrf_animation_type.h" #include "newgrf_badge_type.h" @@ -171,6 +172,8 @@ struct StationSpec : NewGRFSpecBase { struct TileSpec { TileFlags flags{}; ///< Tile flags. + uint8_t height = 0; ///< Minimum height for a bridge above, 0 for none + BridgePillarFlags disallowed_pillars = BRIDGEPILLARFLAGS_ALL; ///< Disallowed pillar flags for a bridge above }; std::vector tilespecs; ///< Per-layout-tile information.