|
OpenTTD Source
14.0-beta1
|
Go to the documentation of this file.
10 #ifndef NEWGRF_INDUSTRIES_H
11 #define NEWGRF_INDUSTRIES_H
36 uint32_t
GetVariable(
byte variable, [[maybe_unused]] uint32_t parameter,
bool *available)
const override;
38 void StorePSA(uint pos, int32_t value)
override;
58 if (tsr !=
nullptr)
return tsr;
void StorePSA(uint pos, int32_t value) override
Store a value into the persistent storage area (PSA).
@ INDUSTRY_TRIGGER_CARGO_DELIVERY
Triggered on cargo delivery.
IndustriesResolverObject(TileIndex tile, Industry *indus, IndustryType type, uint32_t random_bits=0, CallbackID callback=CBID_NO_CALLBACK, uint32_t callback_param1=0, uint32_t callback_param2=0)
Constructor of the industries resolver.
TileIndex tile
Tile owned by the industry.
uint32_t GetRandomBits() const override
Get a few random bits.
TownScopeResolver * GetTown()
Get or create the town scope object associated with the industry.
IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32_t grf_id)
Map the GRF local type to an industry type.
uint32_t GetTriggers() const override
Get the triggers.
@ IACT_RANDOMCREATION
during creation of random ingame industry
Interface for SpriteGroup-s to access the gamestate.
Industry * industry
Industry being resolved.
GrfSpecFeature GetFeature() const override
Get the feature number being resolved for.
uint32_t random_bits
Random bits of the new industry.
TownScopeResolver * town_scope
Scope resolver for the associated town (if needed and available, else nullptr).
CallbackID
List of implemented NewGRF callbacks.
@ INDUSTRY_TRIGGER_TILELOOP_PROCESS
Triggered each tile loop.
@ VSG_SCOPE_PARENT
Related object of the resolved one.
Defines the internal data of a functional industry.
uint32_t GetIndustryProbabilityCallback(IndustryType type, IndustryAvailabilityCallType creation_type, uint32_t default_prob)
Check with callback CBID_INDUSTRY_PROBABILITY whether the industry can be built.
Owner
Enum for all companies/owners.
Interface to query and set values specific to a single VarSpriteGroupScope (action 2 scope).
@ VSG_SCOPE_SELF
Resolved object itself.
uint32_t GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index, bool signed_offsets, bool grf_version8)
Based on newhouses equivalent, but adapted for newindustries.
Common return value for all commands.
@ CBID_NO_CALLBACK
Set when using the callback resolve system, but not to resolve a callback.
uint16_t GetIndustryCallback(CallbackID callback, uint32_t param1, uint32_t param2, Industry *industry, IndustryType type, TileIndex tile)
Perform an industry callback.
Resolver for industry scopes.
bool IndustryTemporarilyRefusesCargo(Industry *ind, CargoID cargo_type)
Check whether an industry temporarily refuses to accept a certain cargo.
virtual ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0)
Get a resolver for the scope.
Scope resolver for a town.
IndustryAvailabilityCallType
From where has callback CBID_INDUSTRY_PROBABILITY been called.
@ IACT_PROSPECTCREATION
from the Fund/build using prospecting
@ IACT_USERCREATION
from the Fund/build window
IndustriesScopeResolver(ResolverObject &ro, TileIndex tile, Industry *industry, IndustryType type, uint32_t random_bits=0)
Scope resolver for industries.
@ INDUSTRY_TRIGGER_256_TICKS
Triggered (whole industry) each 256 ticks.
uint32_t callback_param2
Second parameter (var 18) of the callback.
@ IACT_MAPGENERATION
during random map generation
CallbackID callback
Callback being resolved.
uint32_t callback_param1
First parameter (var 10) of the callback.
IndustryType type
Type of the industry.
void IndustryProductionCallback(Industry *ind, int reason)
Get the industry production callback and apply it to the industry.
uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override
Get a variable value.
IndustryTrigger
When should the industry(tile) be triggered for random bits?
ScopeResolver * GetScope(VarSpriteGroupScope scope=VSG_SCOPE_SELF, byte relative=0) override
Get a resolver for the scope.
byte CargoID
Cargo slots to indicate a cargo type within a game.
ResolverObject & ro
Surrounding resolver object.
uint32_t GetDebugID() const override
Get an identifier for the item being resolved.
uint32_t GetIndustryIDAtOffset(TileIndex new_tile, const Industry *i, uint32_t cur_grfid)
Make an analysis of a tile and check for its belonging to the same industry, and/or the same grf file...
IndustriesScopeResolver industries_scope
Scope resolver for the industry.
CommandCost CheckIfCallBackAllowsCreation(TileIndex tile, IndustryType type, size_t layout, uint32_t seed, uint16_t initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type)
Check that the industry callback allows creation of the industry.