Callback: Object slope check

From GRFSpecs
Jump to navigationJump to search

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