diff --git a/src/newgrf_industrytiles.h b/src/newgrf_industrytiles.h --- a/src/newgrf_industrytiles.h +++ b/src/newgrf_industrytiles.h @@ -16,6 +16,37 @@ #include "newgrf_industries.h" #include "core/random_func.hpp" +struct IndustryTileScopeResolver : public ScopeResolver { + Industry *industry; + TileIndex tile; + + IndustryTileScopeResolver(ResolverObject *ro, Industry *industry, TileIndex tile); + + /* virtual */ uint32 GetRandomBits() const; + /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const; + /* virtual */ uint32 GetTriggers() const; + /* virtual */ void SetTriggers(int triggers) const; +}; + +struct IndustryTileResolverObject : public ResolverObject { + IndustryTileScopeResolver indtile_scope; + IndustriesScopeResolver ind_scope; + + IndustryTileResolverObject(IndustryGfx gfx, TileIndex tile, Industry *indus, + CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0); + + /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0) + { + switch (scope) { + case VSG_SCOPE_SELF: return &indtile_scope; + case VSG_SCOPE_PARENT: return &ind_scope; + default: return &this->default_scope; // XXX ResolverObject::GetScope(scope, relative); + } + } + + /* virtual */ const SpriteGroup *ResolveReal(const RealSpriteGroup *group) const; +}; + bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds); uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile); CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, uint itspec_index, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type);