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/>.
10 /** @file newgrf_industries.h Functions for NewGRF industries. */
12 #ifndef NEWGRF_INDUSTRIES_H
13 #define NEWGRF_INDUSTRIES_H
15 #include "command_type.h"
16 #include "company_type.h"
17 #include "newgrf_spritegroup.h"
19 /** When should the industry(tile) be triggered for random bits? */
20 enum IndustryTrigger
{
21 /** Triggered each tile loop */
22 INDUSTRY_TRIGGER_TILELOOP_PROCESS
= 1,
23 /** Triggered (whole industry) each 256 ticks */
24 INDUSTRY_TRIGGER_256_TICKS
= 2,
25 /** Triggered on cargo delivery */
26 INDUSTRY_TRIGGER_CARGO_DELIVERY
= 4,
29 /** From where is callback CBID_INDUSTRY_AVAILABLE been called */
30 enum IndustryAvailabilityCallType
{
31 IACT_MAPGENERATION
, ///< during random map generation
32 IACT_RANDOMCREATION
, ///< during creation of random ingame industry
33 IACT_USERCREATION
, ///< from the Fund/build window
34 IACT_PROSPECTCREATION
, ///< from the Fund/build using prospecting
37 /* in newgrf_industry.cpp */
38 uint32
IndustryGetVariable(const ResolverObject
*object
, byte variable
, byte parameter
, bool *available
);
39 uint16
GetIndustryCallback(CallbackID callback
, uint32 param1
, uint32 param2
, Industry
*industry
, IndustryType type
, TileIndex tile
);
40 uint32
GetIndustryIDAtOffset(TileIndex new_tile
, const Industry
*i
, uint32 cur_grfid
);
41 void IndustryProductionCallback(Industry
*ind
, int reason
);
42 CommandCost
CheckIfCallBackAllowsCreation(TileIndex tile
, IndustryType type
, uint layout
, uint32 seed
, uint16 initial_random_bits
, Owner founder
, IndustryAvailabilityCallType creation_type
);
43 bool CheckIfCallBackAllowsAvailability(IndustryType type
, IndustryAvailabilityCallType creation_type
);
44 bool IndustryTemporarilyRefusesCargo(Industry
*ind
, CargoID cargo_type
);
46 IndustryType
MapNewGRFIndustryType(IndustryType grf_type
, uint32 grf_id
);
48 /* in newgrf_industrytiles.cpp*/
49 uint32
GetNearbyIndustryTileInformation(byte parameter
, TileIndex tile
, IndustryID index
, bool signed_offsets
= true);
51 #endif /* NEWGRF_INDUSTRIES_H */