12#include "../newgrf_engine.h"
13#include "../newgrf_roadstop.h"
18#include "../safeguards.h"
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>();
122 rs->animation.frames = buf.
ReadByte();
127 rs->animation.speed = buf.
ReadByte();
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)) {
167 rs->build_cost_multiplier = buf.
ReadByte();
168 rs->clear_cost_multiplier = buf.
ReadByte();
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(Tindex class_index)
Get a particular class.
static Tindex Allocate(uint32_t global_id)
Allocate a class with a given global class ID.
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.
NewGRF buffer reader definition.
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.
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.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
GRFFile * grffile
Currently processed GRF file.