diff --git a/src/spritecache.cpp b/src/spritecache.cpp index e191883783..2c26825a82 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -98,20 +98,16 @@ PACK_N(struct SpriteCache { SpriteType type; ///< In some cases a single sprite is misused by two NewGRFs. Once as real sprite and once as recolour sprite. If the recolour sprite gets into the cache it might be drawn as real sprite which causes enormous trouble. - /** - * Bit 0: warned True iff the user has been warned about incorrect use of this sprite. - * Bit 1: has_non_palette True iff there is at least one non-paletter sprite present (such that 32bpp mode can be used). - */ - byte flags; + byte flags; ///< Control flags, see SpriteCacheCtrlFlags void *GetPtr() { return this->buffer.GetPtr(); } SpriteType GetType() const { return this->type; } void SetType(SpriteType type) { this->type = type; } - bool GetWarned() const { return HasBit(this->flags, 0); } - void SetWarned(bool warned) { SB(this->flags, 0, 1, warned ? 1 : 0); } - bool GetHasNonPalette() const { return HasBit(this->flags, 1); } - void SetHasNonPalette(bool non_palette) { SB(this->flags, 1, 1, non_palette ? 1 : 0); } + bool GetWarned() const { return HasBit(this->flags, SCCF_WARNED); } + void SetWarned(bool warned) { SB(this->flags, SCCF_WARNED, 1, warned ? 1 : 0); } + bool GetHasNonPalette() const { return HasBit(this->flags, SCCF_HAS_NON_PALETTE); } + void SetHasNonPalette(bool non_palette) { SB(this->flags, SCCF_HAS_NON_PALETTE, 1, non_palette ? 1 : 0); } }, 4); static std::vector _spritecache; diff --git a/src/spritecache.h b/src/spritecache.h index fdf8c9e97a..155fa27b58 100644 --- a/src/spritecache.h +++ b/src/spritecache.h @@ -22,6 +22,11 @@ struct Sprite { byte data[]; ///< Sprite data. }; +enum SpriteCacheCtrlFlags { + SCCF_WARNED = 0, ///< True iff the user has been warned about incorrect use of this sprite. + SCCF_HAS_NON_PALETTE = 1, ///< True iff there is at least one non-paletter sprite present (such that 32bpp mode can be used). +}; + extern uint _sprite_cache_size; typedef void *AllocatorProc(size_t size);