(svn r26388) -Codechange: Move resolving of Action 3 into ResolverObject constructor.

This commit is contained in:
frosch
2014-03-03 20:02:31 +00:00
parent b0680afaa5
commit ce92faf682
17 changed files with 143 additions and 184 deletions

View File

@@ -147,6 +147,7 @@ IndustryTileResolverObject::IndustryTileResolverObject(IndustryGfx gfx, TileInde
indtile_scope(*this, indus, tile),
ind_scope(*this, tile, indus, indus->type)
{
this->root_spritegroup = GetIndustryTileSpec(gfx)->grf_prop.spritegroup[0];
}
/**
@@ -190,10 +191,7 @@ uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2
assert(industry->index == INVALID_INDUSTRY || IsTileType(tile, MP_INDUSTRY));
IndustryTileResolverObject object(gfx_id, tile, industry, callback, param1, param2);
const SpriteGroup *group = SpriteGroup::Resolve(GetIndustryTileSpec(gfx_id)->grf_prop.spritegroup[0], object);
if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED;
return group->GetCallbackResult();
return object.ResolveCallback();
}
bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds)
@@ -211,7 +209,7 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus
IndustryTileResolverObject object(gfx, ti->tile, i);
const SpriteGroup *group = SpriteGroup::Resolve(inds->grf_prop.spritegroup[0], object);
const SpriteGroup *group = object.Resolve();
if (group == NULL || group->type != SGT_TILELAYOUT) return false;
/* Limit the building stage to the number of stages supplied. */
@@ -328,7 +326,7 @@ static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, I
IndustryTileResolverObject object(gfx, tile, ind, CBID_RANDOM_TRIGGER);
object.trigger = trigger;
const SpriteGroup *group = SpriteGroup::Resolve(itspec->grf_prop.spritegroup[0], object);
const SpriteGroup *group = object.Resolve();
if (group == NULL) return;
byte new_random_bits = Random();