1
0
Fork 0

Codechange: Add bridge pillar exclusion information to stations and roadstops.

pull/14477/head
Peter Nelson 2025-07-24 18:21:11 +01:00
parent 9f29f9fa56
commit 00631729a4
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
4 changed files with 53 additions and 7 deletions

View File

@ -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<RoadStopSpecFlags>(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();

View File

@ -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;

View File

@ -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<RoadStopClassID> {
AnimationInfo<StationAnimationTriggers> 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<TileSpec, 6> 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<BadgeID> badges;
/**

View File

@ -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<StationClassID> {
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<TileSpec> tilespecs; ///< Per-layout-tile information.