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);
59template <>
ChangeInfoResult GrfChangeInfoHandler<GSF_BADGES>::Activation(uint first, uint last,
int prop,
ByteReader &buf) {
return BadgeChangeInfo(first, last, prop, buf); }
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.
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.
A number of safeguards to prevent using unsafe methods.
Definition of base types and functions in a cross-platform compatible way.