Codechange: Use GrfSpecFeature type instead of uint8_t. (#14253)

This commit is contained in:
Peter Nelson
2025-05-12 08:44:39 +01:00
committed by GitHub
parent 2516c435b7
commit 0aacd7acb3
16 changed files with 69 additions and 66 deletions
+4 -4
View File
@@ -60,7 +60,7 @@ void MapSpriteMappingRecolour(PalSpriteID *grf_sprite)
* @param[out] max_palette_offset Optionally returns the number of sprites in the spriteset of the palette. (0 if no spritset)
* @return Read TileLayoutFlags.
*/
TileLayoutFlags ReadSpriteLayoutSprite(ByteReader &buf, bool read_flags, bool invert_action1_flag, bool use_cur_spritesets, int feature, PalSpriteID *grf_sprite, uint16_t *max_sprite_offset, uint16_t *max_palette_offset)
TileLayoutFlags ReadSpriteLayoutSprite(ByteReader &buf, bool read_flags, bool invert_action1_flag, bool use_cur_spritesets, GrfSpecFeature feature, PalSpriteID *grf_sprite, uint16_t *max_sprite_offset, uint16_t *max_palette_offset)
{
grf_sprite->sprite = buf.ReadWord();
grf_sprite->pal = buf.ReadWord();
@@ -171,7 +171,7 @@ static void ReadSpriteLayoutRegisters(ByteReader &buf, TileLayoutFlags flags, bo
* @param dts Layout container to output into
* @return True on error (GRF was disabled).
*/
bool ReadSpriteLayout(ByteReader &buf, uint num_building_sprites, bool use_cur_spritesets, uint8_t feature, bool allow_var10, bool no_z_position, NewGRFSpriteLayout *dts)
bool ReadSpriteLayout(ByteReader &buf, uint num_building_sprites, bool use_cur_spritesets, GrfSpecFeature feature, bool allow_var10, bool no_z_position, NewGRFSpriteLayout *dts)
{
bool has_flags = HasBit(num_building_sprites, 6);
ClrBit(num_building_sprites, 6);
@@ -314,7 +314,7 @@ static const SpriteGroup *GetGroupFromGroupID(uint8_t setid, uint8_t type, uint1
* @param spriteid Raw value from the GRF for the new spritegroup; describes either the return value or the referenced spritegroup.
* @return Created spritegroup.
*/
static const SpriteGroup *CreateGroupFromGroupID(uint8_t feature, uint8_t setid, uint8_t type, uint16_t spriteid)
static const SpriteGroup *CreateGroupFromGroupID(GrfSpecFeature feature, uint8_t setid, uint8_t type, uint16_t spriteid)
{
if (HasBit(spriteid, 15)) return GetCallbackResultGroup(spriteid);
@@ -348,7 +348,7 @@ static void NewSpriteGroup(ByteReader &buf)
* V feature-specific-data (huge mess, don't even look it up --pasky) */
const SpriteGroup *act_group = nullptr;
uint8_t feature = buf.ReadByte();
GrfSpecFeature feature{buf.ReadByte()};
if (feature >= GSF_END) {
GrfMsg(1, "NewSpriteGroup: Unsupported feature 0x{:02X}, skipping", feature);
return;