1
0
Fork 0

Codechange: Add an explicit enum member for the default spritegroup of badges.

pull/14133/head
frosch 2025-04-26 18:45:28 +02:00 committed by frosch
parent 29ceaf0a84
commit 893aa0fb91
3 changed files with 3 additions and 2 deletions

View File

@ -92,6 +92,7 @@ enum GrfSpecFeature : uint8_t {
GSF_BADGES,
GSF_END,
GSF_DEFAULT = GSF_END, ///< Unspecified feature, default badge
GSF_FAKE_TOWNS = GSF_END, ///< Fake town GrfSpecFeature for NewGRF debugging (parent scope)
GSF_FAKE_END, ///< End of the fake features

View File

@ -651,7 +651,7 @@ static void BadgeMapSpriteGroup(ByteReader &buf, uint8_t idcount)
}
auto &badge = *GetBadge(found->second);
badge.grf_prop.SetSpriteGroup(GSF_END, _cur_gps.spritegroups[groupid]);
badge.grf_prop.SetSpriteGroup(GSF_DEFAULT, _cur_gps.spritegroups[groupid]);
badge.grf_prop.SetGRFFile(_cur_gps.grffile);
badge.grf_prop.local_id = local_id;
}

View File

@ -204,7 +204,7 @@ BadgeResolverObject::BadgeResolverObject(const Badge &badge, GrfSpecFeature feat
{
assert(feature <= GSF_END);
this->root_spritegroup = this->self_scope.badge.grf_prop.GetSpriteGroup(feature);
if (this->root_spritegroup == nullptr) this->root_spritegroup = this->self_scope.badge.grf_prop.GetSpriteGroup(GSF_END);
if (this->root_spritegroup == nullptr) this->root_spritegroup = this->self_scope.badge.grf_prop.GetSpriteGroup(GSF_DEFAULT);
}
/**