mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Add bridge pillar exclusion information to stations and roadstops.
parent
9f29f9fa56
commit
00631729a4
|
@ -49,6 +49,13 @@ static ChangeInfoResult IgnoreRoadStopProperty(uint prop, ByteReader &buf)
|
||||||
buf.ReadDWord();
|
buf.ReadDWord();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x13:
|
||||||
|
case 0x14:
|
||||||
|
buf.ReadWord();
|
||||||
|
buf.ReadWord();
|
||||||
|
buf.ReadWord();
|
||||||
|
break;
|
||||||
|
|
||||||
case 0x16: // Badge list
|
case 0x16: // Badge list
|
||||||
SkipBadgeList(buf);
|
SkipBadgeList(buf);
|
||||||
break;
|
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
|
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;
|
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
|
case 0x15: // Cost multipliers
|
||||||
rs->build_cost_multiplier = buf.ReadByte();
|
rs->build_cost_multiplier = buf.ReadByte();
|
||||||
rs->clear_cost_multiplier = buf.ReadByte();
|
rs->clear_cost_multiplier = buf.ReadByte();
|
||||||
|
|
|
@ -268,11 +268,11 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x1B: // Minimum bridge height (not implemented)
|
case 0x1B: // Minimum bridge height (old variable)
|
||||||
buf.ReadWord();
|
if (statspec->tilespecs.size() < 8) statspec->tilespecs.resize(8);
|
||||||
buf.ReadWord();
|
for (int j = 0; j < 8; ++j) {
|
||||||
buf.ReadWord();
|
statspec->tilespecs[j].height = buf.ReadByte();
|
||||||
buf.ReadWord();
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x1C: // Station Name
|
case 0x1C: // Station Name
|
||||||
|
@ -296,6 +296,24 @@ static ChangeInfoResult StationChangeInfo(uint first, uint last, int prop, ByteR
|
||||||
statspec->badges = ReadBadgeList(buf, GSF_STATIONS);
|
statspec->badges = ReadBadgeList(buf, GSF_STATIONS);
|
||||||
break;
|
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:
|
default:
|
||||||
ret = CIR_UNKNOWN;
|
ret = CIR_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#ifndef NEWGRF_ROADSTATION_H
|
#ifndef NEWGRF_ROADSTATION_H
|
||||||
#define NEWGRF_ROADSTATION_H
|
#define NEWGRF_ROADSTATION_H
|
||||||
|
|
||||||
|
#include "bridge_type.h"
|
||||||
#include "newgrf_animation_type.h"
|
#include "newgrf_animation_type.h"
|
||||||
#include "newgrf_spritegroup.h"
|
#include "newgrf_spritegroup.h"
|
||||||
#include "newgrf_badge_type.h"
|
#include "newgrf_badge_type.h"
|
||||||
|
@ -138,12 +139,17 @@ struct RoadStopSpec : NewGRFSpecBase<RoadStopClassID> {
|
||||||
|
|
||||||
AnimationInfo<StationAnimationTriggers> animation;
|
AnimationInfo<StationAnimationTriggers> animation;
|
||||||
|
|
||||||
uint8_t bridge_height[6]; ///< Minimum height for a bridge above, 0 for none
|
struct TileSpec {
|
||||||
uint8_t bridge_disallowed_pillars[6]; ///< Disallowed pillar flags for a bridge above
|
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 build_cost_multiplier = 16; ///< Build cost multiplier per tile.
|
||||||
uint8_t clear_cost_multiplier = 16; ///< Clear 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;
|
std::vector<BadgeID> badges;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#ifndef NEWGRF_STATION_H
|
#ifndef NEWGRF_STATION_H
|
||||||
#define NEWGRF_STATION_H
|
#define NEWGRF_STATION_H
|
||||||
|
|
||||||
|
#include "bridge_type.h"
|
||||||
#include "core/enum_type.hpp"
|
#include "core/enum_type.hpp"
|
||||||
#include "newgrf_animation_type.h"
|
#include "newgrf_animation_type.h"
|
||||||
#include "newgrf_badge_type.h"
|
#include "newgrf_badge_type.h"
|
||||||
|
@ -171,6 +172,8 @@ struct StationSpec : NewGRFSpecBase<StationClassID> {
|
||||||
|
|
||||||
struct TileSpec {
|
struct TileSpec {
|
||||||
TileFlags flags{}; ///< Tile flags.
|
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.
|
std::vector<TileSpec> tilespecs; ///< Per-layout-tile information.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue