Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef NEWGRF_INDUSTRYTILES_H
00013 #define NEWGRF_INDUSTRYTILES_H
00014
00015 #include "newgrf_animation_type.h"
00016 #include "newgrf_industries.h"
00017 #include "core/random_func.hpp"
00018
00020 struct IndustryTileScopeResolver : public ScopeResolver {
00021 Industry *industry;
00022 TileIndex tile;
00023
00024 IndustryTileScopeResolver(ResolverObject &ro, Industry *industry, TileIndex tile);
00025
00026 uint32 GetRandomBits() const;
00027 uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
00028 uint32 GetTriggers() const;
00029 void SetTriggers(int triggers) const;
00030 };
00031
00033 struct IndustryTileResolverObject : public ResolverObject {
00034 IndustryTileScopeResolver indtile_scope;
00035 IndustriesScopeResolver ind_scope;
00036
00037 IndustryTileResolverObject(IndustryGfx gfx, TileIndex tile, Industry *indus,
00038 CallbackID callback = CBID_NO_CALLBACK, uint32 callback_param1 = 0, uint32 callback_param2 = 0);
00039
00040 ScopeResolver *GetScope(VarSpriteGroupScope scope = VSG_SCOPE_SELF, byte relative = 0)
00041 {
00042 switch (scope) {
00043 case VSG_SCOPE_SELF: return &indtile_scope;
00044 case VSG_SCOPE_PARENT: return &ind_scope;
00045 default: return ResolverObject::GetScope(scope, relative);
00046 }
00047 }
00048 };
00049
00050 bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds);
00051 uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
00052 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);
00053
00054 void AnimateNewIndustryTile(TileIndex tile);
00055 bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32 random = Random());
00056 bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigger iat);
00057
00058
00060 enum IndustryTileTrigger {
00061 INDTILE_TRIGGER_TILE_LOOP = 0x01,
00062 INDUSTRY_TRIGGER_INDUSTRY_TICK = 0x02,
00063 INDUSTRY_TRIGGER_RECEIVED_CARGO = 0x04,
00064 };
00065 void TriggerIndustryTile(TileIndex t, IndustryTileTrigger trigger);
00066 void TriggerIndustry(Industry *ind, IndustryTileTrigger trigger);
00067
00068 #endif