2007-06-13 02:29:08 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file newgrf_industrytiles.h NewGRF handling of industry tiles. */
|
2007-06-13 02:29:08 +00:00
|
|
|
|
|
|
|
#ifndef NEWGRF_INDUSTRYTILES_H
|
|
|
|
#define NEWGRF_INDUSTRYTILES_H
|
|
|
|
|
2010-08-26 15:31:40 +00:00
|
|
|
#include "newgrf_animation_type.h"
|
2011-01-22 10:10:03 +00:00
|
|
|
#include "newgrf_industries.h"
|
2010-01-15 16:41:15 +00:00
|
|
|
#include "core/random_func.hpp"
|
|
|
|
|
2012-11-10 20:46:39 +00:00
|
|
|
/** Resolver for the industry tiles scope. */
|
2012-11-10 20:44:38 +00:00
|
|
|
struct IndustryTileScopeResolver : public ScopeResolver {
|
2012-11-10 20:46:39 +00:00
|
|
|
Industry *industry; ///< Industry owning the tiles.
|
|
|
|
TileIndex tile; ///< %Tile being resolved.
|
2012-11-10 20:44:38 +00:00
|
|
|
|
2013-11-24 14:41:19 +00:00
|
|
|
IndustryTileScopeResolver(ResolverObject &ro, Industry *industry, TileIndex tile);
|
2012-11-10 20:44:38 +00:00
|
|
|
|
|
|
|
/* virtual */ uint32 GetRandomBits() const;
|
|
|
|
/* virtual */ uint32 GetVariable(byte variable, uint32 parameter, bool *available) const;
|
|
|
|
/* virtual */ uint32 GetTriggers() const;
|
|
|
|
/* virtual */ void SetTriggers(int triggers) const;
|
|
|
|
};
|
|
|
|
|
2012-11-10 20:46:39 +00:00
|
|
|
/** Resolver for industry tiles. */
|
2012-11-10 20:44:38 +00:00
|
|
|
struct IndustryTileResolverObject : public ResolverObject {
|
2012-11-10 20:46:39 +00:00
|
|
|
IndustryTileScopeResolver indtile_scope; ///< Scope resolver for the industry tile.
|
|
|
|
IndustriesScopeResolver ind_scope; ///< Scope resolver for the industry owning the tile.
|
2012-11-10 20:44:38 +00:00
|
|
|
|
|
|
|
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;
|
2012-11-10 20:45:59 +00:00
|
|
|
default: return ResolverObject::GetScope(scope, relative);
|
2012-11-10 20:44:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2007-06-19 17:33:12 +00:00
|
|
|
bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const IndustryTileSpec *inds);
|
2007-07-25 19:06:29 +00:00
|
|
|
uint16 GetIndustryTileCallback(CallbackID callback, uint32 param1, uint32 param2, IndustryGfx gfx_id, Industry *industry, TileIndex tile);
|
2010-10-16 13:15:54 +00:00
|
|
|
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);
|
2007-06-13 02:29:08 +00:00
|
|
|
|
2007-07-11 15:03:29 +00:00
|
|
|
void AnimateNewIndustryTile(TileIndex tile);
|
|
|
|
bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32 random = Random());
|
|
|
|
bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigger iat);
|
|
|
|
|
2007-11-11 17:56:37 +00:00
|
|
|
|
2010-08-01 17:45:53 +00:00
|
|
|
/** Available industry tile triggers. */
|
2007-11-11 17:56:37 +00:00
|
|
|
enum IndustryTileTrigger {
|
2010-08-01 17:45:53 +00:00
|
|
|
INDTILE_TRIGGER_TILE_LOOP = 0x01, ///< The tile of the industry has been triggered during the tileloop.
|
|
|
|
INDUSTRY_TRIGGER_INDUSTRY_TICK = 0x02, ///< The industry has been triggered via its tick.
|
|
|
|
INDUSTRY_TRIGGER_RECEIVED_CARGO = 0x04, ///< Cargo has been delivered.
|
2007-11-11 17:56:37 +00:00
|
|
|
};
|
|
|
|
void TriggerIndustryTile(TileIndex t, IndustryTileTrigger trigger);
|
|
|
|
void TriggerIndustry(Industry *ind, IndustryTileTrigger trigger);
|
|
|
|
|
2007-06-13 02:29:08 +00:00
|
|
|
#endif /* NEWGRF_INDUSTRYTILES_H */
|