Difference between revisions of "Callback: Object slope check"

From GRFSpecs
Jump to navigationJump to search
(copy&paste error)
(use new grf templates)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Object slope check (157) ==
 
== Object slope check (157) ==
   
  +
This callback is called for each tile where the new object will be built.
This callback is called for each tile where the new object will be built. For OpenTTD since r22658 allowed return values are like [[Callbacks#Industry_location_permissibility_.2828.29|callback 28]], but with the difference that the meaning of bit 10 is inverted for backwards compatibility. This means that success is 0 instead of 0x400 while custom GRF texts start at 0x400 instead of 0. Return value 1 stands for "Land sloped in wrong direction" instead of "Site unsuitable". Earlier version of OpenTTD and TTDPatch only support 0 for success and 1 for error.
 
  +
 
{{grfTill|7}} For GRF version 7 and below the return values are the same as for [[Callbacks#Industry_location_permissibility_.2828.29|callback 28]], but with bit 10 inverted for backwards compatibility. This means that success is 0 instead of 0x400 while custom GRF texts start at 0x400 instead of 0. Return value 1 stands for "Land sloped in wrong direction" instead of "Site unsuitable".
  +
Note that earlier version of OpenTTD before r22658 and TTDPatch only support 0 for success and 1 for error.
  +
  +
{{grfFrom|8}} For GRF version 8 and above the return values are the same as for [[Callbacks#Industry_location_permissibility_.2828.29|callback 28]]. Return value 401 stands for "Land sloped in wrong direction" instead of "Site unsuitable".
   
 
Since the object isn't built yet, only some variables are available. In OpenTTD these are: 41, 42, 44, 45, 46, 48, 60 - 62 and 64.
 
Since the object isn't built yet, only some variables are available. In OpenTTD these are: 41, 42, 44, 45, 46, 48, 60 - 62 and 64.
Line 9: Line 14:
 
!Bits !! Meaning
 
!Bits !! Meaning
 
|-
 
|-
| 0 - 3 || Relative X position of the tile within the object
+
| 0..3 || Relative X position of the tile within the object
 
|-
 
|-
| 4 - 7 || Relative Y position of the tile within the object
+
| 4..7 || Relative Y position of the tile within the object
 
|-
 
|-
| 8 - 31 || Reserved; must be masked
+
| 8..31 || Reserved; must be masked
 
|}
 
|}
 
* Variable 18:
 
* Variable 18:
Line 19: Line 24:
 
!Bits !! Meaning
 
!Bits !! Meaning
 
|-
 
|-
| 0 - 4 || Slope of the tile
+
| 0..4 || Slope of the tile
 
|-
 
|-
| 5 - 31 || Reserved; must be masked
+
| 5..31 || Reserved; must be masked
 
|}
 
|}
   

Latest revision as of 13:18, 1 April 2012

Object slope check (157)

This callback is called for each tile where the new object will be built.

GRFv≤7 For GRF version 7 and below the return values are the same as for callback 28, but with bit 10 inverted for backwards compatibility. This means that success is 0 instead of 0x400 while custom GRF texts start at 0x400 instead of 0. Return value 1 stands for "Land sloped in wrong direction" instead of "Site unsuitable". Note that earlier version of OpenTTD before r22658 and TTDPatch only support 0 for success and 1 for error.

GRFv≥8 For GRF version 8 and above the return values are the same as for callback 28. Return value 401 stands for "Land sloped in wrong direction" instead of "Site unsuitable".

Since the object isn't built yet, only some variables are available. In OpenTTD these are: 41, 42, 44, 45, 46, 48, 60 - 62 and 64. Additionally you get the following information:

  • Variable 10:
Bits Meaning
0..3 Relative X position of the tile within the object
4..7 Relative Y position of the tile within the object
8..31 Reserved; must be masked
  • Variable 18:
Bits Meaning
0..4 Slope of the tile
5..31 Reserved; must be masked