diff options
author | alberth <alberth@openttd.org> | 2012-11-10 20:44:38 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2012-11-10 20:44:38 +0000 |
commit | e087503fd6cf8a461fac7a11bbd9a96f7b4180e7 (patch) | |
tree | 6a7f33f3946faaa6419b068d939a2f0a8a0fb146 /src/newgrf_industrytiles.h | |
parent | f7352871fab18f1517df2c1e08abe13d3caacb96 (diff) | |
download | openttd-e087503fd6cf8a461fac7a11bbd9a96f7b4180e7.tar.xz |
(svn r24690) -Codechange: Add resolver classes for industry tiles.
Diffstat (limited to 'src/newgrf_industrytiles.h')
-rw-r--r-- | src/newgrf_industrytiles.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/newgrf_industrytiles.h b/src/newgrf_industrytiles.h index 3cb1ca828..21bb4cd15 100644 --- 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); |