diff options
author | rubidium <rubidium@openttd.org> | 2009-05-23 12:13:42 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-05-23 12:13:42 +0000 |
commit | f490394aa8d78f4118e73beccc724cbad3b44854 (patch) | |
tree | 066d0254c6624bdb2646e30d9b43076fc7de6726 /src/newgrf_industrytiles.cpp | |
parent | b270ca84ba0002ae23aed3bb614e06b19c7197f5 (diff) | |
download | openttd-f490394aa8d78f4118e73beccc724cbad3b44854.tar.xz |
(svn r16396) -Codechange: split NewGRF spritegroup into multiple subclasses instead of using a big union
Diffstat (limited to 'src/newgrf_industrytiles.cpp')
-rw-r--r-- | src/newgrf_industrytiles.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index 34d41667c..86a6a8222 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -105,7 +105,7 @@ static uint32 IndustryTileGetVariable(const ResolverObject *object, byte variabl return UINT_MAX; } -static const SpriteGroup *IndustryTileResolveReal(const ResolverObject *object, const SpriteGroup *group) +static const SpriteGroup *IndustryTileResolveReal(const ResolverObject *object, const RealSpriteGroup *group) { /* IndustryTile do not have 'real' groups. Or do they?? */ return NULL; @@ -163,9 +163,9 @@ static void NewIndustryTileResolver(ResolverObject *res, IndustryGfx gfx, TileIn res->grffile = (its != NULL ? its->grf_prop.grffile : NULL); } -static void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte rnd_colour, byte stage, IndustryGfx gfx) +static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage, IndustryGfx gfx) { - const DrawTileSprites *dts = group->g.layout.dts; + const DrawTileSprites *dts = group->dts; const DrawTileSeqStruct *dtss; SpriteID image = dts->ground.sprite; @@ -224,7 +224,7 @@ uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2 group = Resolve(GetIndustryTileSpec(gfx_id)->grf_prop.spritegroup, &object); if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED; - return group->g.callback.result; + return group->GetCallbackResult(); } bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds) @@ -249,10 +249,11 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus if (group == NULL || group->type != SGT_TILELAYOUT) { return false; } else { + const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; /* Limit the building stage to the number of stages supplied. */ byte stage = GetIndustryConstructionStage(ti->tile); - stage = Clamp(stage - 4 + group->g.layout.num_sprites, 0, group->g.layout.num_sprites - 1); - IndustryDrawTileLayout(ti, group, i->random_colour, stage, gfx); + stage = Clamp(stage - 4 + tlgroup->num_sprites, 0, tlgroup->num_sprites - 1); + IndustryDrawTileLayout(ti, tlgroup, i->random_colour, stage, gfx); return true; } } |