Difference between revisions of "Callback: Industry availability"

From GRFSpecs
Jump to navigationJump to search
(grf version 8)
(use new grf templates)
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
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.
+
{{grfTill|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:
+
{{grfFrom|8}} For GRF version 8 and above the callback should return one of these values:
 
:{| |-
 
:{| |-
 
|0000 || Disallow construction
 
|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]].)
+
|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 17 or 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]]
+
|0100|| Allow construction; use the appearance probability from [[Action0/Industries#Probability_in_random_game_.2817.29.2C_Probability_during_gameplay_.2818.29|property 17 resp. 18]].
 
|}
 
|}
   

Latest revision as of 13:25, 1 April 2012

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.

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

GRFv≥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 property 17 or 18.)
0100 Allow construction; use the appearance probability from property 17 resp. 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.