Difference between revisions of "Callback: Industry availability"

From GRFSpecs
Jump to navigationJump to search
m (Create a separate page for each callback)
 
(grf version 8)
Line 3: Line 3:
 
Called when TTDPatch needs to know if a given industry type is available.
 
Called when TTDPatch needs to know if a given industry type is available.
   
Return zero to make your type available, or any nonzero value to disable it. This callback is intended for limiting your type as a whole, so you can't access any industry-specific variables, just the global ones. A good example for the use of this callback is a nuclear power plant that isn't allowed to appear before 1970.
+
This callback is intended for limiting your type as a whole, so you can't access any industry-specific variables, just the global ones. A good example for the use of this callback is a nuclear power plant that isn't allowed to appear before 1970.
  +
  +
{{grf|7}} For GRF version 7 and below the callback should return zero to make your type available, or any nonzero value to disable it.
  +
  +
{{grf|8}} For GRF version 8 and above the callback should return one of these values:
  +
:{| |-
  +
|0000 || Disallow construction
  +
|-
  +
|0001..00FF|| Allow construction, and use the returned value as probability for appearance on the map. (Instead of using [[Action0/Industries#Probability_in_random_game_.2817.29.2C_Probability_during_gameplay_.2818.29|property 18]].)
  +
|-
  +
|0100|| Allow construction; use the appearance probability from [[Action0/Industries#Probability_in_random_game_.2817.29.2C_Probability_during_gameplay_.2818.29|property 18]]
  +
|}
   
 
During this callback, variable 18 (extra callback info 2) can contain the following values:
 
During this callback, variable 18 (extra callback info 2) can contain the following values:

Revision as of 00:04, 9 November 2011

Industry availability (22)

Called when TTDPatch needs to know if a given industry type is available.

This callback is intended for limiting your type as a whole, so you can't access any industry-specific variables, just the global ones. A good example for the use of this callback is a nuclear power plant that isn't allowed to appear before 1970.

GRFv7 For GRF version 7 and below the callback should return zero to make your type available, or any nonzero value to disable it.

GRFv8 For GRF version 8 and above the callback should return one of these values:

0000 Disallow construction
0001..00FF Allow construction, and use the returned value as probability for appearance on the map. (Instead of using property 18.)
0100 Allow construction; use the appearance probability from property 18

During this callback, variable 18 (extra callback info 2) can contain the following values:

Variable 18 Meaning
0 TTD is generating a map and needs to know if your type can appear.
1 TTD decided to build a new random industry during regular gameplay and needs to know if it can choose your type.
2 The user tries to build/prospect for your industry via the new industry window. TTD needs to know if the player is allowed to do this.