1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-18 18:02:37 +01:00

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

@@ -336,7 +336,7 @@ static void DrawTile_Industry(TileInfo *ti)
* DrawNewIndustry will return false if ever the resolver could not
* find any sprite to display. So in this case, we will jump on the
* substitute gfx instead. */
if (indts->grf_prop.GetSpriteGroup() != nullptr && DrawNewIndustryTile(ti, ind, gfx, indts)) {
if (indts->grf_prop.HasSpriteGroups() && DrawNewIndustryTile(ti, ind, gfx, indts)) {
return;
} else {
/* No sprite group (or no valid one) found, meaning no graphics associated.
@@ -405,7 +405,7 @@ static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh)
*/
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
if (indts->grf_prop.GetSpriteGroup() != nullptr && indts->callback_mask.Test(IndustryTileCallbackMask::DrawFoundations)) {
if (indts->callback_mask.Test(IndustryTileCallbackMask::DrawFoundations)) {
uint32_t callback_res = GetIndustryTileCallback(CBID_INDTILE_DRAW_FOUNDATIONS, 0, 0, gfx, Industry::GetByTile(tile), tile);
if (callback_res != CALLBACK_FAILED && !ConvertBooleanCallback(indts->grf_prop.grffile, CBID_INDTILE_DRAW_FOUNDATIONS, callback_res)) return FOUNDATION_NONE;
}