12#include "../string_func.h"
16#include "../table/strings.h"
18#include "../safeguards.h"
23 uint8_t grf_version = buf.
ReadByte();
29 if (grf_version < 2 || grf_version > 8) {
31 Debug(grf, 0,
"{}: NewGRF \"{}\" (GRFID {:08X}) uses GRF version {}, which is incompatible with this version of OpenTTD.", _cur.
grfconfig->
filename,
StrMakeValid(name), std::byteswap(grfid), grf_version);
63 DisableGrf(STR_NEWGRF_ERROR_MULTIPLE_ACTION_8);
67 if (_cur.
grffile->grfid != grfid) {
68 Debug(grf, 0,
"GRFInfo: GRFID {:08X} in FILESCAN stage does not match GRFID {:08X} in INIT/RESERVE/ACTIVATION stage", std::byteswap(_cur.
grffile->grfid), std::byteswap(grfid));
72 _cur.
grffile->grf_version = version;
debug_inline static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
constexpr Timpl & Set()
Set all bits.
Class to read from a NewGRF file.
uint32_t ReadDWord()
Read a single DWord (32 bits).
std::string_view ReadString()
Read a string.
uint8_t ReadByte()
Read a single byte (8 bits).
#define Debug(category, level, format_string,...)
Output a line of debugging information.
GRFError * DisableGrf(StringID message, GRFConfig *config)
Disable a GRF.
NewGRF buffer reader definition.
@ GCS_INITIALISED
GRF file has been initialised.
@ GCS_UNKNOWN
The status of this grf file is unknown.
@ GCS_ACTIVATED
GRF file has been activated.
@ System
GRF file is an openttd-internal system grf.
@ Invalid
GRF is unusable with this version of OpenTTD.
@ GRFP_USE_MASK
Bitmask to get only the use palette use states.
NewGRF internal processing state.
static void AddGRFTextToList(GRFTextList &list, uint8_t langid, std::string_view text_to_add)
Add a new text to a GRFText list.
static void StrMakeValid(T &dst, const char *str, const char *last, StringValidationSettings settings)
Copies the valid (UTF-8) characters from str up to last to the dst.
uint8_t palette
GRFPalette, bitset.
GRFTextWrapper info
NOSAVE: GRF info (author, copyright, ...) (Action 0x08)
GRFTextWrapper name
NOSAVE: GRF name (Action 0x08)
GRFStatus status
NOSAVE: GRFStatus, enum.
GRFConfigFlags flags
NOSAVE: GCF_Flags, bitset.
std::string filename
Filename - either with or without full path.
GRFIdentifier ident
grfid and md5sum to uniquely identify newgrfs
uint32_t grfid
GRF ID (defined by Action 0x08)
GRFFile * grffile
Currently processed GRF file.
GRFConfig * grfconfig
Config of the currently processed GRF file.
GrfLoadingStage stage
Current loading stage.
int skip_sprites
Number of pseudo sprites to skip before processing the next one. (-1 to skip to end of file)