Codechange: Simplify usage of GRFFileProps by adding some common helper methods.

This commit is contained in:
frosch
2025-04-26 21:18:07 +02:00
committed by frosch
parent 46494c6d44
commit b7e7f08f78
12 changed files with 67 additions and 17 deletions

View File

@@ -273,7 +273,7 @@ static void DrawTile_Town(TileInfo *ti)
/* Houses don't necessarily need new graphics. If they don't have a
* spritegroup associated with them, then the sprite for the substitute
* house id is drawn instead. */
if (HouseSpec::Get(house_id)->grf_prop.GetSpriteGroup() != nullptr) {
if (HouseSpec::Get(house_id)->grf_prop.HasSpriteGroups()) {
DrawNewHouseTile(ti, house_id);
return;
} else {
@@ -334,7 +334,7 @@ static Foundation GetFoundation_Town(TileIndex tile, Slope tileh)
*/
if (hid >= NEW_HOUSE_OFFSET) {
const HouseSpec *hs = HouseSpec::Get(hid);
if (hs->grf_prop.GetSpriteGroup() != nullptr && hs->callback_mask.Test(HouseCallbackMask::DrawFoundations)) {
if (hs->callback_mask.Test(HouseCallbackMask::DrawFoundations)) {
uint32_t callback_res = GetHouseCallback(CBID_HOUSE_DRAW_FOUNDATIONS, 0, 0, hid, Town::GetByTile(tile), tile);
if (callback_res != CALLBACK_FAILED && !ConvertBooleanCallback(hs->grf_prop.grffile, CBID_HOUSE_DRAW_FOUNDATIONS, callback_res)) return FOUNDATION_NONE;
}