28 for (
const auto &grm_sprite : _grm_sprites) {
29 if (grm_sprite.first.grfid != _cur_gps.grffile->grfid)
continue;
30 if (grm_sprite.second.first <= first_sprite && grm_sprite.second.first + grm_sprite.second.second >= first_sprite + num_sprites)
return true;
48 for (uint i = 0; i < num_sets; i++) {
49 uint8_t num_sprites = buf.
ReadByte();
50 uint16_t first_sprite = buf.
ReadWord();
52 GrfMsg(2,
"SpriteReplace: [Set {}] Changing {} sprites, beginning with {}",
53 i, num_sprites, first_sprite
59 GrfMsg(0,
"SpriteReplace: [Set {}] Changing {} sprites, beginning with {}, above limit of {} and not within reserved range, ignoring.",
63 first_sprite = _cur_gps.spriteid;
64 _cur_gps.spriteid += num_sprites;
68 for (uint j = 0; j < num_sprites; j++) {
69 SpriteID load_index = first_sprite + j;
75 if (
IsInsideMM(load_index, SPR_ORIGINALSHORE_START, SPR_ORIGINALSHORE_END + 1)) {
87 for (uint i = 0; i < num_sets; i++) {
89 _cur_gps.skip_sprites += buf.
ReadByte();
94 GrfMsg(3,
"SkipActA: Skipping {} sprites", _cur_gps.skip_sprites);
97template <>
void GrfActionHandler<0x0A>::FileScan(
ByteReader &buf) { SkipActA(buf); }
98template <>
void GrfActionHandler<0x0A>::SafetyScan(
ByteReader &buf) { SkipActA(buf); }
99template <>
void GrfActionHandler<0x0A>::LabelScan(
ByteReader &buf) { SkipActA(buf); }
100template <>
void GrfActionHandler<0x0A>::Init(
ByteReader &buf) { SkipActA(buf); }
101template <>
void GrfActionHandler<0x0A>::Reserve(
ByteReader &buf) { SkipActA(buf); }
102template <>
void GrfActionHandler<0x0A>::Activation(
ByteReader &buf) { SpriteReplace(buf); }
Class to read from a NewGRF file.
uint16_t ReadWord()
Read a single Word (16 bits).
uint8_t ReadByte()
Read a single byte (8 bits).
Functions related to debugging.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
constexpr bool IsInsideMM(const size_t x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
GRFLoadedFeatures _loaded_newgrf_features
Indicates which are the newgrf features currently loaded ingame.
@ SHORE_REPLACE_ACTION_A
Shore sprites were replaced by ActionA (using grass tiles for the corner-shores).
@ SHORE_REPLACE_ACTION_5
Shore sprites were replaced by Action5.
static bool IsGRMReservedSprite(SpriteID first_sprite, uint16_t num_sprites)
Check if a sprite ID range is within the GRM reversed range for the currently loading NewGRF.
NewGRF buffer reader definition.
NewGRF internal processing state.
A number of safeguards to prevent using unsafe methods.
bool LoadNextSprite(SpriteID load_index, SpriteFile &file, uint file_sprite_id)
Load a real or recolour sprite.
Functions to cache sprites in memory.
This file contains all sprite-related enums and defines.
static const SpriteID SPR_OPENTTD_BASE
Extra graphic spritenumbers.
Definition of base types and functions in a cross-platform compatible way.