74 GrfMsg(1,
"RoadStopChangeInfo: RoadStop {} is invalid, max {}, ignoring", last,
NUM_ROADSTOPS_PER_GRF);
78 if (_cur_gps.grffile->roadstops.size() < last) _cur_gps.grffile->roadstops.resize(last);
80 for (uint
id = first;
id < last; ++id) {
81 auto &rs = _cur_gps.grffile->roadstops[id];
83 if (rs ==
nullptr && prop != 0x08) {
84 GrfMsg(1,
"RoadStopChangeInfo: Attempt to modify undefined road stop {}, ignoring",
id);
86 if (cir > ret) ret = cir;
93 rs = std::make_unique<RoadStopSpec>();
114 rs->draw_mode =
static_cast<RoadStopDrawModes
>(buf.
ReadByte());
122 rs->animation.frames = buf.
ReadByte();
127 rs->animation.speed = buf.
ReadByte();
131 rs->animation.triggers =
static_cast<StationAnimationTriggers
>(buf.
ReadWord());
135 rs->callback_mask =
static_cast<RoadStopCallbackMasks
>(buf.
ReadByte());
139 rs->flags =
static_cast<RoadStopSpecFlags
>(buf.
ReadDWord());
144 for (uint j = 0; j != tiles; ++j) {
145 if (j < std::size(rs->bridgeable_info)) {
146 rs->bridgeable_info[j].height = buf.
ReadByte();
156 for (uint j = 0; j != tiles; ++j) {
157 if (j < std::size(rs->bridgeable_info)) {
158 rs->bridgeable_info[j].disallowed_pillars = BridgePillarFlags{buf.
ReadByte()};
167 rs->build_cost_multiplier = buf.
ReadByte();
168 rs->clear_cost_multiplier = buf.
ReadByte();
185template <>
ChangeInfoResult GrfChangeInfoHandler<GSF_ROADSTOPS>::Activation(uint first, uint last,
int prop,
ByteReader &buf) {
return RoadStopChangeInfo(first, last, prop, buf); }
constexpr enable_if_t< is_integral_v< T >, T > byteswap(T x) noexcept
Custom implementation of std::byteswap; remove once we build with C++23.
Class to read from a NewGRF file.
uint32_t ReadDWord()
Read a single DWord (32 bits).
uint16_t ReadWord()
Read a single Word (16 bits).
uint16_t ReadExtendedByte()
Read a single Extended Byte (8 or 16 bits).
uint8_t ReadByte()
Read a single byte (8 bits).
StringID name
Name of this class.
static NewGRFClass * Get(RoadStopClassID class_index)
static RoadStopClassID Allocate(uint32_t global_id)
Functions related to debugging.
CargoTypes TranslateRefitMask(uint32_t refit_mask)
Translate the refit mask.
std::vector< BadgeID > ReadBadgeList(ByteReader &buf, GrfSpecFeature feature)
Read a list of badges.
void SkipBadgeList(ByteReader &buf)
Skip a list of badges.
static ChangeInfoResult IgnoreRoadStopProperty(uint prop, ByteReader &buf)
Ignore properties for roadstops.
AnimationStatus
Statuses of animation within NewGRFs.
NewGRF buffer reader definition.
Functions for NewGRF engines.
NewGRF internal processing state.
ChangeInfoResult
Possible return values for the GrfChangeInfoHandler functions.
@ CIR_INVALID_ID
Attempt to modify an invalid ID.
@ CIR_UNKNOWN
Variable is unknown.
@ CIR_UNHANDLED
Variable was parsed but unread.
@ CIR_SUCCESS
Variable was parsed and read.
NewGRF definitions and structures for road stops.
RoadStopAvailabilityType
Various different options for availability, restricting the roadstop to be only for busses or for tru...
static const int NUM_ROADSTOPS_PER_GRF
The maximum amount of roadstops a single GRF is allowed to add.
void AddStringForMapping(GRFStringID source, std::function< void(StringID)> &&func)
Record a static StringID for getting translated later.
NewGRF string mapping definition.
StrongType::Typedef< uint32_t, struct GRFStringIDTag, StrongType::Compare, StrongType::Integer > GRFStringID
Type for GRF-internal string IDs.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.