Difference between revisions of "Callback: Object slope check"

From GRFSpecs
Jump to navigationJump to search
(copy&paste error)
(dots are more common for ranges here)
Line 9: Line 9:
 
!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 19:
 
!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
 
|}
 
|}
   

Revision as of 21:41, 27 August 2011

Object slope check (157)

This callback is called for each tile where the new object will be built. For OpenTTD since r22658 allowed return values are like 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.

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