Translations update
[openttd/fttd.git] / src / newgrf_industrytiles.h
blobb2fccc00bb33c7f60eed2a085779c97b100e86fa
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file newgrf_industrytiles.h NewGRF handling of industry tiles. */
12 #ifndef NEWGRF_INDUSTRYTILES_H
13 #define NEWGRF_INDUSTRYTILES_H
15 #include "newgrf_animation_type.h"
16 #include "newgrf_industries.h"
17 #include "core/random_func.hpp"
19 /** Resolver for the industry tiles scope. */
20 struct IndustryTileScopeResolver : public ScopeResolver {
21 const GRFFile *const grffile; ///< GRFFile the resolved SpriteGroup belongs to.
22 Industry *industry; ///< Industry owning the tiles.
23 TileIndex tile; ///< %Tile being resolved.
25 IndustryTileScopeResolver (const GRFFile *grffile, Industry *industry, TileIndex tile);
27 /* virtual */ uint32 GetRandomBits() const;
28 /* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
29 /* virtual */ uint32 GetTriggers() const;
30 /* virtual */ void SetTriggers(int triggers) const;
33 /** Resolver for industry tiles. */
34 struct IndustryTileResolverObject : public ResolverObject {
35 IndustryTileScopeResolver indtile_scope; ///< Scope resolver for the industry tile.
36 IndustriesScopeResolver ind_scope; ///< Scope resolver for the industry owning the tile.
38 const SpriteGroup *root_spritegroup; ///< Root SpriteGroup to use for resolving
40 IndustryTileResolverObject(IndustryGfx gfx, TileIndex tile, Industry *indus,
41 CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
43 /* virtual */ ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
45 switch (scope) {
46 case VSG_SCOPE_SELF: return &indtile_scope;
47 case VSG_SCOPE_PARENT: return &ind_scope;
48 default: return ResolverObject::GetScope(scope, relative);
52 /**
53 * Resolve SpriteGroup.
54 * @return Result spritegroup.
56 const SpriteGroup *Resolve()
58 return SpriteGroup::Resolve (this->root_spritegroup, *this);
62 bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds);
63 uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
64 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);
66 void AnimateNewIndustryTile(TileIndex tile);
67 bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32 random = Random());
68 bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigger iat);
71 /** Available industry tile triggers. */
72 enum IndustryTileTrigger {
73 INDTILE_TRIGGER_TILE_LOOP = 0x01, ///< The tile of the industry has been triggered during the tileloop.
74 INDUSTRY_TRIGGER_INDUSTRY_TICK = 0x02, ///< The industry has been triggered via its tick.
75 INDUSTRY_TRIGGER_RECEIVED_CARGO = 0x04, ///< Cargo has been delivered.
77 void TriggerIndustryTile(TileIndex t, IndustryTileTrigger trigger);
78 void TriggerIndustry(Industry *ind, IndustryTileTrigger trigger);
80 #endif /* NEWGRF_INDUSTRYTILES_H */