12#include "../newgrf_engine.h"
13#include "../newgrf_roadstop.h"
18#include "../safeguards.h"
69 GrfMsg(1,
"RoadStopChangeInfo: RoadStop {} is invalid, max {}, ignoring", last,
NUM_ROADSTOPS_PER_GRF);
73 if (_cur_gps.
grffile->roadstops.size() < last) _cur_gps.
grffile->roadstops.resize(last);
75 for (uint
id = first;
id < last; ++id) {
76 auto &rs = _cur_gps.
grffile->roadstops[id];
78 if (rs ==
nullptr && prop != 0x08) {
79 GrfMsg(1,
"RoadStopChangeInfo: Attempt to modify undefined road stop {}, ignoring",
id);
81 if (cir > ret) ret = cir;
88 rs = std::make_unique<RoadStopSpec>();
117 rs->animation.frames = buf.
ReadByte();
122 rs->animation.speed = buf.
ReadByte();
138 rs->build_cost_multiplier = buf.
ReadByte();
139 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).
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.