12#include "../newgrf_badge.h"
13#include "../newgrf_badge_type.h"
17#include "../safeguards.h"
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.
grffile->badge_map.find(
id);
30 if (prop != 0x08 && it == std::end(_cur.
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 string.
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.
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.
GRFFile * grffile
Currently processed GRF file.