23 if (last >= UINT16_MAX) {
24 GrfMsg(1,
"BadgeChangeInfo: Tag {} is invalid, max {}, ignoring", last, UINT16_MAX - 1);
28 for (uint
id = first;
id < last; ++id) {
29 auto it = _cur_gps.grffile->badge_map.find(
id);
30 if (prop != 0x08 && it == std::end(_cur_gps.grffile->badge_map)) {
31 GrfMsg(1,
"BadgeChangeInfo: Attempt to modify undefined tag {}, ignoring",
id);
35 Badge *badge =
nullptr;
36 if (prop != 0x08) badge =
GetBadge(it->second);
BadgeID index
Index assigned to badge.
BadgeFlags flags
Display flags.
Class to read from a NewGRF file.
uint32_t ReadDWord()
Read a single DWord (32 bits).
std::string_view ReadString()
Read a NUL-terminated string.
Functions related to debugging.
Badge * GetBadge(BadgeID index)
Get a badge if it exists.
Badge & GetOrCreateBadge(std::string_view label)
Register a badge label and return its global index.
Functions related to NewGRF badges.
Types related to NewGRF badges.
EnumBitSet< BadgeFlag, uint8_t > BadgeFlags
Bitset of BridgeFlag elements.
NewGRF buffer reader definition.
NewGRF internal processing state.
ChangeInfoResult
Possible return values for the GrfChangeInfoHandler functions.
@ Success
Variable was parsed and read.
@ Unhandled
Variable was parsed but unread.
@ Unknown
Variable is unknown.
@ InvalidId
Attempt to modify an invalid ID.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.
static ChangeInfoResult Reserve(uint first, uint last, int prop, ByteReader &buf)
Implementation of the GrfLoadingStage::Reserve stage of this feature.
static ChangeInfoResult Activation(uint first, uint last, int prop, ByteReader &buf)
Implementation of the GrfLoadingStage::Activation stage of this feature.