<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://newgrf-specs.tt-wiki.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Frosch</id>
	<title>GRFSpecs - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://newgrf-specs.tt-wiki.net/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Frosch"/>
	<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/wiki/Special:Contributions/Frosch"/>
	<updated>2026-04-20T09:52:57Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Industry_location_permissibility&amp;diff=5034</id>
		<title>Callback: Industry location permissibility</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Industry_location_permissibility&amp;diff=5034"/>
		<updated>2025-05-13T14:13:02Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Industry location permissibility (28) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Industry location permissibility (28) ==&lt;br /&gt;
&lt;br /&gt;
Called to decide if the industry can be built on a given spot. Since the industry isn&#039;t built yet, you can only use a small subset of the data: you can access the data of the nearest town via action 2/type 82 without any problems, but action 2/type 81 will access different variables than it would normally access:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Variable!![[GRFActionsDetailed|Size]]!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|40+x|| ||{{ottdp| | }}||Not accessible&lt;br /&gt;
|-&lt;br /&gt;
|5F|| ||{{ottdp|1.1|no|ottdrev=19744}}||Random bits the industry starts with after construction. Accessible via RandomAction2 as well.&lt;br /&gt;
|-&lt;br /&gt;
|60+x|| ||{{ottdp| | }}||Only var. 62 and vars 64..68 can be used&lt;br /&gt;
|-&lt;br /&gt;
|80||W||{{ottdp| | }}||Coordinates of the selected position&lt;br /&gt;
|-&lt;br /&gt;
|86||B||{{ottdp| | }}||Number of the selected layout, according to property 0A&lt;br /&gt;
|-&lt;br /&gt;
|87||B||{{ottdp| | }}||Ground type of the selected spot (see [[VarAction2Canals|canal variable 81]] for details)&lt;br /&gt;
|-&lt;br /&gt;
|88||B||{{ottdp| | }}||[[TownZones|Town zone]] of the selected spot (see [[VarAction2Houses#Town zone 42|house variable 42]] for details)&lt;br /&gt;
|-&lt;br /&gt;
|89||B||{{ottdp| | }}||Distance between the closest town and the selected position.&lt;br /&gt;
|-&lt;br /&gt;
|8A||B||{{ottdp| | }}||Height of the lowest corner of the tile&lt;br /&gt;
* {{grfTill|7}} For GRF version 7 and below: Multiple of 8.&lt;br /&gt;
* {{grfFrom|8}} For GRF version 8 and above: Multiple of 1.&lt;br /&gt;
|-&lt;br /&gt;
|8B||W||{{ottdp| | }}||Distance to the closest water tile if property 1A bit 2 is clear (built on land); distance to the closest empty dry land tile if property 1A bit 2 is clear (built on water)&lt;br /&gt;
|-&lt;br /&gt;
|8D||W||{{ottdp| | }}||Square of the Euclidean distance between the closest town and the selected position&lt;br /&gt;
|-&lt;br /&gt;
|8F||D||{{ottdp|0.6|2.6|ottdrev=r11985|ttdprev=r1816}}|| 32 random bits&lt;br /&gt;
|}&lt;br /&gt;
Unless explicitly noted, distances are Manhattan distance, not Euclidean distance, ie. &amp;lt;tt&amp;gt;|x-x0|+|y-y0|&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;sqrt((x-x0)^2+(y-y0)^2)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variable 8B will always be below 80h if prop 1A bit 2 is clear. If bit 2 is set, 8B will be set to its max of 200h in the pathological case of an all-water map.&lt;br /&gt;
&lt;br /&gt;
{{ottd|1.1|r20942}} During this callback, variable 18 (extra callback info 2) contains the following values for OpenTTD r20942 and later:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Variable 18!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||TTD is generating a map.&lt;br /&gt;
|-&lt;br /&gt;
|1||TTD decided to build a new random industry during regular gameplay.&lt;br /&gt;
|-&lt;br /&gt;
|2||The user tries to build your industry via the new industry window.&lt;br /&gt;
|-&lt;br /&gt;
|3||The user tries to prospect for your industry via the new industry window.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This callback must return a 15-bit value, which is interpreted as follows:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000-03ff||{{ottdp| | }}||Industry can&#039;t be built, display the misc. GRF text D0xx as error message&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{ottdp| | }}||Industry can be built&lt;br /&gt;
|-&lt;br /&gt;
|0401||{{ottdp| | }}||Industry can&#039;t be built, display the default &amp;quot;site unsuitable&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0402||{{ottdp| | }}||Industry can&#039;t be built, display the &amp;quot;...can only be built in rainforest areas&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0403||{{ottdp| | }}||Industry can&#039;t be built, display the &amp;quot;...can only be built in desert areas&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0404||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can only be built above the snow-line&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0405||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can only be built below the snow-line&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0406||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can&#039;t build on open sea&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0407||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can&#039;t build on canal&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0408||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can&#039;t build on river&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Industry can&#039;t be built. Display error message using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6-14|2.6|ttdprev=r1755}} Since TTDPatch r1755, you can use the text reference stack for your error messages, similarly to callback 3A. The only difference is that only 4 registers are copied instead of 6 because error messages support 20 bytes of reference stack only, and two of those bytes may be used by TTD.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15|no}} The contents of registers 100h..10Fh are copied onto the text reference stack.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Additional_text_in_purchase_screen&amp;diff=5033</id>
		<title>Callback: Additional text in purchase screen</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Additional_text_in_purchase_screen&amp;diff=5033"/>
		<updated>2025-05-13T14:12:42Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Additional text in purchase screen (23) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Additional text in purchase screen (23) ==&lt;br /&gt;
&lt;br /&gt;
This callback can be used to append text below the vehicle information in the purchase screen. The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Return value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..03FF|| ||D0xx text to display. {{ttdp|}} Before r1908 only text IDs D000..D0FF were supported.&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{grfFrom|8}}||Display no text (same as callback failure).&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.2-14|no|ottdrev=r23045}} Since OpenTTD r23045 the contents of registers 100h..105h are copied onto the text reference stack.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15|no}} The contents of registers 100h..10Fh are copied onto the text reference stack.&lt;br /&gt;
&lt;br /&gt;
Lines are wrapped automatically, or may be broken explicitly using the newline character 0D. How many lines are available depends on the type of vehicle and its other properties, for instance the presence or absence of a &amp;quot;refittable to&amp;quot; line or powered wagons etc. &lt;br /&gt;
&lt;br /&gt;
If cargo FF (buy menu sprite) is handled explicitly for a vehicle, then the varaction 2 handling [[Callbacks#Additional text in purchase screen (23) |callback 23]] must be in the buy menu varaction 2 chain.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example for setting additional text for a road vehicle:&lt;br /&gt;
&lt;br /&gt;
 // Define string with ID D001 for featur 01. Bit 7 of the language byte must be set to 1, because the string ID is a word.&lt;br /&gt;
 4 * 32 04 01 83 01 \wxD001 &amp;quot;Hint: This is a &amp;quot; 0D &amp;quot;new line.&amp;quot; 00&lt;br /&gt;
 // The callback&lt;br /&gt;
 5 * 14 02 01 10 85 0C 00 \wxFFFF 01 \wx8001 \wx23 \wx23 02 00&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Can_wagon_be_attached&amp;diff=5032</id>
		<title>Callback: Can wagon be attached</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Can_wagon_be_attached&amp;diff=5032"/>
		<updated>2025-05-13T14:08:28Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Can wagon be attached (1D) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Can wagon be attached (1D) ==&lt;br /&gt;
&lt;br /&gt;
This callback is called for the train engine (i.e. from the engine&#039;s action 3) when attaching a new vehicle to the current train and determines whether it may in fact be attached to the train. The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.&lt;br /&gt;
&lt;br /&gt;
You may use VarAction2s to check variables 40+x and 80+x. For var. action 2 type 81 (vehicle), they refer to variables of the wagon that is to be attached, not the engine it is being attached to, so you can check the wagon&#039;s properties like the cargo type to see whether it is appropriate for the given train engine.&lt;br /&gt;
&lt;br /&gt;
{{ottdp| |2.5|ttdprev=alpha 46}} Var. action 2 type 82 (engine) refers to the engine the wagon is being attached to, starting from version TTDPatch 2.0.1 alpha 46. This allows you to for example find out the length of the train it is being attached to. In earlier patch versions, it refers to the engine of the source consist (or the wagon if the wagon is not attached to anything else), which was not really helpful.&lt;br /&gt;
&lt;br /&gt;
So, overall the callback is evaluated this way:&lt;br /&gt;
* The Action 3 is used from the regular engine (livery overrides have no influence).&lt;br /&gt;
* The cargotype to use in Action 3 is taken from the wagon.&lt;br /&gt;
* VarAction2 types 81, 85, 89 refer to the wagon.&lt;br /&gt;
* VarAction2 types 82, 85, 8A refer to the engine.&lt;br /&gt;
&lt;br /&gt;
{{grfTill|7}} For GRF version 7 and below the valid return values are:&lt;br /&gt;
{| |-&lt;br /&gt;
!Return!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00..FC||Disallow attaching and use the D0xx (D000..D0FC) text ID as second line of an error message,&lt;br /&gt;
|-&lt;br /&gt;
|FD||Disallow attaching with the standard message (incompatible rail types)&lt;br /&gt;
|-&lt;br /&gt;
|FE||Allow attaching&amp;lt;ref name=&amp;quot;ignorerailtype&amp;quot;&amp;gt;This mean you would allow attaching for example a monorail wagon to a regular rail vehicle.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|FF||Allow attaching if the rail types match (default)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|8}} For GRF version 8 and above the valid return values are:&lt;br /&gt;
{| |-&lt;br /&gt;
!Return!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00..3FF||Disallow attaching and use the D0xx (D000..D3FF) text ID as second line of an error message,&lt;br /&gt;
|-&lt;br /&gt;
|400||Allow attaching if the rail types match (default)&lt;br /&gt;
|-&lt;br /&gt;
|401||Allow attaching&amp;lt;ref name=&amp;quot;ignorerailtype&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|402||Disallow attaching with the standard message (incompatible rail types)&lt;br /&gt;
|-&lt;br /&gt;
|40F||{{ottdp|15|no}} Disallow attaching and display error message using text ID from register 0x100 (not limited to D0xx texts).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Cargo_Subtype_Display&amp;diff=5031</id>
		<title>Callback: Cargo Subtype Display</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Cargo_Subtype_Display&amp;diff=5031"/>
		<updated>2025-05-13T14:06:19Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Cargo Subtype Display (19) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Cargo Subtype Display (19) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;NOTE: As of OpenTTD 13, this feature is considered deprecated for most uses. Use variants instead.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This callback allows you to display some text after the cargo name when refitting, and in the vehicle capacity display. This is useful to distinguish several subtypes of a certain cargo, e.g. goods could be cars, petroleum, sheet metal etc.&lt;br /&gt;
&lt;br /&gt;
The return value must be the number of a D0xx string set by an action 4 in the same .grf file. &amp;amp;nbsp;For example, if you set text ID D006 to some text, return 06 in this callback will make it displayed after the cargo name.&lt;br /&gt;
&lt;br /&gt;
Normally, you would use the vehicle refit cycle/sub type variable F2 to distinguish the various subtypes. &amp;amp;nbsp;During refitting, the callback is called with successively increased values of variable F2, until the callback says to stop. &amp;amp;nbsp;All the returned variations are then displayed as refitting options, with all options that have the same cargo type and callback result (irrespective of refit cycle) grouped together in the same line.&lt;br /&gt;
&lt;br /&gt;
{{grfTill|7}} For GRF version 7 and below the valid return values are:&lt;br /&gt;
{| |-&lt;br /&gt;
|00..FE|| Use subtype from text D0xx (D000..D0FE)&lt;br /&gt;
|-&lt;br /&gt;
|FF|| Stop calling.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|8}} For GRF version 8 and above the valid return values are:&lt;br /&gt;
{| |-&lt;br /&gt;
|00..3FF|| Use subtype from text D0xx (D000..D3FF)&lt;br /&gt;
|-&lt;br /&gt;
|400|| Stop calling.&lt;br /&gt;
|-&lt;br /&gt;
|40F|| {{ottdp|15|no}} Use subtype with text ID from register 0x100 (not limited to D0xx texts).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Industry_location_permissibility&amp;diff=5030</id>
		<title>Callback: Industry location permissibility</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Industry_location_permissibility&amp;diff=5030"/>
		<updated>2025-05-13T14:04:20Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Industry location permissibility (28) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Industry location permissibility (28) ==&lt;br /&gt;
&lt;br /&gt;
Called to decide if the industry can be built on a given spot. Since the industry isn&#039;t built yet, you can only use a small subset of the data: you can access the data of the nearest town via action 2/type 82 without any problems, but action 2/type 81 will access different variables than it would normally access:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Variable!![[GRFActionsDetailed|Size]]!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|40+x|| ||{{ottdp| | }}||Not accessible&lt;br /&gt;
|-&lt;br /&gt;
|5F|| ||{{ottdp|1.1|no|ottdrev=19744}}||Random bits the industry starts with after construction. Accessible via RandomAction2 as well.&lt;br /&gt;
|-&lt;br /&gt;
|60+x|| ||{{ottdp| | }}||Only var. 62 and vars 64..68 can be used&lt;br /&gt;
|-&lt;br /&gt;
|80||W||{{ottdp| | }}||Coordinates of the selected position&lt;br /&gt;
|-&lt;br /&gt;
|86||B||{{ottdp| | }}||Number of the selected layout, according to property 0A&lt;br /&gt;
|-&lt;br /&gt;
|87||B||{{ottdp| | }}||Ground type of the selected spot (see [[VarAction2Canals|canal variable 81]] for details)&lt;br /&gt;
|-&lt;br /&gt;
|88||B||{{ottdp| | }}||[[TownZones|Town zone]] of the selected spot (see [[VarAction2Houses#Town zone 42|house variable 42]] for details)&lt;br /&gt;
|-&lt;br /&gt;
|89||B||{{ottdp| | }}||Distance between the closest town and the selected position.&lt;br /&gt;
|-&lt;br /&gt;
|8A||B||{{ottdp| | }}||Height of the lowest corner of the tile&lt;br /&gt;
* {{grfTill|7}} For GRF version 7 and below: Multiple of 8.&lt;br /&gt;
* {{grfFrom|8}} For GRF version 8 and above: Multiple of 1.&lt;br /&gt;
|-&lt;br /&gt;
|8B||W||{{ottdp| | }}||Distance to the closest water tile if property 1A bit 2 is clear (built on land); distance to the closest empty dry land tile if property 1A bit 2 is clear (built on water)&lt;br /&gt;
|-&lt;br /&gt;
|8D||W||{{ottdp| | }}||Square of the Euclidean distance between the closest town and the selected position&lt;br /&gt;
|-&lt;br /&gt;
|8F||D||{{ottdp|0.6|2.6|ottdrev=r11985|ttdprev=r1816}}|| 32 random bits&lt;br /&gt;
|}&lt;br /&gt;
Unless explicitly noted, distances are Manhattan distance, not Euclidean distance, ie. &amp;lt;tt&amp;gt;|x-x0|+|y-y0|&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;sqrt((x-x0)^2+(y-y0)^2)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Variable 8B will always be below 80h if prop 1A bit 2 is clear. If bit 2 is set, 8B will be set to its max of 200h in the pathological case of an all-water map.&lt;br /&gt;
&lt;br /&gt;
{{ottd|1.1|r20942}} During this callback, variable 18 (extra callback info 2) contains the following values for OpenTTD r20942 and later:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Variable 18!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||TTD is generating a map.&lt;br /&gt;
|-&lt;br /&gt;
|1||TTD decided to build a new random industry during regular gameplay.&lt;br /&gt;
|-&lt;br /&gt;
|2||The user tries to build your industry via the new industry window.&lt;br /&gt;
|-&lt;br /&gt;
|3||The user tries to prospect for your industry via the new industry window.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This callback must return a 15-bit value, which is interpreted as follows:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000-03ff||{{ottdp| | }}||Industry can&#039;t be built, display the misc. GRF text Dxxx as error message&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{ottdp| | }}||Industry can be built&lt;br /&gt;
|-&lt;br /&gt;
|0401||{{ottdp| | }}||Industry can&#039;t be built, display the default &amp;quot;site unsuitable&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0402||{{ottdp| | }}||Industry can&#039;t be built, display the &amp;quot;...can only be built in rainforest areas&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0403||{{ottdp| | }}||Industry can&#039;t be built, display the &amp;quot;...can only be built in desert areas&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0404||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can only be built above the snow-line&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0405||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can only be built below the snow-line&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0406||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can&#039;t build on open sea&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0407||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can&#039;t build on canal&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|0408||{{ottdp|1.2|no|ottdrev=r22657}}||Industry can&#039;t be built, display the &amp;quot;...can&#039;t build on river&amp;quot; error message.&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Industry can&#039;t be built. Display error message using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6-14|2.6|ttdprev=r1755}} Since TTDPatch r1755, you can use the text reference stack for your error messages, similarly to callback 3A. The only difference is that only 4 registers are copied instead of 6 because error messages support 20 bytes of reference stack only, and two of those bytes may be used by TTD.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15|no}} The contents of registers 100h..10Fh are copied onto the text reference stack.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Engine_name&amp;diff=5029</id>
		<title>Callback: Engine name</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Engine_name&amp;diff=5029"/>
		<updated>2025-05-13T13:59:07Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Engine name (161) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Engine name (161) ==&lt;br /&gt;
&lt;br /&gt;
This callback allows you to dynamically determine the name shown for an engine type.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Return value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..03FF|| ||D0xx text to display.&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{grfFrom|8}}||Display regular name from Action4 (same as callback failure).&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The contents of registers {{ottdp|14|no}} 100h..105h {{ottdp|15|no}} 100h..10Fh are copied onto the text reference stack and can be used with string codes 80/81 to show texts from the D8xx range as well, extending the available unique strings.&lt;br /&gt;
&lt;br /&gt;
The callback is run in purchase list scope, i.e. for cargotype FF. No variables of an actual vehicle are available.&lt;br /&gt;
&lt;br /&gt;
During this callback, variable 10 (extra callback info 1) contains information about the context where the name is shown.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
! Bits 0 - 7 of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 10]]&amp;lt;ref&amp;gt;Values correspond to the values used for [[Action2/Vehicles#Drawing_different_sprites_on_map_in_various_GUIs|sprite drawing]].&amp;lt;/ref&amp;gt;!! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || No specific context is avaible.&lt;br /&gt;
|-&lt;br /&gt;
| 01..10 || reserved&lt;br /&gt;
|-&lt;br /&gt;
| 11 || Name is shown in the vehicle details GUI. (This includes the refit GUI.)&lt;br /&gt;
|-&lt;br /&gt;
| 12..1F || reserved for other future GUIs.&lt;br /&gt;
|-&lt;br /&gt;
| 20 || Vehicle is drawn in the purchase list. (This includes the &amp;quot;Available vehicles&amp;quot; panel of autoreplace GUI.)&amp;lt;br&amp;gt;Bits &#039;&#039;&#039;8 - 15&#039;&#039;&#039; contain the indentation level in the list, e.g. when using vehicle variants.&lt;br /&gt;
|-&lt;br /&gt;
| 21 || Vehicle is drawn in the exclusive preview GUI or in the advertisement news.&lt;br /&gt;
|-&lt;br /&gt;
| 22 || Vehicle is drawn in the &amp;quot;Vehicles in use&amp;quot; panel of autoreplace GUI.&lt;br /&gt;
|-&lt;br /&gt;
| 23..2F || reserved for other future GUIs with non-purchased vehicles.&lt;br /&gt;
|-&lt;br /&gt;
| 30..FF || reserved&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This callback is available from {{ottdp|14|no|ottdrev=g05ed9f56fd}} OpenTTD 14 and above.&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Layout_name&amp;diff=5028</id>
		<title>Callback: Layout name</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Layout_name&amp;diff=5028"/>
		<updated>2025-05-13T13:55:46Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Airport layout name (156) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Airport layout name (156) ==&lt;br /&gt;
&lt;br /&gt;
This callback allows you to show a name for an airport layout.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Return value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..03FF|| ||D0xx text to display.&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{grfFrom|8}}||Display no text (same as callback failure).&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This callback is always called when available, you do not need to set a bit in any action0 property to enable it. Available for OpenTTD since r20273.&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Extra_information_about_layout_in_the_build_gui&amp;diff=5027</id>
		<title>Callback: Extra information about layout in the build gui</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Extra_information_about_layout_in_the_build_gui&amp;diff=5027"/>
		<updated>2025-05-13T13:55:10Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Extra information about airport layout in the build gui (155) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Extra information about airport layout in the build gui (155) ==&lt;br /&gt;
&lt;br /&gt;
This callback allows you to display some extra text in the build airport gui.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Return value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..03FF|| ||D0xx text to display.&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{grfFrom|8}}||Display no text (same as callback failure).&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This callback is always called when available, you do not need to set a bit in any action0 property to enable it. Available for OpenTTD since r20272&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Customized_building_name&amp;diff=5026</id>
		<title>Callback: Customized building name</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Customized_building_name&amp;diff=5026"/>
		<updated>2025-05-13T13:54:15Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* House customized building name (14D) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== House customized building name (14D) ==&lt;br /&gt;
&lt;br /&gt;
This callback is activated from the Tile Description Query tool, when enquiring a house. Bit 0 of variable 10 will be set to 1 if the house is complete, otherwise it will be 0.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Return value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..03FF|| ||D0xx text to display.&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{grfFrom|8}}||Display usual text from property 12 (same as callback failure).&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Since this callback is not performed frequently, you do not need to specify a mask. &amp;amp;nbsp;It will always be performed, and the name will only change when successful.&lt;br /&gt;
&lt;br /&gt;
Available for OpenTTD since r15172, and for TTDPatch since TTDPatch 2.6r2249&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Show_additional_text_in_industry_window&amp;diff=5025</id>
		<title>Callback: Show additional text in industry window</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Show_additional_text_in_industry_window&amp;diff=5025"/>
		<updated>2025-05-13T13:52:34Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Show additional text in industry window (3A) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Show additional text in industry window (3A) ==&lt;br /&gt;
&lt;br /&gt;
This callback allows you to display extra information in the industry window about the state of your industry.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Return value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..03FF|| ||D0xx text to display.&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{grfFrom|8}}||Display no text (same as callback failure).&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The text must begin with a colouring special character and should not be longer than one line. For example, you can use this callback to display the current production limit of a secondary industry.&lt;br /&gt;
&lt;br /&gt;
{{ottd|0.6|r11987}} Note that since r11987, OpenTTD allows resizing the window when this callback is enabled. &amp;amp;nbsp;It allows to specify a text containing more than one line.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6-14|2.6|ttdprev=r1370}} Since TTDPatch 2.6 r1370, the contents of registers 100h..105h are copied onto the text reference stack. This allows you to display dynamically calculated values in the text by using the according StringCodes. Please note, though, that the text handler will see it as an array of bytes, not as an array of DWORDs, so you will have to pack two words into a register when you use codes that read words from the stack. In the case of \7D (which gets a byte), you may have to pack more into a register, but it&#039;s probably easier to use \7C instead.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} Please also note that you can use \80 to display textIDs calculated on the fly, but DCxx textIDs won&#039;t work correctly. When you need to choose from your own texts dynamically, you must use D0xx IDs, and add 400h to them. (That is, use D400 to refer to D000, D401 for D001 etc.)&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15|no}} The contents of registers 100h..10Fh are copied onto the text reference stack. &lt;br /&gt;
&lt;br /&gt;
This callback is available from {{ttdp|2.5}} TTDPatch 2.0.1 a72 and above&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Show_additional_text_in_fund/building_window&amp;diff=5024</id>
		<title>Callback: Show additional text in fund/building window</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Show_additional_text_in_fund/building_window&amp;diff=5024"/>
		<updated>2025-05-13T13:48:14Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Show additional text in fund/building window (38/15C) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Show additional text in fund/building window (38/15C) ==&lt;br /&gt;
&lt;br /&gt;
This callback allows you to display extra information in the industry fund and object building windows.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Return value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..03FF|| ||D0xx text to display.&lt;br /&gt;
|-&lt;br /&gt;
|0400||{{grfFrom|8}}||Display no text (same as callback failure).&lt;br /&gt;
|-&lt;br /&gt;
|040F||{{ottdp|15|no}}||Display text using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.&lt;br /&gt;
|}&lt;br /&gt;
The text must begin with a colouring special character and should not be longer than three lines (automatic line breaks are provided, but you can use char 0D for a manual line break). Since the industry isn&#039;t built yet, you can&#039;t access any industry variables during this callback. Same holds for objects.&lt;br /&gt;
&lt;br /&gt;
Callback 38 is available from TTDPatch 2.0.1 a72 and above. &lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.1-14|2.6|ottdrev=r20086|ttdprev=r2354}} The contents of registers 100h..105h are copied onto the text reference stack.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15|no}} The contents of registers 100h..10Fh are copied onto the text reference stack.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Cargo_sub-type_display_for_industries&amp;diff=5023</id>
		<title>Callback: Cargo sub-type display for industries</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Cargo_sub-type_display_for_industries&amp;diff=5023"/>
		<updated>2025-05-13T13:41:58Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Cargo sub-type display for industries (37) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Cargo sub-type display for industries (37) ==&lt;br /&gt;
&lt;br /&gt;
This callback allows you to display some text after the cargo name in the industry fund window and in industry windows. &lt;br /&gt;
&lt;br /&gt;
{{grfTill|7}} For GRF version 7 and below the valid return values are:&lt;br /&gt;
{| |-&lt;br /&gt;
|00..FE|| Display D0xx (D000..D0FE) text.&lt;br /&gt;
|-&lt;br /&gt;
|FF|| Display no text.&lt;br /&gt;
|-&lt;br /&gt;
|100..1FE|| Display D0xx (D100..D1FE) text.&lt;br /&gt;
|-&lt;br /&gt;
|200..2FE|| Display D0xx (D200..D2FE) text.&lt;br /&gt;
|-&lt;br /&gt;
|300..3FE|| Display D0xx (D300..D3FE) text.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|8}} For GRF version 8 and above the valid return values are:&lt;br /&gt;
{| |-&lt;br /&gt;
|00..3FF|| Display D0xx (D000..D3FF) text. Display waiting amount if production CB is used.&lt;br /&gt;
|-&lt;br /&gt;
|400|| Display no text. Display waiting amount if production CB is used.&lt;br /&gt;
|-&lt;br /&gt;
|401|| {{ottdp|1.7|no|ottdrev=r27751}} Display no waiting amount and no text.&lt;br /&gt;
|-&lt;br /&gt;
|40E|| {{ottdp|15|no}} Display text without waiting amount using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.&lt;br /&gt;
|-&lt;br /&gt;
|40F|| {{ottdp|15|no}} Display text and potentially waiting amount using text ID from register 0x100 (not limited to D0xx texts). The text stack starts at register 0x101.&lt;br /&gt;
|-&lt;br /&gt;
|800..BFF|| {{ottdp|1.7|no|ottdrev=r27751}} Display D0xx (D000..D3FF) text without waiting amount.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
During the callback, variable 18 specifies which cargo sub-type is queried.&lt;br /&gt;
The meaning of variable 18 changes with industry property 1A flag 18.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bits 0..7&#039;&#039;&#039; of var. 18 can have the following values:&lt;br /&gt;
* If property 1A flag 18 is clear.&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00||Return subtext for first accepted cargo type&lt;br /&gt;
|-&lt;br /&gt;
|01||Return subtext for second accepted cargo type&lt;br /&gt;
|-&lt;br /&gt;
|02||Return subtext for third accepted cargo type&lt;br /&gt;
|-&lt;br /&gt;
|03||Return subtext for first produced cargo type&lt;br /&gt;
|-&lt;br /&gt;
|04||Return subtext for second produced cargo type&lt;br /&gt;
|}&lt;br /&gt;
* {{ottdp|1.9|no|ottdrev=e66cec8f}} If property 1A flag 18 is set.&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00||Return subtext for an accepted cargo type. Use bits 16..23 to distinguish them.&lt;br /&gt;
|-&lt;br /&gt;
|01||Return subtext for a produced cargo type. Use bits 16..23 to distinguish them.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bits 8..15&#039;&#039;&#039; of var. 18 can have the following values:&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00||The text is to be displayed in the industry fund window. The industry isn&#039;t built yet, so you can&#039;t access the industry variables&lt;br /&gt;
|-&lt;br /&gt;
|01||The text is to be displayed in the window of the industry. You can use the industry variables here.&lt;br /&gt;
|-&lt;br /&gt;
|02||The text is to be displayed in the industry directory window. You can use the industry variables here.&lt;br /&gt;
|-&lt;br /&gt;
|other values||Reserved for future use&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Bit 16..23&#039;&#039;&#039; of var. 18 contain the cargo type from the CTT (only if property 1A flag 18 is set).&lt;br /&gt;
&lt;br /&gt;
Other bits of var. 18 are reserved for future use.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.0 - 14|no|ottdrev=r17802}} Since OpenTTD r17802, the contents of registers 100h..105h are copied onto the text reference stack.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15|no}} The contents of registers 100h..10Fh are copied onto the text reference stack.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Vehicle_Start/stop_check&amp;diff=5022</id>
		<title>Callback: Vehicle Start/stop check</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Vehicle_Start/stop_check&amp;diff=5022"/>
		<updated>2025-05-13T13:36:41Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Vehicle Start/stop check (31) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Vehicle Start/stop check (31) ==&lt;br /&gt;
&lt;br /&gt;
This callback is called whenever a player (or the AI) tries to start or stop a vehicle. This is mainly useful for preventing vehicles&lt;br /&gt;
from leaving the depot unless a given condition is met. To check whether a vehicle is being started or stopped, check&lt;br /&gt;
bit 1 of variable B2. If set, the vehicle is currently stopped and if clear, the vehicle is moving (or at least, not stopped manually).&lt;br /&gt;
&lt;br /&gt;
{{grfTill|7}} For GRF version 7 and below the valid return values are:&lt;br /&gt;
{| |-&lt;br /&gt;
|00..FE|| Display error message using D0xx (D000..D0FE) text as second line.&lt;br /&gt;
|-&lt;br /&gt;
|FF|| Start/stop action shall succeed.&lt;br /&gt;
|-&lt;br /&gt;
|100..1FE|| Display error message using D0xx (D100..D1FE) text as second line.&lt;br /&gt;
|-&lt;br /&gt;
|200..2FE|| Display error message using D0xx (D200..D2FE) text as second line.&lt;br /&gt;
|-&lt;br /&gt;
|300..3FE|| Display error message using D0xx (D300..D3FE) text as second line.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|8}} For GRF version 8 and above the valid return values are:&lt;br /&gt;
{| |-&lt;br /&gt;
|00..3FF|| Display error message using D0xx (D000..D3FF) text as second line.&lt;br /&gt;
|-&lt;br /&gt;
|400|| Start/stop action shall succeed.&lt;br /&gt;
|-&lt;br /&gt;
|40F|| {{ottdp|15|no}} Display error message using text ID from register 0x100. (not limited to D0xx texts)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The callback is always used when defined, no bit in the action 0 property needs to be set to activate it.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=RandomAction2&amp;diff=5021</id>
		<title>RandomAction2</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=RandomAction2&amp;diff=5021"/>
		<updated>2025-05-13T13:26:02Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* set-ids */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Unlike [[VariationalAction2]], whose results are always determined by a predictable decision, RandomAction2 can use randomized results to pick one of several [[Action2]] entries.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The data looks as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Sprite-number&amp;gt; * &amp;lt;Length&amp;gt; 02 &amp;lt;feature&amp;gt; &amp;lt;set-id&amp;gt; &amp;lt;nowiki&amp;gt;[80|83]&amp;lt;/nowiki&amp;gt; &amp;lt;random-triggers&amp;gt; &amp;lt;randbit&amp;gt; &amp;lt;nrand&amp;gt; &amp;lt;set-ids&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From TTDPatch 2.6 r1850 and OpenTTD r12452, and &#039;&#039;&#039;for vehicles only&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Sprite-number&amp;gt; * &amp;lt;Length&amp;gt; 02 &amp;lt;feature&amp;gt; &amp;lt;set-id&amp;gt; 84 &amp;lt;count&amp;gt; &amp;lt;random-triggers&amp;gt; &amp;lt;randbit&amp;gt; &amp;lt;nrand&amp;gt; &amp;lt;set-ids&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!&#039;&#039;&#039;Element&#039;&#039;&#039;!![[GRFActionsDetailed|&#039;&#039;&#039;Size&#039;&#039;&#039;]]!!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Sprite-number&amp;gt;||dec||A sequential sprite number&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;length&amp;gt;||dec||The total number of bytes used in this action.&lt;br /&gt;
|-&lt;br /&gt;
|02||B||Defines action 02&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;feature&amp;gt;||B||For what type of vehicle/station/... should this definition be used?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set-id&amp;gt;||B||The ID of this action 2 (used like a cargo ID)&lt;br /&gt;
|-&lt;br /&gt;
|80, 83, 84||B||Type of random action, see below.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;count&amp;gt;||B||(when present) Location of controlling vehicle.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;random-triggers&amp;gt;||B||When to re-randomize&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;randbit&amp;gt;||B||What random bit to use for this action 2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nrand&amp;gt;||B||Number of set-ids to choose from, must be a power of 2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set-ids&amp;gt;||W||Action 2 set-ids to choose from.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite-number ===&lt;br /&gt;
&lt;br /&gt;
This is just the number you are at.&lt;br /&gt;
&lt;br /&gt;
=== Length ===&lt;br /&gt;
&lt;br /&gt;
Count the number of bytes in this action.&lt;br /&gt;
&lt;br /&gt;
===Feature===&lt;br /&gt;
&lt;br /&gt;
This sets the type of [[Features|feature]] that you wish to change. Set it to:&lt;br /&gt;
&lt;br /&gt;
{|- |&lt;br /&gt;
!Value!![[Features|Feature]]&lt;br /&gt;
|-&lt;br /&gt;
|00||Trains&lt;br /&gt;
|-&lt;br /&gt;
|01||Road Vehicles&lt;br /&gt;
|-&lt;br /&gt;
|02||Ships&lt;br /&gt;
|-&lt;br /&gt;
|03||Aircraft&lt;br /&gt;
|-&lt;br /&gt;
|04||Stations&lt;br /&gt;
|-&lt;br /&gt;
|05||Canals/Rivers&lt;br /&gt;
|-&lt;br /&gt;
|07||Houses&lt;br /&gt;
|-&lt;br /&gt;
|09||Industry Tiles&lt;br /&gt;
|-&lt;br /&gt;
|0A||Industries&lt;br /&gt;
|-&lt;br /&gt;
|0D||Airports&lt;br /&gt;
|-&lt;br /&gt;
|0F||Objects&lt;br /&gt;
|-&lt;br /&gt;
|10||Railtypes&lt;br /&gt;
|-&lt;br /&gt;
|11||Airport Tiles&lt;br /&gt;
|-&lt;br /&gt;
|12||Roadtypes&lt;br /&gt;
|-&lt;br /&gt;
|13||Tramtypes&lt;br /&gt;
|-&lt;br /&gt;
|14||Road Stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== set-ID ===&lt;br /&gt;
&lt;br /&gt;
This defines the number of this action 2. &amp;amp;nbsp;The ID can then be used as target in an action 3 or another variational/random action 2.&lt;br /&gt;
&lt;br /&gt;
=== 80/83/84 ===&lt;br /&gt;
&lt;br /&gt;
Use 80 to randomize the object (vehicle, station, building, industry, object) based on its own triggers and bits.&lt;br /&gt;
&lt;br /&gt;
Use 83 to randomize the object based on its &amp;quot;related&amp;quot; object (s.b.).&lt;br /&gt;
&lt;br /&gt;
Use 84 to randomize the vehicle based on any vehicle in the consist.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Feature!!Related object&lt;br /&gt;
|-&lt;br /&gt;
|Vehicles (00-03)||First vehicle of consist&lt;br /&gt;
|-&lt;br /&gt;
|Stations (04)||N/A&lt;br /&gt;
|-&lt;br /&gt;
|Houses (07)||N/A&lt;br /&gt;
|-&lt;br /&gt;
|Industry tiles (09)||Industry containing tile&lt;br /&gt;
|-&lt;br /&gt;
|Industries (0A)||N/A&lt;br /&gt;
|-&lt;br /&gt;
|Objects (0F)||N/A&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== count ===&lt;br /&gt;
&lt;br /&gt;
For type 84, this specifies which vehicle&#039;s random bits this vehicle will be using and/or modifying.&lt;br /&gt;
&lt;br /&gt;
The low nibble (bits 0-3) specifies how far to count from the starting vehicle. If it is zero, the count will be read from GRF register 100h instead.&lt;br /&gt;
&lt;br /&gt;
The high nibble (bits 6-7, actually) specifies which vehicle is the starting vehicle, and which direction to count:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||count back (away from the engine), starting at this vehicle&lt;br /&gt;
|-&lt;br /&gt;
|4||count forward (toward the engine), starting at this vehicle.&lt;br /&gt;
|-&lt;br /&gt;
|8||count back, starting at the engine&lt;br /&gt;
|-&lt;br /&gt;
|C||count back, starting at the first vehicle in this chain of vehicles with the same ID, as for vehicle variable 41&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bits 4-5 are reserved and must be zero, so other values of the high nibble are not allowed.&lt;br /&gt;
&lt;br /&gt;
=== random-triggers ===&lt;br /&gt;
&lt;br /&gt;
This is a bit mask of triggers which cause re-randomizing. Normally, any matching trigger causes the graphics to be randomized again, but if you add 80 to the bitmask, the re-randomizing only happens if &#039;&#039;&#039;all&#039;&#039;&#039; triggers have occurred.&lt;br /&gt;
&lt;br /&gt;
Trigger bits are feature-specific, see below.&lt;br /&gt;
&lt;br /&gt;
Note, that rerandomisation only occurs in the graphics chain, not for callbacks. So, if you use a random action only inside a callback and want to rerandomise the bits, you have to add a &amp;quot;dummy&amp;quot; rerandomisation RA2 into the graphics chain.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 -1 * -1   02 04 02&lt;br /&gt;
           80                         // random in callback&lt;br /&gt;
           00                         // no triggers&lt;br /&gt;
           00                         // first random bit to use&lt;br /&gt;
           \b 16                      // number of cases&lt;br /&gt;
           \w 10 \w 11 \w 12 \w 13    // random cases&lt;br /&gt;
           \w 14 \w 15 \w 16 \w 17&lt;br /&gt;
           \w 18 \w 19 \w 20 \w 21&lt;br /&gt;
           \w 22 \w 23 \w 24 \w 25&lt;br /&gt;
 &lt;br /&gt;
 -1 * -1   02 04 01&lt;br /&gt;
           85 0C 00 \wx FFFF&lt;br /&gt;
           01&lt;br /&gt;
           \w 2 \w 14 \w 14           // callback 14&lt;br /&gt;
           \w 3                       // graphics chain&lt;br /&gt;
 &lt;br /&gt;
 -1 * -1   02 04 00&lt;br /&gt;
           80                         // dummy random outside callback&lt;br /&gt;
           04                         // train arrival&lt;br /&gt;
           00                         // first bit to rerandomise&lt;br /&gt;
           \b 16                      // number of cases&lt;br /&gt;
           \w 1 \w1 \w 1 \w1          // all cases the same, only for triggering rerandomisation&lt;br /&gt;
           \w 1 \w1 \w 1 \w1&lt;br /&gt;
           \w 1 \w1 \w 1 \w1&lt;br /&gt;
           \w 1 \w1 \w 1 \w1&lt;br /&gt;
 &lt;br /&gt;
 -1 * -1   03 04 01 00 00 \w 0        // action 3&lt;br /&gt;
&lt;br /&gt;
=== randbit ===&lt;br /&gt;
&lt;br /&gt;
{{ottdp|no|&amp;amp;lt;2.5|ttdprev=alpha30}} For versions before TTDPatch 2.0.1 alpha 30, leave this at 00. It doesn&#039;t quite work the way intended (it was supposed to allow independent random chains, but currently everything is re-randomized at the same time, thereby defeating this mechanism).&lt;br /&gt;
&lt;br /&gt;
{{ottdp| |2.5|ttdprev=alpha 30}} Since TTDPatch 2.0.1 alpha 30, only those bits that actually get triggered will be re-randomized. Prior versions always re-randomized all bits. This will make it possible to have independent sets of bits for independent triggers (or untriggered bits, set only at the time of purchase). Setting randbit determines the first bit to be re-randomized, as well as basing the random graphics on. The total number of bits used is the 2-logarithm of nrand below (e.g., for nrand=16, 4 bits are used).&lt;br /&gt;
&lt;br /&gt;
=== nrand ===&lt;br /&gt;
&lt;br /&gt;
Number of different sets to choose from. &amp;amp;nbsp;This must be a power of 2, i.e. 2, 4, 8, 16 etc.&lt;br /&gt;
&lt;br /&gt;
=== set-ids ===&lt;br /&gt;
&lt;br /&gt;
The set-ids to randomly choose from.&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Set-id!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..00FF|| ||Chain to the preceding Action2 with given group id.&lt;br /&gt;
|-&lt;br /&gt;
|7FFF||{{ottdp|15|no}}||Return &amp;quot;callback failed&amp;quot;/&amp;quot;sprite resolving failed&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|8000..FEFF|| ||Return callback result with value 0000..7EFF.&lt;br /&gt;
|-&lt;br /&gt;
|FF00..FFFF||{{grf|≤7}}||Return callback result with value 00..FF.&lt;br /&gt;
|-&lt;br /&gt;
|8000..FFFF||{{grf|≥8}}||Return callback result with value 0000..7FFF.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|Feature&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|Random bits&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|Triggers&lt;br /&gt;
|-&lt;br /&gt;
!Self!!Related&lt;br /&gt;
|-&lt;br /&gt;
|Vehicles&lt;br /&gt;
|8&lt;br /&gt;
{{ottdp|14.0|no}} 16&lt;br /&gt;
|8 read-only&lt;br /&gt;
{{ottdp|14.0|no}} 16 read-only&lt;br /&gt;
|yes&lt;br /&gt;
|-&lt;br /&gt;
|Stations||16 + 4 &amp;lt;ref name=&amp;quot;stationshared&amp;quot;&amp;gt;16 Bits shared for the whole station/airport (airport and station share the same bits). 4 bits per tile.&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;TTDPatch actually only implements 8 shared random bits (plus 4 per tile). Bits 8-15 are always zero.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|no||yes&lt;br /&gt;
|-&lt;br /&gt;
|Canals||8||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Houses||8||no||yes&lt;br /&gt;
|-&lt;br /&gt;
|Industry tiles||8||16||yes&lt;br /&gt;
|-&lt;br /&gt;
|Industries||16||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Airports||16 &amp;lt;ref name=&amp;quot;stationshared&amp;quot;/&amp;gt;||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Objects||8||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Railtypes||2||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Roadtypes||2||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Tramtypes||2||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Airport tiles||16 + 4 &amp;lt;ref name=&amp;quot;stationshared&amp;quot;/&amp;gt;||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Road stops||16 + 8 &amp;lt;ref name=&amp;quot;stationshared&amp;quot;/&amp;gt;||no||yes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vehicles ===&lt;br /&gt;
&lt;br /&gt;
Vehicles have 8 random bits, increased to 16 since {{ottdp|14.0|no}}, and the following triggers:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|0.6|2.0}}||Vehicle gets new load of cargo (only after it was empty)&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|0.6|2.0}}||Vehicle enters a depot and is serviced&lt;br /&gt;
|-&lt;br /&gt;
|2||04||{{ottdp|0.6|2.5}}||The consist has unloaded all cargo&lt;br /&gt;
|-&lt;br /&gt;
|3||08||{{ottdp|0.6|2.5}}||Any vehicle of the consist receives cargo&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5}}||[[Callbacks#32-day callback (32) |Callback 32]] returned 1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The consist trigger bits 2 and 3 allow re-randomizing whenever the consist receives cargo after fully unloading. They should be used with action 2 type 80, not 83, and the random-triggers variable should have 80 added to it, to make the re-randomizing happen only if the consist was empty and &#039;&#039;&#039;then&#039;&#039;&#039; received new cargo.&lt;br /&gt;
&lt;br /&gt;
Vehicles can read the random bits of other vehicles (using random action type 83 or 84), but they can only trigger&lt;br /&gt;
rerandomisation of their own bits. Do not specify any triggers for rerandomisation when accessing random bits of other vehicles (via type 83 or 84), it will not do what you think.&lt;br /&gt;
&lt;br /&gt;
=== Stations ===&lt;br /&gt;
&lt;br /&gt;
Stations have 16+4 random bits. Bits 0 to 15 are a property of the station as a whole, and bits 16 to 19 are different for each tile. &amp;amp;nbsp;To get tile-based randomness, therefore use randbit=10 and nrand of no more than 16 (since only 4 random bits are available per tile).&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|1.3|2.5}}||new cargo waiting&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|1.3|2.5}}||no more cargo&lt;br /&gt;
|-&lt;br /&gt;
|2||04||{{ottdp|1.3|2.5}}||train arrives (starts unloading/loading)&lt;br /&gt;
|-&lt;br /&gt;
|3||08||{{ottdp|1.3|2.5}}||train leaves (done unloading &amp;amp; loading)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.3|2.5}}||train loads or unloads cargo&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.3|2.5}}||train reserves platform (using PBS)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Also note that none of the above triggers will actually trigger unless prop. 12 has at least one bit set. &amp;amp;nbsp;Triggers 01 will be triggered for any of the cargo types set in prop. 12, but trigger 02 will only be triggered if all of those cargo types have no more cargo waiting. Triggers 04, 08 and 20 are triggered no matter what cargo types the train transports, as long as prop. 12 is not zero.&lt;br /&gt;
&lt;br /&gt;
Triggers 04, 08, 10 and 20 only affect the platform on which they occur, as well as the random bits of the station, but not other platforms.&lt;br /&gt;
&lt;br /&gt;
Because the &#039;occured triggers&#039; are only stored once per station (not distinguishing tiles or cargo types), adding 80 to &lt;br /&gt;
random-triggers does not make a lot of sense.&lt;br /&gt;
&lt;br /&gt;
=== Town building triggers ===&lt;br /&gt;
&lt;br /&gt;
Town buildings have 8 random bits.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|0.6|2.5}}||the building tile is processed in the periodic tile processing loop&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|0.6|2.5}}||the top tile of the building is processed in the periodic tile processing loop&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The periodic tile processing loop constantly processes the tiles of the map, processing any given tile in every 256 ticks (approx. 3.5 TTD days). Since no &amp;quot;real&amp;quot; event happens to town buildings, you have only this opportunity to re-randomize the look of your building.&lt;br /&gt;
&lt;br /&gt;
If every 3.5 days is too fast for you, you can multiply the time-out by setting property 16 for the given tile. The time-out is 256 ticks*(prop. 16+1), so 0 means every 3.5 days, 1 means every 7 days, 2 means every 10.5 days and so on.&lt;br /&gt;
&lt;br /&gt;
If trigger 02 is activated, all parts of the building that has this trigger set will get the same random bits, allowing you to randomize a multi-tile building as one unit. On the other hand, if the tiles of a multi-tile building have trigger 1 set, all tiles will be randomized individually. Note that all tiles of a multi-tile building get the same value when building the building.&lt;br /&gt;
&lt;br /&gt;
=== Industry tile triggers ===&lt;br /&gt;
&lt;br /&gt;
Industry tiles have 8+16 random bits. Accessed through random action 2 type 80, you get 8 tile-specific bits, and accessed through random action 2 type 83, you get 16 industry-specific bits. The triggers are the same for both. Triggers 02 and 04 are triggered for all tiles of the industry at once. Every tile can rerandomise both its own random bits and those of the industry. That is every tile can specify some bits of the industry to rerandomize, and the union of all those bits will be rerandomsied at the end.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|0.6|2.5}}||the building tile is processed in the periodic tile processing loop&amp;lt;ref&amp;gt;{{ottdp|no| |}} Rerandomisation of the shared bits of the industry does not happen properly in current TTDPatch.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|0.6|2.5}}||triggers simultaneously for all tiles of the industry every 256 ticks. If the industry is a primary one, output cargo is generated at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|2||04||{{ottdp|0.6|2.5}}||cargo is delivered to the industry. If the industry is a processing one, output cargo is generated at the same time.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Trigger 1 works similarly to trigger 1 for houses except that you cannot multiply the timeout: it&#039;s always 256 ticks.&lt;br /&gt;
&lt;br /&gt;
Industry tiles can rerandomise both their own random bits as well as the random bits of the industry (via random action type 83).&lt;br /&gt;
The remembered triggers for rerandomisation with 80 added to the triggers are in both cases the same per tile.&lt;br /&gt;
&lt;br /&gt;
Industries have random bits. However, they can only be rerandomised by their tiles.&lt;br /&gt;
&lt;br /&gt;
=== Canals ===&lt;br /&gt;
&lt;br /&gt;
Canals / Rivers have 8 random bits.&lt;br /&gt;
&lt;br /&gt;
There is currently no way to influence the random byte creation via triggers, internally the bits are feed from VarAction2Canals var 83 that is set when building a canal. Feature ids not supported by VarAction2Canals are undefined and should never be used.&lt;br /&gt;
&lt;br /&gt;
=== Objects ===&lt;br /&gt;
&lt;br /&gt;
Objects have 8 random bits per tile of the object.&lt;br /&gt;
&lt;br /&gt;
There are no triggers for objects however.&lt;br /&gt;
&lt;br /&gt;
Also note that the random bits are unique to each tile in the object, and are not shared across the whole object.&lt;br /&gt;
&lt;br /&gt;
=== Railtypes ===&lt;br /&gt;
&lt;br /&gt;
Rail tiles have 2 pseudo random bits, based on tile location.&lt;br /&gt;
&lt;br /&gt;
There are no triggers.&lt;br /&gt;
&lt;br /&gt;
=== Roadtypes ===&lt;br /&gt;
&lt;br /&gt;
Road tiles have 2 pseudo random bits, based on tile location.&lt;br /&gt;
&lt;br /&gt;
There are no triggers.&lt;br /&gt;
&lt;br /&gt;
=== Tramtypes ===&lt;br /&gt;
&lt;br /&gt;
Tram tiles have 2 pseudo random bits, based on tile location.&lt;br /&gt;
&lt;br /&gt;
There are no triggers.&lt;br /&gt;
&lt;br /&gt;
=== Road stops ===&lt;br /&gt;
&lt;br /&gt;
Road stops have 16+8 random bits. Bits 0 to 15 are a property of the station as a whole, and bits 16 to 23 are different for each tile. &amp;amp;nbsp;To get tile-based randomness, therefore use randbit=10 and nrand of no more than 256 (since only 8 random bits are available per tile).&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|14}}||new cargo waiting&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|14}}||no more cargo&lt;br /&gt;
|-&lt;br /&gt;
|2||04||{{ottdp|14}}||road vehicle arrives (starts unloading/loading)&lt;br /&gt;
|-&lt;br /&gt;
|3||08||{{ottdp|14}}||road vehicle leaves (done unloading &amp;amp; loading)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|14}}||road vehicle loads or unloads cargo&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Also note that none of the above triggers will actually trigger unless prop. 0D has at least one bit set. &amp;amp;nbsp;Triggers 01 will be triggered for any of the cargo types set in prop. 0D, but trigger 02 will only be triggered if all of those cargo types have no more cargo waiting. Triggers 04 and 08 are triggered no matter what cargo types the road vehicle transports, as long as prop. 0D is not zero.&lt;br /&gt;
&lt;br /&gt;
Triggers 04, 08, and 10 only affect the tile on which they occur, as well as the random bits of the station, but not other tiles.&lt;br /&gt;
&lt;br /&gt;
Because the &#039;occured triggers&#039; are only stored once per station (not distinguishing tiles or cargo types), adding 80 to &lt;br /&gt;
random-triggers does not make a lot of sense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Other features ===&lt;br /&gt;
&lt;br /&gt;
All features not mentioned in the list above have neither random bits nor triggers, including towns (which would be accessed using random action 2 type 83 for stations and industries).&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2&amp;diff=5020</id>
		<title>VariationalAction2</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2&amp;diff=5020"/>
		<updated>2025-05-13T13:15:41Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* sets and ranges */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
To support changes in graphics based on other factors than just the load states, you use a VarAction2. This provides a sophisticated way of deciding what graphics to use.&lt;br /&gt;
&lt;br /&gt;
A VarAction2 can be used like any other action 2, but it provides an additional step in-between: instead of defining the action 1 sets right away, it instead specifies a list of additional action 2 entry, one of which is used depending on the kind of variation that is defined. These action 2 entries that are referred can in turn be variational or random (to provide chains of decisions), or they can be the final element, that is a regular action 2 which contains definitions of action 1 sets, or a callback result.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The data looks as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Sprite-number&amp;gt; * &amp;lt;Length&amp;gt; 02 &amp;lt;feature&amp;gt; &amp;lt;set-id&amp;gt; &amp;lt;type&amp;gt; &amp;lt;variable&amp;gt; &amp;lt;varadjust&amp;gt; &amp;lt;nvar&amp;gt; (&amp;lt;set-id&amp;gt; &amp;lt;low-range&amp;gt; &amp;lt;high-range&amp;gt;){n} &amp;lt;default&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!&#039;&#039;&#039;Element&#039;&#039;&#039;!![[GRFActionsDetailed|&#039;&#039;&#039;Size&#039;&#039;&#039;]]!!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Sprite-number&amp;gt;||dec||A sequential sprite number&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;length&amp;gt;||dec||The total number of bytes used in this action.&lt;br /&gt;
|-&lt;br /&gt;
|02||B||Defines action 02&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;feature&amp;gt;||B||For what type of vehicle/station should this definition be used?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set-id&amp;gt;||B||The ID of this action 2 (used like a cargo ID)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;type&amp;gt;||B||Type of VarAction2, see below&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;variable&amp;gt;||B||Which variable we base the decision on&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;varadjust&amp;gt;||V||How to manipulate the value before deciding.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nvar&amp;gt;||B||Number of different ranges of the value (not counting the default)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set-id&amp;gt;||W||Action 2 set-id to use for the following range.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;low-range&amp;gt;||B/W/D||Minimum (inclusive) of the range for which to use the above set-id&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;high-range&amp;gt;||B/W/D||Maximum (inclusive) of the range&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;default&amp;gt;||W||Action 2 set-id to use if no range matches&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The size of &amp;lt;varadjust&amp;gt; depends on &amp;lt;type&amp;gt; as well as the adjustments to be performed and must always provide an AND mask. For &amp;lt;type&amp;gt; 81, a &amp;quot;do nothing&amp;quot; &amp;lt;varadjust&amp;gt; would be 00 FF.&lt;br /&gt;
&lt;br /&gt;
You repeat the sequence of &amp;lt;set-id&amp;gt; &amp;lt;low-range&amp;gt; &amp;lt;high-range&amp;gt; as often as &amp;lt;nvar&amp;gt; specifies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;low-range&amp;gt; and &amp;lt;high-range&amp;gt; have a size of B, W, or D, depending on &amp;lt;type&amp;gt;. See that entry for more information.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite-number ===&lt;br /&gt;
&lt;br /&gt;
This is just the number you are at.&lt;br /&gt;
&lt;br /&gt;
=== Length ===&lt;br /&gt;
&lt;br /&gt;
Count the number of bytes in this action.&lt;br /&gt;
&lt;br /&gt;
=== Feature ===&lt;br /&gt;
&lt;br /&gt;
This sets the type of [[Features|feature]] that you wish to change. Set it to:&lt;br /&gt;
&lt;br /&gt;
{|- |&lt;br /&gt;
!Value!![[Features|Feature]]&lt;br /&gt;
|-&lt;br /&gt;
|00||[[VariationalAction2/Vehicles | Trains]]&lt;br /&gt;
|-&lt;br /&gt;
|01||[[VariationalAction2/Vehicles | Road Vehicles]]&lt;br /&gt;
|-&lt;br /&gt;
|02||[[VariationalAction2/Vehicles | Ships]]&lt;br /&gt;
|-&lt;br /&gt;
|03||[[VariationalAction2/Vehicles | Aircraft]]&lt;br /&gt;
|-&lt;br /&gt;
|04||[[VariationalAction2/Stations | Stations]]&lt;br /&gt;
|-&lt;br /&gt;
|05||[[VariationalAction2/Canals | Canals/Rivers]]&lt;br /&gt;
|-&lt;br /&gt;
|06||[[VariationalAction2/Bridges | Bridges]]&lt;br /&gt;
|-&lt;br /&gt;
|07||[[VariationalAction2/Houses | Houses]]&lt;br /&gt;
|-&lt;br /&gt;
|09||[[VariationalAction2/Industry Tiles | Industry Tiles]]&lt;br /&gt;
|-&lt;br /&gt;
|0A||[[VariationalAction2/Industries | Industries]]&lt;br /&gt;
|-&lt;br /&gt;
|0B||Cargos (no feature specific variables)&lt;br /&gt;
|-&lt;br /&gt;
|0C||Sound Effects (no feature specific variables)&lt;br /&gt;
|-&lt;br /&gt;
|0D||[[VariationalAction2/Airports | Airports]]&lt;br /&gt;
|-&lt;br /&gt;
|0E||[[VariationalAction2/Signals | Signals]]&lt;br /&gt;
|-&lt;br /&gt;
|0F||[[VariationalAction2/Objects | Objects]]&lt;br /&gt;
|-&lt;br /&gt;
|10||[[VariationalAction2/Railtypes | Railtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|11||[[VariationalAction2/Airport Tiles | Airport Tiles]]&lt;br /&gt;
|-&lt;br /&gt;
|12||[[VariationalAction2/Roadtypes | Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|13||[[VariationalAction2/Tramtypes | Tramtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|14||[[VariationalAction2/Road Stops | Road Stops]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Set-ID ===&lt;br /&gt;
&lt;br /&gt;
This defines the number of this action 2. &amp;amp;nbsp;The ID can then be used as target in an action 3 or another variational/random action 2.&lt;br /&gt;
&lt;br /&gt;
=== Type ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
! !! B&amp;lt;br/&amp;gt;Access lowest byte !! {{ottdp|0.6|2.5}} W&amp;lt;br/&amp;gt;Access lowest word !! {{ottdp|0.6|2.5}} D&amp;lt;br/&amp;gt;Access lowest doubleword&lt;br /&gt;
|-&lt;br /&gt;
!align=&amp;quot;left&amp;quot;| Access general variable or&amp;lt;br/&amp;gt;variable of the primary object&lt;br /&gt;
|align=&amp;quot;center&amp;quot;| 81 &lt;br /&gt;
|align=&amp;quot;center&amp;quot;| 85 &lt;br /&gt;
|align=&amp;quot;center&amp;quot;| 89&lt;br /&gt;
|-&lt;br /&gt;
!align=&amp;quot;left&amp;quot;| Access variable of &amp;quot;related&amp;quot; object&lt;br /&gt;
|align=&amp;quot;center&amp;quot;| 82 &lt;br /&gt;
|align=&amp;quot;center&amp;quot;| 86 &lt;br /&gt;
|align=&amp;quot;center&amp;quot;| 8A&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The access type specifies both the size of the variable access, and selects between general variables and the object&#039;s innate variables, or variables of a specific &amp;quot;related&amp;quot; object.&lt;br /&gt;
&lt;br /&gt;
{|- |&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|[[Features|Feature]]!!Related object&lt;br /&gt;
|-&lt;br /&gt;
|00-03||[[VariationalAction2/Vehicles | Vehicles]]||First [[VariationalAction2/Vehicles | vehicle]] of consist&lt;br /&gt;
|-&lt;br /&gt;
|04||[[VariationalAction2/Stations | Stations]]||[[VariationalAction2/Towns | Town]] to which station belongs&lt;br /&gt;
|-&lt;br /&gt;
|05||[[VariationalAction2/Canals | Canals/Rivers]]||N/A&lt;br /&gt;
|-&lt;br /&gt;
|06||[[VariationalAction2/Bridges | Bridges]]||[[VariationalAction2/Towns | Town]] of bridge&lt;br /&gt;
|-&lt;br /&gt;
|07||[[VariationalAction2/Houses | Houses]]||[[VariationalAction2/Towns | Town]] of house&lt;br /&gt;
|-&lt;br /&gt;
|09||[[VariationalAction2/Industry Tiles | Industry Tiles]]||[[VariationalAction2/Industries | Industry]] containing tile&lt;br /&gt;
|-&lt;br /&gt;
|0A||[[VariationalAction2/Industries | Industries]]||[[VariationalAction2/Towns | Town]] of industry&lt;br /&gt;
|-&lt;br /&gt;
|0B||Cargos||N/A&lt;br /&gt;
|-&lt;br /&gt;
|0C||Sound Effects||N/A&lt;br /&gt;
|-&lt;br /&gt;
|0D||[[VariationalAction2/Airports | Airports]]||[[VariationalAction2/Towns | Town]] to which airport belongs&lt;br /&gt;
|-&lt;br /&gt;
|0E||[[VariationalAction2/Signals | Signals]]||N/A&lt;br /&gt;
|-&lt;br /&gt;
|0F||[[VariationalAction2/Objects | Objects]]||[[VariationalAction2/Towns | Town]] of object&lt;br /&gt;
|-&lt;br /&gt;
|10||[[VariationalAction2/Railtypes | Railtypes]]||N/A&lt;br /&gt;
|-&lt;br /&gt;
|11||[[VariationalAction2/Airport Tiles | Airport Tiles]]||[[VariationalAction2/Airports | Airport]] containing tile&lt;br /&gt;
|-&lt;br /&gt;
|12||[[VariationalAction2/Roadtypes | Roadtypes]]||N/A&lt;br /&gt;
|-&lt;br /&gt;
|13||[[VariationalAction2/Tramtypes | Tramtypes]]||N/A&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Every variable specifies a size for it. Not every variable is a doubleword.&lt;br /&gt;
If the accessed variable is smaller than the size given here, the extra bits may contain junk, and should be &amp;lt;and-masked&amp;gt; out.&lt;br /&gt;
&lt;br /&gt;
=== Variable ===&lt;br /&gt;
&lt;br /&gt;
Variational Action 2 allows accessing these variables:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!&#039;&#039;&#039;Number&#039;&#039;&#039;!![[GRFActionsDetailed|&#039;&#039;&#039;Size&#039;&#039;&#039;]]!!Version!!&#039;&#039;&#039;Meaning&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|00-3F|| || ||See [[GlobalVariables| global variables page]].&lt;br /&gt;
|-&lt;br /&gt;
|40+x||D|| ||specially calculated feature-specific variable, see following feature-specific pages&lt;br /&gt;
|-&lt;br /&gt;
|5F||D||{{ottdp|0.7|2.6|ttdprev=r1928}}||Feature-specific random data: triggers in low byte, bits in other three bytes. Bits of the variable not associated with random or trigger bits are reserved.&lt;br /&gt;
|-&lt;br /&gt;
|60+x||D|| ||similar to 40+x variables, but the variable number must be followed by a byte, which will be given to the variable handler as parameter.&lt;br /&gt;
|-&lt;br /&gt;
|7B||-||{{ottdp|1.1|2.6|ottdrev=r21604|ttdprev=r2359}}||A special 60+x variable to be used in Advanced Variational Action 2. It allows to evaluate any other 60+x variable using a non-constant parameter from a register. The parameter of variable 7B specifies another 60+x variable which is evaluated. The parameter for that variable is read from the accumulator (&#039;val1&#039;), i.e. the result from the preceding operations of the same Advanced Variational Action 2. Hence variable 7B may not be the first variable used in the calculation. Variable 7B itself and 7E (procedure call) are not allowed to be used as parameter for variable 7B.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.2|no|ottdrev=r23138}} Since OpenTTD r23138 you can use this to pass 32 bit parameters to 60+x variables. Currently this is only useful for a few variables, e.g. vehicle variable 60. For most variables the higher bits of the parameter are considered reserved. So, make sure to mask the higher bits in the preceding calculations.&lt;br /&gt;
|-&lt;br /&gt;
|7C||D||{{ottdp|0.6|2.6|ttdprev=r1315}}||A special 60+x variable used to access values stored in the registers of [[Storages#Persistent storage|persistent storage]].&lt;br /&gt;
|-&lt;br /&gt;
|7D||D||{{ottdp|0.6|2.6|ttdprev=r1246}}||A special 60+x variable used to access values stored in the registers of [[Storages#Temporary storage|temporary storage]]. Available in the purchase list.&lt;br /&gt;
|-&lt;br /&gt;
|7E||D||{{ottdp|0.6|2.5}}||A special 60+x variable indicating a [[VarAction2Advanced#Using procedures|procedure call]]. Available in the purchase list.&lt;br /&gt;
|-&lt;br /&gt;
|7F||D||{{ottdp|0.6|2.5}}||A special 60+x variable that reads GRF parameter whose number is given by the 60+x parameter. Available in the purchase list.&lt;br /&gt;
|-&lt;br /&gt;
|80+x|| || ||Feature-specific variable, see following feature-specific pages. While most of these variables actually refer to raw memory locations of original TTD structures, you cannot rely on that. Some variables were added later, some were moved or replaced. Only the variables listed in the specs are somewhat set to not be changed in the future.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For all features, the 80+x variables are offsets into the corresponding structure in TTD&#039;s game data. &amp;amp;nbsp;The 40+x and 60+x variables are special variables that are computed on-the-fly, and aren&#039;t actually stored anywhere in memory, unless stated otherwise. Therefore they should be used as little as necessary so as not to slow down the game too much with the calculation of these variables (which can be called thousands of times per second, whenever any vehicle moves).&lt;br /&gt;
&lt;br /&gt;
When displaying a vehicle (etc.) in the purchase list, the game will show those variations based on external variables (dates etc.) correctly, but variations based on vehicle variables (variables 40+x, 60+x and 80+x) will always show the first (not the default) cargo-ID unless otherwise specified for the given variable. If you do a calculation, the first cargo-ID will be selected if any of the needed variables is inaccessible.&lt;br /&gt;
&lt;br /&gt;
The lists of 80+x variables on the following pages are not exhaustive; only the useful variables are listed there. For a full list check the definition of corresponding structures in TTD. Marcin Grzegorczyk has a pretty good list of the structure definitions on his [http://marcin.ttdpatch.net/sv1codec/TTD-locations.html savegame internals page].&lt;br /&gt;
&lt;br /&gt;
=== varadjust ===&lt;br /&gt;
&lt;br /&gt;
Adjust variable to a more useful range. It has the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;  &amp;lt;shift-num&amp;gt; &amp;lt;and-mask&amp;gt; &amp;lt;nowiki&amp;gt;[&amp;lt;add-val&amp;gt; &amp;lt;divide-val&amp;gt;/&amp;lt;modulo-val&amp;gt;]&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!&#039;&#039;&#039;Element&#039;&#039;&#039;!![[GRFActionsDetailed|&#039;&#039;&#039;Size&#039;&#039;&#039;]]!!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|shift-num||B||value to right-shift the variable, and some special bits. See below.&lt;br /&gt;
|-&lt;br /&gt;
|and-mask||B/W/D||value with which to AND the variable after shifting. Return this value if neither bit 6 nor bit 7 of shift-num are set.&lt;br /&gt;
|-&lt;br /&gt;
|add-val||B/W/D||value to add to the variable after ANDing. Only present if bits 6 or 7 are set in shift-num.&lt;br /&gt;
|-&lt;br /&gt;
|divide-val||B/W/D||return the sum divided by this value. Only present if bit 6 is set in shift-num.&lt;br /&gt;
|-&lt;br /&gt;
|modulo-val||B/W/D||return the sum modulo (remainder of division by) this value. Only present if bit 7 is set in shift-num.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;shift-num&amp;gt; is a partial bit-mask; its bits have the following meanings:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit(s)!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0..4||0..1F||{{ottdp|0.6|2.0}}||number of bits to right shift &amp;lt;variable&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|0.6|2.5}}||This is an [[VarAction2Advanced|advanced VarAction2]]&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp|0.6|2.5}}||This is a shift-and-add-divide adjustment.&lt;br /&gt;
|-&lt;br /&gt;
|7||80||{{ottdp|0.6|2.5}}||This is a shift-and-add-modulo adjustment.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bits 6 and 7 may not both be set. If neither are set, this varadjust is a shift-and adjustment.&lt;br /&gt;
&lt;br /&gt;
Note that for the add and divide operations, both the variable and the divisor are taken to be signed numbers. This means that if the high bit is set, the number is taken to be negative, so you may need to mask out the most significant bit to do an unsigned division.&lt;br /&gt;
&lt;br /&gt;
=== nvar ===&lt;br /&gt;
&lt;br /&gt;
Here you set how many different ranges to check for. If the value of the variable, after the above manipulations, is not within one of these ranges, the default will be used. &amp;amp;nbsp;When displayed in the purchase window, the game will always show the first range if the variable is of the 40+x or 80+x type (because the variable is undefined since the vehicle doesn&#039;t exist yet).&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6|2.5|ttdprev=2.0.1 alpha 57}} Since TTDPatch 2.0.1 alpha 57, nvar=0 is a special case. Instead of using ranges, nvar=0 means that the result of an [[VarAction2Advanced|advanced]] calculation (or, if no calculation is performed, the adjusted variable value itself) is returned as callback result, with bit 15 set. &amp;amp;nbsp;This is useful for those callbacks where many different return values are possible and it is easier to calculate them than list them in ranges. &amp;amp;nbsp;The default value must still be specified, and will be used in case the variable(s) used are not available.&lt;br /&gt;
&lt;br /&gt;
=== sets and ranges ===&lt;br /&gt;
&lt;br /&gt;
For each of the ranges to check, you give the set-id as a &#039;&#039;&#039;WORD&#039;&#039;&#039; value:&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
!Set-id!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0000..00FF|| ||Chain to the preceding Action2 with given group id.&lt;br /&gt;
|-&lt;br /&gt;
|7FFE||{{ottdp|15|no}}||Return the result of an [[VarAction2Advanced|advanced]] calculation (or, if no calculation is performed, the adjusted variable value itself) as callback result, with bit 15 set. (same behaviour as the &amp;quot;nvar=0&amp;quot; case, but only for results in the range)&lt;br /&gt;
|-&lt;br /&gt;
|7FFF||{{ottdp|15|no}}||Return &amp;quot;callback failed&amp;quot;/&amp;quot;sprite resolving failed&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|8000..FEFF|| ||Return callback result with value 0000..7EFF.&lt;br /&gt;
|-&lt;br /&gt;
|FF00..FFFF||{{grf|≤7}}||Return callback result with value 00..FF.&lt;br /&gt;
|-&lt;br /&gt;
|8000..FFFF||{{grf|≥8}}||Return callback result with value 0000..7FFF.&lt;br /&gt;
|}&lt;br /&gt;
The first range that matches will be used.&lt;br /&gt;
&lt;br /&gt;
If there is an error during evaluating the variables (e.g. variable not available), the first range is picked.&lt;br /&gt;
The error case can be isolated by using an empty/invalid range, e.g. from 1 to 0.&lt;br /&gt;
&lt;br /&gt;
The various \b, \w, and \d escape sequences can be useful for &amp;lt;min-range&amp;gt; and &amp;lt;max-range&amp;gt;. See [[GRFActionsDetailed#Byte order|the discussion of escape sequences]] for further information.&lt;br /&gt;
&lt;br /&gt;
=== default ===&lt;br /&gt;
&lt;br /&gt;
The set-id to use if none of the ranges matches.&lt;br /&gt;
&lt;br /&gt;
=Example=&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 -1 * 15       02 05 03 81        // Action2, Feature 05 (canals), action2ID 03, 1-byte variable&lt;br /&gt;
                   81 00 04       // variable 81 (terrain type), shift 00, mask 0x04 (=bit for &amp;quot;on or above snowline&amp;quot;)&lt;br /&gt;
                   01             // check one range&lt;br /&gt;
                   02 00    04 04 // snowy tile: link to action2ID 02&lt;br /&gt;
                   01 00          // default:    link to action2ID 01&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action3&amp;diff=5019</id>
		<title>Action3</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action3&amp;diff=5019"/>
		<updated>2025-05-13T12:55:36Z</updated>

		<summary type="html">&lt;p&gt;Frosch: houses and other in purchase list&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Action 3 assigns graphics sets (referenced to by (chains of) [[Action2|action 2(s]]) to feature IDs (vehicles, stations, houses, industries, ...).&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format of the data is feature-dependent.&lt;br /&gt;
&lt;br /&gt;
The data is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; &amp;amp;lt;Sprite-number&amp;amp;gt; * &amp;amp;lt;Length&amp;amp;gt; 03 &amp;amp;lt;feature&amp;amp;gt; &amp;amp;lt;n-id&amp;amp;gt; &amp;amp;lt;ids...&amp;amp;gt; &amp;amp;lt;num-cid&amp;amp;gt; (&amp;amp;lt;cargo-type&amp;amp;gt; &amp;amp;lt;set-ID&amp;amp;gt;)... &amp;amp;lt;default set-ID&amp;amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Element&#039;&#039;&#039;&lt;br /&gt;
![[GRFActionsDetailed|&#039;&#039;&#039;Size&#039;&#039;&#039;]]&lt;br /&gt;
!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;Sprite-number&amp;amp;gt;&lt;br /&gt;
|dec&lt;br /&gt;
|A sequential sprite number&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;length&amp;amp;gt;&lt;br /&gt;
|dec&lt;br /&gt;
|The total number of bytes used in this action&lt;br /&gt;
|-&lt;br /&gt;
|03&lt;br /&gt;
|B&lt;br /&gt;
|Defines action 03&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;feature&amp;amp;gt;&lt;br /&gt;
|B&lt;br /&gt;
|What type of feature the IDs refer to&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;n-id&amp;amp;gt;&lt;br /&gt;
|B&lt;br /&gt;
|Number of IDs this action 3 associates graphics with&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;ids...&amp;amp;gt;&lt;br /&gt;
|B/B*&lt;br /&gt;
|IDs of the current feature this action 3 associates graphics with. There must be as many IDs as &amp;amp;lt;n-id&amp;amp;gt; specifies&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;num-cid&amp;amp;gt;&lt;br /&gt;
|B&lt;br /&gt;
|Number of different cargo types to support&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;cargo-type&amp;amp;gt;&lt;br /&gt;
|B&lt;br /&gt;
|Cargo type for which to use the following set-ID&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;set-ID&amp;amp;gt;&lt;br /&gt;
|W&lt;br /&gt;
|Set-ID (from action 2 or from a varaction2 chain) to use for this cargo type&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;default set-ID&amp;amp;gt;&lt;br /&gt;
|W&lt;br /&gt;
|Default set-ID to use if none of the above matches&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite-number ===&lt;br /&gt;
&lt;br /&gt;
This is just the number you are at.&lt;br /&gt;
&lt;br /&gt;
=== Length ===&lt;br /&gt;
&lt;br /&gt;
Count the number of bytes in this action.&lt;br /&gt;
&lt;br /&gt;
=== Feature ===&lt;br /&gt;
&lt;br /&gt;
This sets the type of [[Features|feature]] that you wish to change. Set it to:&lt;br /&gt;
&lt;br /&gt;
{|- |&lt;br /&gt;
!Value!![[Features|Feature]]&lt;br /&gt;
|-&lt;br /&gt;
|00||Trains&lt;br /&gt;
|-&lt;br /&gt;
|01||Road Vehicles&lt;br /&gt;
|-&lt;br /&gt;
|02||Ships&lt;br /&gt;
|-&lt;br /&gt;
|03||Aircraft&lt;br /&gt;
|-&lt;br /&gt;
|04||Stations&lt;br /&gt;
|-&lt;br /&gt;
|05||[[Action3/Canals|Canals/Rivers]]&lt;br /&gt;
|-&lt;br /&gt;
|07||Houses&lt;br /&gt;
|-&lt;br /&gt;
|09||Industry Tiles&lt;br /&gt;
|-&lt;br /&gt;
|0A||Industries&lt;br /&gt;
|-&lt;br /&gt;
|0B||Cargos&lt;br /&gt;
|-&lt;br /&gt;
|0C||Sound Effects (generic callback only)&lt;br /&gt;
|-&lt;br /&gt;
|0D||Airports&lt;br /&gt;
|-&lt;br /&gt;
|0E||Signals (generic callback only)&lt;br /&gt;
|-&lt;br /&gt;
|0F||Objects&lt;br /&gt;
|-&lt;br /&gt;
|10||[[Action3/Railtypes|Railtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|11||Airport Tiles&lt;br /&gt;
|-&lt;br /&gt;
|12||[[Action3/Roadtypes|Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|13||[[Action3/Tramtypes|Tramtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|14||Road Stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== n-id ===&lt;br /&gt;
&lt;br /&gt;
How many items of the current feature this action 3 defines new graphics for. If this is more than one, all items listed will get the same graphics. If this value has bit 7 set (i.e. 80 added), it is a wagon override. See [[Action3LiveryOverride|Action 3 - Livery Override]] for more info on this feature.&lt;br /&gt;
&lt;br /&gt;
You can make a definition with n-id equal to zero (and thus no ids that follow). &amp;amp;nbsp;This creates a generic feature-specific definition not associated with any particular item. &amp;amp;nbsp;At the moment, this is used for generic callbacks, but might be extended to other functions eventually.&lt;br /&gt;
&lt;br /&gt;
=== ids ===&lt;br /&gt;
&lt;br /&gt;
Feature IDs to use this action 3 for. All IDs are counted from the first of their class, i.e. the first road vehicle has 00, as does the first plane, the first ship, and the first train vehicle.&lt;br /&gt;
&lt;br /&gt;
In OpenTTD since r13482, each ID is an extended byte for vehicles, otherwise the ID is a regular byte.&lt;br /&gt;
&lt;br /&gt;
Since OpenTTD 14.0, each ID is an extended byte for all features.&lt;br /&gt;
&lt;br /&gt;
For canals and rivers the id has a special meaning, see its [[Action3/Canals|own Action 3 page]]&lt;br /&gt;
&lt;br /&gt;
For town buildings, the IDs are the house IDs, and specifying a house ID that haven&#039;t been defined before (by setting its property 08) doesn&#039;t do anything, but doesn&#039;t cause an error, either. Note that you don&#039;t necessarily have to assign a set-ID to a house ID, the old TTD sprite of the substitute type will be used if you don&#039;t do so. &amp;amp;nbsp;Industry tile IDs work in the same manner.&lt;br /&gt;
&lt;br /&gt;
=== num-cid ===&lt;br /&gt;
&lt;br /&gt;
Number of cargo type definitions that follow. Can be zero if only the default follows.&lt;br /&gt;
&lt;br /&gt;
For features 05 (canals/rivers), 07 (houses), 09 (industry tiles), 0A (industries), and 0B (cargoes) this must always be zero.&lt;br /&gt;
&lt;br /&gt;
=== cargo-type ===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
! Feature !! cids&lt;br /&gt;
|-&lt;br /&gt;
| 00..03 vehicles ||&lt;br /&gt;
* 00..FE: cargo-type (index in [[Action0/Global Settings#Cargo translation table 09|cargo translation table]]; cargobit if no table present)&lt;br /&gt;
* FF: purchase list &amp;lt;ref&amp;gt;For dual-headed trains (prop 13) special rules for the purchase menu sprite apply: two sprites are drawn (for front and back) as if the vehicle is normally constructed. If you supply one purchase menu sprite, it will be used for both vehicle parts in the purchase menu. Provide a set of 8 sprites, and the 7th resp. 3rd sprite will&lt;br /&gt;
be drawn; provide a set of 8 blank sprites except the 7th if you want to fully control a single purchase menu sprite for a dual-headed engine.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* default: used if none of the listed cids apply&lt;br /&gt;
|-&lt;br /&gt;
| 04 stations ||&lt;br /&gt;
* 00..FD: cargo-type (index in [[Action0/Global Settings#Cargo translation table 09|cargo translation table]]; cargobit if no table present) waiting at the station. The waiting amount of this cargo is used in [[Action2/Stations|Action2]] to decide the spriteset.&lt;br /&gt;
* FE: used if none of the listed cids apply. [[Action2/Stations|Action2]] will assume &amp;quot;zero waiting cargo&amp;quot;.&lt;br /&gt;
* FF: purchase list&lt;br /&gt;
* default: used if none of the listed cids apply. [[Action2/Stations|Action2]] will use &amp;quot;sum of all waiting cargos&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| 05 canals || default only&lt;br /&gt;
|-&lt;br /&gt;
| 07 houses ||&lt;br /&gt;
* FF: {{ottdp|15|no}} purchase list (callbacks when not constructed yet; and house picker GUI)&lt;br /&gt;
* default: used if none of the listed cids apply&lt;br /&gt;
|-&lt;br /&gt;
| 09 industry tiles ||&lt;br /&gt;
* FF: {{ottdp|15|no}} purchase list (callbacks when not constructed yet)&lt;br /&gt;
* default: used if none of the listed cids apply&lt;br /&gt;
|-&lt;br /&gt;
| 0A industries ||&lt;br /&gt;
* FF: {{ottdp|15|no}} purchase list (callbacks when not constructed yet)&lt;br /&gt;
* default: used if none of the listed cids apply&lt;br /&gt;
|-&lt;br /&gt;
| 0B cargos || default only&lt;br /&gt;
|-&lt;br /&gt;
| 0C sound effects || default only&lt;br /&gt;
|-&lt;br /&gt;
| 0D airports ||&lt;br /&gt;
* FF: {{ottdp|15|no}} purchase list (callbacks when not constructed yet)&lt;br /&gt;
* default: used if none of the listed cids apply&lt;br /&gt;
|-&lt;br /&gt;
| 0E signals || default only&lt;br /&gt;
|-&lt;br /&gt;
| 0F objects ||&lt;br /&gt;
* FF: purchase list&lt;br /&gt;
* default: used if none of the listed cids apply&lt;br /&gt;
|-&lt;br /&gt;
| 10 rail types || special cids, see [[Action3/Railtypes#cargo-type|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 11 airport tiles ||&lt;br /&gt;
* FF: {{ottdp|15|no}} purchase list (callbacks when not constructed yet)&lt;br /&gt;
* default: used if none of the listed cids apply&lt;br /&gt;
|-&lt;br /&gt;
| 12 road types || special cids, see [[Action3/Tramtypes#cargo-type|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 13 tram types || special cids, see [[Action3/Roadtypes#cargo-type|here]]&lt;br /&gt;
|-&lt;br /&gt;
| 14 road stops ||&lt;br /&gt;
* 00..FD: cargo-type (index in [[Action0/Global Settings#Cargo translation table 09|cargo translation table]]; cargobit if no table present) waiting at the road stop.&lt;br /&gt;
* FE: used if none of the listed cids apply.&lt;br /&gt;
* FF: purchase list&lt;br /&gt;
* default: used if none of the listed cids apply.&lt;br /&gt;
|-&lt;br /&gt;
| 15 badges || special cids:&lt;br /&gt;
* 00..14: feature&lt;br /&gt;
* default: used if specific feature is not assigned.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== default set-ID ===&lt;br /&gt;
&lt;br /&gt;
Default set-ID if no entry from the cargo-type list above matches, or if there are no special cargo-types listed at all.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Below is an example of what a real action 3 pseudo-sprite could look like for a train engine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; 13 * 7 &amp;amp;nbsp; 03 00 01 02 00 00 00&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Byte&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Meaning&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|13&lt;br /&gt;
|&amp;amp;lt;sprite-number&amp;amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|&amp;amp;lt;length&amp;amp;gt; of the action in bytes; start counting at 03 (&amp;amp;lt;action&amp;amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|03&lt;br /&gt;
|&amp;amp;lt;action&amp;amp;gt;: sets this pseudo-sprite to function as action 3&lt;br /&gt;
|-&lt;br /&gt;
|00&lt;br /&gt;
|&amp;amp;lt;feature&amp;amp;gt;: 00 for trains&lt;br /&gt;
|-&lt;br /&gt;
|01&lt;br /&gt;
|&amp;amp;lt;n-id&amp;amp;gt;: One ID to change in this case&lt;br /&gt;
|-&lt;br /&gt;
|02&lt;br /&gt;
|&amp;amp;lt;ids...&amp;amp;gt;: vehicle ID (02 - Ploddyphut Choo-Choo)&lt;br /&gt;
|-&lt;br /&gt;
|00&lt;br /&gt;
|&amp;amp;lt;num-cid&amp;amp;gt;: this engine doesn&#039;t have cargo-specific graphics&lt;br /&gt;
|-&lt;br /&gt;
|00 00&lt;br /&gt;
|&amp;amp;lt;default set-ID&amp;amp;gt;: Use action 2 ID 00, because it is a word value you add 00&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5018</id>
		<title>Action0/Industry Tiles</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5018"/>
		<updated>2025-04-26T14:29:49Z</updated>

		<summary type="html">&lt;p&gt;Frosch: ottd 15 additions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Industry tiles work similarly to town buildings, except that they are not stand-alone; they are always part of an industry.&lt;br /&gt;
&lt;br /&gt;
Defining industry tiles follows the same schema as houses do: to start using an ID, you first need to define it by setting property 8 for it. If you try to reference an ID (either via action0 or via action3) that isn&#039;t defined, your request is ignored, but not reported as an error, either. This means that if you want to conditionally define an ID, all you need to do is skipping the action0 that sets property8, and everything else gets skipped automatically.&lt;br /&gt;
&lt;br /&gt;
Industry tile IDs are unique within each grf file. The per-GRF ID is specified as a byte, which means no GRF can define more than 256 tile IDs. You should use your industry tile IDs sparingly. [[VariationalAction2/Industry_Tiles#Relative_position_.2843.29| Variational action 2 variable 43]] for industry tiles can help you limiting tile consumption to 2 or 3 per industry. Avoid using tile FFh, so the tileID can be turned into an extended byte (in Action 3) in the distant future without breaking your NewGRF.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} In total, TTDPatch can have up to a total of 256 new industry tile IDs (i.e. old tile types don&#039;t count).&lt;br /&gt;
&lt;br /&gt;
{{ottd|}} OpenTTD can have 512 IDs for all active grf files, but that includes non-overridden original tiles.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property !![[GRFActionsDetailed|Size]] !!Version !! Description&lt;br /&gt;
|-&lt;br /&gt;
|08||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Substitute building type&lt;br /&gt;
|-&lt;br /&gt;
|09||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Industry tile override&lt;br /&gt;
|-&lt;br /&gt;
|0A,0B,0C||W||{{ottdp|0.6|2.5}}||Tile acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 49}}||Land shape flags&lt;br /&gt;
|-&lt;br /&gt;
|0E||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0F||W||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|10||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation speed.&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Triggers for callback 25&lt;br /&gt;
|-&lt;br /&gt;
|12||B||{{ottdp|0.6|2.5|ttdprev=beta 2}}||Special flags&lt;br /&gt;
|-&lt;br /&gt;
|13||V||{{ottdp|1.9|no|ottdrev=e66cec8f}}||Tile acceptance list&lt;br /&gt;
|-&lt;br /&gt;
|14||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute tile type (08) ===&lt;br /&gt;
&lt;br /&gt;
This tile type will be used instead of your new one if your definition isn&#039;t available for any reason. Valid values are [http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#Class8 00h-AEh]. Assigning this property copies the properties of the old type just like it does with houses.&lt;br /&gt;
&lt;br /&gt;
If this tile&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Industry tile override (09) ===&lt;br /&gt;
&lt;br /&gt;
Works like the house override property for houses.&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance (0A, 0B, 0C) ===&lt;br /&gt;
&lt;br /&gt;
These three words define what cargoes the tile accepts, and how much of them. The low byte defines the type of the cargo according to the current climate, while the high byte defines the degree of acceptance in 1/8 units. If you don&#039;t need all three cargo types, just zero out the high byte of the extra properties.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|7}} From GRF version 7 and above, the meaning of the low byte changes: instead of a climate-dependent cargo slot number, you have to give a climate-independent cargo ID. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it&#039;s the cargo bit. Acceptance of cargoes not currently present will automatically be disabled.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} These properties only support three cargos. Use property 13 instead to list more cargo types. &lt;br /&gt;
&lt;br /&gt;
=== Land shape flags (0D) ===&lt;br /&gt;
&lt;br /&gt;
This property defines which slopes the tile can be built on.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||NW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||NE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||SW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||SE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5}}||Can only be built on flat land&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||The tile is allowed on both land and water&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Industry tiles are never built on steep slopes unless [[Callbacks#Custom shape check (2F) |callback 2F]] is enabled, but bits 0..4 are ignored in that case.&lt;br /&gt;
&lt;br /&gt;
Bit 5 can be used to allow tiles of land industries built on water or vice versa. It effectively disables the land/water check code for the tile. If you need to customize the behavior further, you can use [[Callbacks#Custom shape check (2F) |callback 2F]] to decide what kind of water/land is allowed.&lt;br /&gt;
&lt;br /&gt;
;&#039;&#039;&#039;PLEASE NOTE&#039;&#039;&#039;: Be careful when setting this property. If you fail to set it correctly, your industry may end up building on a hillside, which is probably not what you want. The easiest way is to set bit 4 for middle tiles, bit 0 for the tiles along the SE edge, bit 1 for those along the SW edge and so on.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0E) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!value!!version!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp| | }}||use [[Callbacks#Next animation frame (1A/26/141/153/158) |callback 26]] to decide the next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp| | }}||use [[Callbacks#Length of animation frame (20/27/142/154/15A) |callback 27]] to decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Decide cargo acceptance (2B) |callback 2B]] to decide amount of acceptance&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Get accepted cargo types (2A/2C) |callback 2C]] to decide accepted types&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp| | }}||use [[Callbacks#Custom shape check (2F) |callback 2F]] to check if a slope is suitable&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp| | }}||use [[Callbacks#Decide drawing default foundations (30/14E/150) |callback 30]] to decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp| |2.5|ttdprev=beta 3}}||use [[Callbacks#Disable autosloping (3C/14F/15D) |callback 3C]] to allow or deny autosloping below the tile&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please note that [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] doesn&#039;t have a bit here. To use [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]], simply set the wanted bits in property 11 and it will work as intended.&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0F) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this tile (this is the default value).&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (10) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Triggers for [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] (11) ===&lt;br /&gt;
&lt;br /&gt;
Call [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] when:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property bit, var 18 byte 0!!Property value!!Version!!Meaning||Happens on||Var 18 byte 1&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||the construction state changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time.&amp;lt;br&amp;gt;{{ttdp|}} For the first call to happen, you also have to set [[Action0/Industry_Tiles#Animation_information_.280F.29|property 0F]] to some other value than 0xFFFF.&amp;lt;/ref&amp;gt;||single tile||{{ottdp|15|no}} First call &amp;lt;ref&amp;gt;Var 18 bit 8 is set, if the callback is called the first time for a new industry. In-game the construction stage will be zero, at map generation and in scenario editor, it will be 3.&amp;lt;br&amp;gt;Other bits of var 18 are reserved, and must be masked.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||the tile is processed in the periodic processing loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||the industry of the tile is processed in the periodic processing loop (synchronized animation)||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||the industry of the tile receives input cargo from a station||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5|ttdprev=beta 2}}||the industry distributes its output cargo to one of the stations nearby||all tiles||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently no trigger provides additional information in var 18 bytes 1 to 3.&lt;br /&gt;
&lt;br /&gt;
=== Special flags (12) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||[[Callbacks#Next animation frame (1A/26/141/153/158) |Callback 26]] needs random bits&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.9|no|ottdrev=e66cec8f}} In addition to the cargotypes set by property 0A..0C and 13, the tile accepts all cargotypes which the industry accepts.&lt;br /&gt;
* This considers industry properties 11 and 26 and callback 14B.&lt;br /&gt;
* This does not consider industry callback 3D.&lt;br /&gt;
* This property adds 8/8 acceptance for the matching cargotypes. You can list negative acceptances (-8/8) in property 13 to exclude specific cargos.&lt;br /&gt;
* Tile callback 2C overrides all acceptances including those added by this flag.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance list (13) ===&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} &lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
 &amp;lt;numinput&amp;gt; (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;)*&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Variable!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||numinput||Number of (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;) pairs to follow,&lt;br /&gt;
|-&lt;br /&gt;
|B||cargotype||Cargotype (from CTT) to accept.&lt;br /&gt;
|-&lt;br /&gt;
|B||acceptance||Acceptance in 1/8 units. May be negative to negate property 12 bit 1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property defines up to 16 cargotypes, which are accepted by the industry tile.&lt;br /&gt;
Use this property instead of property 0A..0C.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Stations&amp;diff=5017</id>
		<title>Action0/Stations</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Stations&amp;diff=5017"/>
		<updated>2025-04-26T14:27:35Z</updated>

		<summary type="html">&lt;p&gt;Frosch: ottd 15 additions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Defining properties of new stations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unlike vehicles, the new stations have no equivalent in TTD. The IDs are therefore free to be chosen and will in fact be allocated automatically. In action 0, you only specify IDs relative to the set, i.e. the ID of the first station type is 00, the second station type is 01 and so on.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} In TTDPatch each game can only have 255 station IDs for all active grf files.&lt;br /&gt;
&lt;br /&gt;
The only property you &#039;&#039;&#039;must&#039;&#039;&#039; set for each station ID is 08 (in addition to defining an [[Action3|action 3]] for it), anything else can be left at the default. It must be the first property you set for each station ID, because the station ID is actually undefined until it has been assigned a class through property 08. Also, all station IDs must get their classes in the right order, starting from ID 00 onwards.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||D||{{ottdp|0.6|2.5|ttdprev=alpha 19}}||Class ID, see below&lt;br /&gt;
|-&lt;br /&gt;
|09||V||{{ottdp|0.6|2.5|ttdprev=alpha 20}}||Sprite layout, see below&lt;br /&gt;
|-&lt;br /&gt;
|0A||B/B*||{{ottdp|0.6|2.5|ttdprev=alpha 20}}/{{ottdp|14.0}}||Copy sprite layout&lt;br /&gt;
|-&lt;br /&gt;
|0B||B||{{ottdp|0.6|2.5|ttdprev=alpha 22}}||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0C||B||{{ottdp|0.6|2.5|ttdprev=alpha 22}}||Bit mask of disabled numbers of platforms&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 22}}||Bit mask of disabled platform lengths&lt;br /&gt;
|-&lt;br /&gt;
|0E||V||{{ottdp|0.6|2.5|ttdprev=alpha 22}}||Define custom layout, see below&lt;br /&gt;
|-&lt;br /&gt;
|0F||B/B*||{{ottdp|0.6|2.5|ttdprev=alpha 22}}/{{ottdp|14.0}}||Copy custom layout from stationid given by argument&lt;br /&gt;
|-&lt;br /&gt;
|10||W||{{ottdp|0.6|2.5|ttdprev=alpha 25}}||Little/lots threshold&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 27}}||Pylon placement&lt;br /&gt;
|-&lt;br /&gt;
|12||D||{{ottdp|0.6|2.5|ttdprev=alpha 30}}||Bit mask of cargo type triggers for random sprites&lt;br /&gt;
|-&lt;br /&gt;
|13||B||{{ottdp|0.6|2.5|ttdprev=alpha 30}}||General flags&lt;br /&gt;
|-&lt;br /&gt;
|14||B||{{ottdp|0.6|2.5|ttdprev=alpha 47}}||Overhead wire placement&lt;br /&gt;
|-&lt;br /&gt;
|15||B||{{ottdp|0.6|2.5|ttdprev=alpha 51}}||Can train enter tile&lt;br /&gt;
|-&lt;br /&gt;
|16||W||{{ottdp|0.7|2.5|ttdprev=beta 9}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|17||B||{{ottdp|0.7|2.5|ttdprev=beta 9}}||Animation speed&lt;br /&gt;
|-&lt;br /&gt;
|18||W||{{ottdp|0.7|2.5|ttdprev=beta 9}}||Animation triggers&lt;br /&gt;
|-&lt;br /&gt;
|1A||V||{{ottdp|1.2|no|ottdrev=r22518}}||Advanced sprite layout with register modifiers&lt;br /&gt;
|-&lt;br /&gt;
|1B|| || ||Reserved&lt;br /&gt;
|-&lt;br /&gt;
|1C||W||{{ottdp|14}}||Station name&lt;br /&gt;
|-&lt;br /&gt;
|1D||W||{{ottdp|14}}||Station class name&lt;br /&gt;
|-&lt;br /&gt;
|1E||V||{{ottdp|15}}||Station sprite layout flags&lt;br /&gt;
|-&lt;br /&gt;
|1F||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unofficial additions and changes. Don&#039;t rely on them to ever work this way in OpenTTD or TTDPatch:&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description&lt;br /&gt;
|-&lt;br /&gt;
|1B||8*B||whatever-PP||Minimum bridge height for bridges over stations&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Station class (08) ===&lt;br /&gt;
TTDPatch groups sets of new station graphics into various classes. &amp;amp;nbsp;The classes can be selected by the top dropdown list in the construction window, and the individual stations within the class from the bottom dropdown list. &amp;amp;nbsp;In addition, each station can alter its appearance using [[VariationalAction2|variational]] and/or [[RandomAction2|random]] action 2 entries.&lt;br /&gt;
&lt;br /&gt;
Only two classes are pre-defined:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Name!!Class ID!!Intended use for station&lt;br /&gt;
|-&lt;br /&gt;
|DFLT||44 46 4C 54||Default, no special station type&lt;br /&gt;
|-&lt;br /&gt;
|WAYP||57 41 59 50||Non-cargo stations, waypoints, signal boxes etc.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may simply use other classes than the above, as long as no more than (at the moment) 16 classes are used among all active .grf files at any time.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Station classes which start with the byte FF are considered waypoint classes, and will appear in the waypoint construction window instead of the station construction window.&lt;br /&gt;
&lt;br /&gt;
When a waypoint station is built, it will not accept cargo nor will any cargo appear from nearby industries or towns. &amp;amp;nbsp;Trains will not stop at waypoint stations, regardless of the non-stop order and/or the nonstop switch.&lt;br /&gt;
&lt;br /&gt;
=== Sprite layout (09) ===&lt;br /&gt;
This controls what sprites are displayed, where they are displayed, and in what order. &amp;amp;nbsp;The property is variable sized, and contains the data for all 8 possible station tile types. &amp;amp;nbsp;If this property is set, the num-ent in the corresponding [[Action1|action 1]] need not be equal to 12 (hex), it can in fact be any number, and any number of sprites can be displayed in any order.&lt;br /&gt;
&lt;br /&gt;
The data is specified as data for all eight tiles in this way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;amp;lt;num&amp;amp;gt; &amp;amp;lt;data1&amp;amp;gt; &amp;amp;lt;data2&amp;amp;gt; ... &amp;amp;lt;datan&amp;amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B*||num||Number of different tiles supported (see below)&lt;br /&gt;
|-&lt;br /&gt;
|V||data1...||The variable size data for each of the &amp;amp;lt;num&amp;amp;gt; tiles, as specified below&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Number of tiles supported =====&lt;br /&gt;
* Normally this is 8, but you can specify fewer as well&lt;br /&gt;
* Using callback flags bit 1, specifying more makes sense too&lt;br /&gt;
* This value must be the same for all stations set by this action 0, even though it must be repeated for the prop. 09 definition of each station ID as well&lt;br /&gt;
&lt;br /&gt;
(Note that num is an extended byte, see [[GRFActionsDetailed]].)&lt;br /&gt;
&lt;br /&gt;
The content of each of the (usually eight) data sets is either a new sprite layout:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|D||groundsprite||the sprite to draw for the rails; this is by default a TTD sprite, but with bit 31 set an [[Action1|action 1]] sprite (42D+X) may be specified&lt;br /&gt;
|-&lt;br /&gt;
|V||spritedata||the data for station sprites, see below; each has a size of 10 bytes, and there may be several&lt;br /&gt;
|-&lt;br /&gt;
|B||80||a literal 80 ends the list of sprites for this tile&lt;br /&gt;
|}&lt;br /&gt;
or, alternatively, the instruction to use TTD&#039;s layout by using four zero bytes 00 00 00 00 instead of the groundsprite bytes. You can use [http://www.bytetransfer.de/projects/ttdpatch/docs/spriteidmapping.php the online sprite ID converter] to look up the sprite IDs you can use for all the climates.&lt;br /&gt;
&lt;br /&gt;
One can draw two types of sprites. &amp;amp;nbsp;One type is one that establishes a new 3D bounding box for use by the sprite sorter. &amp;amp;nbsp;The other type shares the 3D bounding box of the previous sprite(s). &amp;amp;nbsp;It must not be larger than the sprite which established the bounding box, nor must any part of it be outside this box. &amp;amp;nbsp;For simplicity, it should have the exact same dimensions as the sprite it shares the bounding box with. &amp;amp;nbsp;The latter type is supported in the station construction window display only since TTDPatch 2.6 r1684.&lt;br /&gt;
&lt;br /&gt;
The spritedata of sprites with their own bounding box has this format:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||xofs||x-offset from northern tile corner&lt;br /&gt;
|-&lt;br /&gt;
|B||yofs||y-offset from northern tile corner&lt;br /&gt;
|-&lt;br /&gt;
|B||zofs||z-offset from northern tile corner&lt;br /&gt;
|-&lt;br /&gt;
|B||xextent||size of sprite in x direction&lt;br /&gt;
|-&lt;br /&gt;
|B||yextent||size of sprite in y direction&lt;br /&gt;
|-&lt;br /&gt;
|B||zextent||size of sprite in z direction&lt;br /&gt;
|-&lt;br /&gt;
|D||sprite||sprite number to draw&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The spritedata of sprites sharing the bounding box has this format:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||xofs||x-offset relative to previous sprite&lt;br /&gt;
|-&lt;br /&gt;
|B||yofs||y-offset relative to previous sprite&lt;br /&gt;
|-&lt;br /&gt;
|B||80||a literal 80&lt;br /&gt;
|-&lt;br /&gt;
|B||00||(ignored)&lt;br /&gt;
|-&lt;br /&gt;
|B||00||(ignored)&lt;br /&gt;
|-&lt;br /&gt;
|B||00||(ignored)&lt;br /&gt;
|-&lt;br /&gt;
|D||sprite||sprite number to draw&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Since OpenTTD r18959 you can draw multiple ground sprites for a tile, which is useful if you want to use the usual rail/grass/concrete groundtile, but still need to add features to it without using a new bounding box. To do so use the syntax of sprites sharing the previous bounding box, but use it before the first bounding box definition. xpixeloffset and ypixeloffset refer to the usual spot of groundtiles. The same feature is also partially supported in TTDPatch since TTDPatch 2.6 r2312: TTDPatch ignores the xofs and yofs fields and always uses (0,0) for the offset. If you are developing a GRF that needs to be compatible with both OpenTTD and TTDPatch, you should always keep xofs and yofs zero to get the same effect in both games.&lt;br /&gt;
Note however that both implementations do not consider the [[Action0/Stations#General_Flags_.2813.29|setting of prop13 bit 0]], hence these &amp;quot;multiple ground sprites&amp;quot; have to be always part of the building sprites set and cannot be part of the different sprite set for ground sprites.&lt;br /&gt;
&lt;br /&gt;
The sprite number can have the following values (remember to use little endian, i.e. reversed byte order):&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Sprite&lt;br /&gt;
|-&lt;br /&gt;
|0000042D+X||use sprite X from the corresponding [[Action1|action 1]] block (i.e. 0000042D for the first, 0000042E for the second, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|0000842D+X||same, but draw it using company colour translation&lt;br /&gt;
|-&lt;br /&gt;
|0322442D+X||same, but draw in transparent mode (actual colours of the sprite are disregarded entirely); supported in station construction window display since TTDPatch 2.6 r1683&lt;br /&gt;
|-&lt;br /&gt;
|RRRR842D+X||draw sprite with colour translation defined in sprite RRRR; available since TTDPatch 2.6 r1683&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
With bit 31 set, this sprite will refer to a TTD sprite, not the action 1 sprite. For the first ground sprite the reverse meaning applies.&lt;br /&gt;
&lt;br /&gt;
Depending on the railtype the sprites may get additional offsets:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
! !! Normal/electrified rail !! Monorail !! Maglev&lt;br /&gt;
|-&lt;br /&gt;
|TTD sprites || 0 || 82 || 164&lt;br /&gt;
|-&lt;br /&gt;
|Action 1 sprite (first ground sprite) || 0 || 1 || 2&lt;br /&gt;
|-&lt;br /&gt;
|Action 1 sprite (other sprites in the layout) || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
So, TTD sprites and the first ground sprite are affected by the railtype, while other action 1 sprites in the layout are not. The offset &amp;quot;82&amp;quot; refers to the offset between the default TTD track sprites; if you are using non-track ground sprites which are not from an action 1, you need to supply fake spritenumbers which preemptively reverse the offsets (that is, you need different sprite layouts for every railtype your station is available for).&lt;br /&gt;
&lt;br /&gt;
Setting bit 30 forces this sprite to be displayed normally even in &amp;quot;transparent buildings&amp;quot; mode (supported only in TTDPatch 2.6 r1695 and later).&lt;br /&gt;
&lt;br /&gt;
See below for an example of linked sprites as well as transparent sprites (e.g. for a station roof).&lt;br /&gt;
&lt;br /&gt;
Note that the coordinates here are 3D coordinates with x running from top-right to bottom-left and y running from top-left to bottom-right, with the tile dimensions being 16x16 (and 8 for one height level). This means the x and y values should always be within 0-15 (decimal).&lt;br /&gt;
&lt;br /&gt;
This is different to and independent from the x/y offsets used in the actual .NFO file. &amp;amp;nbsp;The 3D bounding box is used by TTD&#039;s sprite sorter to figure out the order in which to draw the sprites, as well as telling it which sprites to draw, because those whose bounding box falls outside the currently updated screen rectangle will not be drawn. &amp;amp;nbsp;Make sure the 3D bounding box is large enough to contain the entire sprite, but not so large that the sprite sorter can&#039;t determine which sprites should be in front.&lt;br /&gt;
&lt;br /&gt;
This means that the order in which you specify sprites is irrelevant. &amp;amp;nbsp;Sprites will get drawn from back to front, in the order which the sprite sorter determines as correct, from their bounding boxes. &amp;amp;nbsp;There are two exceptions, however:&lt;br /&gt;
* Sprites sharing the same bounding box will always be drawn in the given order.&lt;br /&gt;
* The station construction window display doesn&#039;t use the sprite sorter. Tiles that may be displayed in that window need to be specified in the correct drawing order, back to front.&lt;br /&gt;
&lt;br /&gt;
=== Copy sprite layout (0A) ===&lt;br /&gt;
&lt;br /&gt;
This is not a property as such, but an action. &amp;amp;nbsp;It takes as argument a byte which is interpreted as station-ID to copy the custom sprite layout from.&lt;br /&gt;
&lt;br /&gt;
Since {{ottdp|14.0}} this property is now an extended byte.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0B) ===&lt;br /&gt;
For stations, the following [[callbacks]] can be defined by setting the corresponding bit in property 0B:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Variable 0C value!!Callback&lt;br /&gt;
|-&lt;br /&gt;
|0||1||13||Whether to make station available in construction window (non-zero callback return) or not (callback returns zero)&lt;br /&gt;
|-&lt;br /&gt;
|1||2||14||Use callback to select sprite layout&lt;br /&gt;
|-&lt;br /&gt;
|2||4||141||Decide next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|3||8||142||Decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|4||10||149||Custom slope check&lt;br /&gt;
|}&lt;br /&gt;
Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the [[VariationalAction2|VarAction2]] for callbacks.&lt;br /&gt;
&lt;br /&gt;
=== Selection of numbers of platforms and length (0C, 0D) ===&lt;br /&gt;
&lt;br /&gt;
By default all platform lengths and any number of platforms is available for the new stations. &amp;amp;nbsp;Using these properties, you can choose which ones should be unavailable by setting the corresponding bit in the property.&lt;br /&gt;
&lt;br /&gt;
The values are a byte, used as a bit mask. &amp;amp;nbsp;Bits 0 to 6 control the availability of number or length 1 to 7, and bit 7 controls the availability of the &amp;quot;+7&amp;quot; button. &amp;amp;nbsp;Each bit that is set disables the corresponding length or number of platforms.&lt;br /&gt;
&lt;br /&gt;
For compatibility with &amp;quot;largestations off&amp;quot;, at least one length between 1 and 5 (bits 0 to 4) and one number of platforms between 1 and 4 (bits 0 to 3) must be available, i.e. at least one of these bits must be unset.&lt;br /&gt;
&lt;br /&gt;
=== Define custom layout (0E) ===&lt;br /&gt;
&lt;br /&gt;
This allows choosing which tile type is built at which tile of a newly built station. &amp;amp;nbsp;There are four different types, which TTD normally defines as&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Tile type!!Appearance&lt;br /&gt;
|-&lt;br /&gt;
|00||plain platform&lt;br /&gt;
|-&lt;br /&gt;
|02||platform with building&lt;br /&gt;
|-&lt;br /&gt;
|04||platform with roof, left side&lt;br /&gt;
|-&lt;br /&gt;
|06||platform with roof, right side&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Since {{ottdp|15}}, all even values up to FE are supported if the sprite layout is defined via property 09/0A.&lt;br /&gt;
&lt;br /&gt;
These numbers are used for stations in NE-SW direction, or these numbers plus one for stations in the NW-SE direction. &amp;amp;nbsp;To define a custom layout, use this format:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||length||length of platforms for this layout&lt;br /&gt;
|-&lt;br /&gt;
|B||number||number of platforms for this layout&lt;br /&gt;
|-&lt;br /&gt;
|V||tiles||length*number bytes of tile types, one platform after another, only 00, 02, 04 or 06 are allowed as values&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Repeat this as often as necessary to define the layouts for all supported combinations of length and number. &amp;amp;nbsp;End the definitions with a 00 00 (zero length and zero number). &amp;amp;nbsp;Any combinations that are not defined will be built using TTD&#039;s default layout.&lt;br /&gt;
Note that it may be easier to draw different sprite sets using a [[VariationalAction2|VarAction2]] based on [[VarAction2Stations#Platform info 40 41 46 47 49|station variable 40]], rather than redefining the layout. &amp;amp;nbsp;In addition, [[Callbacks#Custom station layout 24|callback 24]] will be used to further customize the layout as defined by this property (or by TTD if no prop 0E layout is available). This may also be easier than defining a prop 0E layout for every combination of length and number of platforms.&lt;br /&gt;
&lt;br /&gt;
=== Copy custom layout (0F) ===&lt;br /&gt;
&lt;br /&gt;
Similar to property 0A, this copies the custom layout from the station-ID given by the argument.&lt;br /&gt;
&lt;br /&gt;
Since {{ottdp|14.0}} this property is now an extended byte.&lt;br /&gt;
&lt;br /&gt;
=== Little/lots threshold (10) ===&lt;br /&gt;
Amount of cargo for switching from &amp;quot;little&amp;quot; to &amp;quot;lots&amp;quot; of cargo. &amp;amp;nbsp;TTDPatch separates the full range of cargo amounts (0 to 4095) into two separate subranges, &amp;quot;little&amp;quot; and &amp;quot;lots&amp;quot; of cargo. &amp;amp;nbsp;This allows better control of cargo amount based graphics (if needed). &amp;amp;nbsp;Property 10 specifies at what amount of cargo the patch is to switch from one to the other subrange. &amp;amp;nbsp;See [[Action2Stations|Action 2 for stations]] for more information.&lt;br /&gt;
&lt;br /&gt;
=== Pylon placement (11) and wire placement (14) ===&lt;br /&gt;
Prop. 11 sets which tile types should have pylons when used with electrified tracks. By default, tiles 0-3 (default stations without roof) have pylons, and tiles 4-7 (default stations with roof) don&#039;t. This is a bit mask of tile types, with a bit set meaning that a pylon should be drawn. The tile types here do not consider [[Callbacks#Station sprite layout 14|callback 14]], but rather the type as it was built, i.e. from prop. 0E.&lt;br /&gt;
&lt;br /&gt;
Prop. 14 works in a similar way, except that it sets the tile types on which there should be &#039;&#039;no&#039;&#039; wires displayed. With the default value of &amp;quot;00&amp;quot;, wires are displayed everywhere, and for each bit set, the wire is omitted on that tile type.&lt;br /&gt;
&lt;br /&gt;
This property should only be used when the wires cause problems with the sprite sorter, because even when the wire is obscured by a station hall or similar, it should still show up in transparent mode so that each tile can easily be verified as being electrified.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Note: This property only allows setting the flags of the first 8 sprite layouts. Use Property 1E instead to set flags when more sprite layouts are used via prop. 0E or [[Callbacks#Custom_station_layout_.2824.29|callback 24]].&lt;br /&gt;
&lt;br /&gt;
=== Cargo types for random triggers (12) ===&lt;br /&gt;
&lt;br /&gt;
This sets which cargo types should trigger re-randomizing. The cargo types are given as a bitmask of the bits from column 3 (type B) in CargoTypes. &amp;amp;nbsp;If nothing is set (the default), the no random triggers will happen, to conserve CPU time.&lt;br /&gt;
&lt;br /&gt;
With GRF version 7 and above, the interpretation of bits changes. Instead of climate-dependent cargo slot numbers (type B), you have to set the bits of climate-independent cargo ID (type A).&lt;br /&gt;
&lt;br /&gt;
{{ottd|15.0}} Since 15.0, a default cargo translation table corresponding to the climate is used if one is not provided.&lt;br /&gt;
&lt;br /&gt;
=== General Flags (13) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.7|2.5}}||use different sprite set for ground sprites ([[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|var. 10]] is 1 for ground sprites, 0 otherwise)&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||when calculating the cargo amount to display, divide the amount by the station size (to simulate cargo distributed over the area of the station)&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.7|2.5}}||[[Callbacks#Next animation frame (1A/26/141/153/158)|callback 141]] needs random bits in var. 10&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|1.0|2.6}}||Use custom foundations on sloped tiles (the lowest byte of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|var. 10]] is 2 for foundation sprites)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.0|2.6}}||When bit 3 is set, use extended foundation block instead of the simple one&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bit 3 works somewhat similarly to bit 0: your sprite selection will be called again, with 2 in the lowest byte of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 10]]. If the chain ends on a callback result, the program will assume the foundation selection has failed and will use the default foundaton sprites. The low word of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 18]] will contain the tile type of the current tile; if you have [[Callbacks#Station sprite layout (14)|callback 14]] enabled, this will be the its return value - otherwise, the default TTD types (platform with building, platform with left roof etc.) are used. In either case, one is added for the NW-SE orientation, in case your station needs different foundations depending on its orientation. Bits 16 and 17 are set if the NW and and NE foundations are to merged with the corresponding neighbour tile, so you shouldn&#039;t draw the corresponding edge in the foundation sprite. Other bits of variable 10 and variable 18 are reserved for future use.&lt;br /&gt;
&lt;br /&gt;
Your sprite selection code should select a foundation sprite block. The contents of this block depends on whether bit 4 is set or not.&lt;br /&gt;
* Bit 4 clear (simple foundations):&lt;br /&gt;
[[File:simple_foundations.png]]&lt;br /&gt;
&lt;br /&gt;
The programme will combine the needed foundation from these 8 sprites depending on the current slope. You don&#039;t need to care about the merge data in bits 16..17 of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 18]]; it will be taken care of that automatically by adding the 7th and 8th sprite only when necessary.&lt;br /&gt;
* Bit 4 set (extended foundations):&lt;br /&gt;
[[File:extended_foundations.png]]&lt;br /&gt;
&lt;br /&gt;
You need to have one sprite for every slope that&#039;s possible below a rail station. The correct one will be automatically selected depending on the current slope. It can&#039;t handle the merging itself, however, so you need four foundation blocks: one with no edges removed, one with the NW edge removed, one with the NE edge removed and one with both north edges removed. Your sprite selection code is responsible for selecting the correct of those blocks according to the merge info in [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 18]].&lt;br /&gt;
&lt;br /&gt;
In both cases, you can put an additional value into register 100h, which will serve as an offset into the selected block. If you don&#039;t modify register 100h during the chain, it will default to 0. It is important that the dimensions of these sprites remain the same - thus bit 6 in the real sprites must be set to prevent GRFCodec from trimming the empty blue areas. The offset of these foundations must be -31 to the X direction and -9 to the Y direction.&lt;br /&gt;
&lt;br /&gt;
=== Can train enter tile (15) ===&lt;br /&gt;
&lt;br /&gt;
Like props. 11 and 14, this value contains eight bits relating to the eight possible tile types. If a bit is set, trains are prevented from routing through or entering any tile of this type.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Note: This property only allows setting the flags of the first 8 sprite layouts. Use Property 1E instead to set flags when more sprite layouts are used via prop. 0E or [[Callbacks#Custom_station_layout_.2824.29|callback 24]].&lt;br /&gt;
&lt;br /&gt;
=== Animation information (16) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this station (this is the default value).&lt;br /&gt;
Since you can&#039;t have properties for individual station tiles, this property applies for every tile of the station. If you don&#039;t want to animate some tiles, you should check the current position during [[Callbacks#Animation control (1B/25/140/152/159)|callback 140]] and return FD if the current tile doesn&#039;t need to be animated. If you also need animations of different length per tile, you&#039;ll have to use [[Callbacks#Next animation frame (1A/26/141/153/158)|callback 141]] for that.&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (17) ===&lt;br /&gt;
The meaning is the same as for [[Action0Houses#Animation Speed 1B|house property 1B]], but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Animation triggers (18) ===&lt;br /&gt;
This is a bit mask of events that should trigger [[Callbacks#Animation control (1B/25/140/152/159)|callback 140]], allowing to change the animation state&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property bit, var18 byte 0!!Property value!!Version!!Meaning!!Happens on!!Var 18 byte 1&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.7|2.5}}||Station part is built||the newly built tiles||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.7|2.5}}||New cargo arrives to station||whole station||Cargo type &amp;lt;ref name=&amp;quot;cargotype&amp;quot;&amp;gt;Bits 8..15 of var 18 contain the triggering cargo type. If your GRF has a cargo translation table, the cargo type will be an index in that table, or FFh if the cargo isn&#039;t in the table. If you don&#039;t have a cargo translation table, the cargo type will simply be the climate-dependent cargo type number.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.7|2.5}}||A cargo type gets removed from station||whole station||Cargo type &amp;lt;ref name=&amp;quot;cargotype&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.7|2.5}}||Train enters station (starts loading/unloading)||platform where the train is||&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.7|2.5}}||Train leaves station (done loading/unloading)||platform where the train is||&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.2|2.5|ottdrev=r22746}}||Train loads/unloads cargo||platform where the train is||&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp|0.7|2.5}}||Every 250 ticks||whole station||&lt;br /&gt;
|-&lt;br /&gt;
|7||80||{{ottdp|15|no}}||Tile is processed in the periodic processing loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|8||100||{{ottdp|15|no}}||Train reserves platform (using PBS)||platform where the train reserved||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The remaining bits are reserved for future triggers, they must be zero for now.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;happens on&amp;quot; column tells which tiles will [[Callbacks#Animation control (1B/25/140/152/159) |callback 140]] be called on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Advanced sprite layout with register modifiers (1A) ===&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.2|no|ottdrev=r22518}}&lt;br /&gt;
Format:&lt;br /&gt;
 1A &amp;lt;num-layouts&amp;gt; &amp;lt;0x40 + num-sprites&amp;gt;&lt;br /&gt;
                  &amp;lt;groundsprite&amp;gt; &amp;lt;flags&amp;gt; [&amp;lt;register/value&amp;gt;]...&lt;br /&gt;
                  [ &amp;lt;buildingsprite&amp;gt; &amp;lt;flags&amp;gt;&lt;br /&gt;
                      ( &amp;lt;xoffset&amp;gt; &amp;lt;yoffset&amp;gt; &amp;lt;zoffset&amp;gt; &amp;lt;xextent&amp;gt; &amp;lt;yextent&amp;gt; &amp;lt;zextent&amp;gt; &lt;br /&gt;
                      | &amp;lt;xpixeloffset&amp;gt; &amp;lt;ypixeloffset&amp;gt; 80)&lt;br /&gt;
                    [&amp;lt;register/value&amp;gt;]...&lt;br /&gt;
                  ]...&lt;br /&gt;
&lt;br /&gt;
For further details see [https://wiki.openttd.org/en/Archive/Development/Advanced%20Sprite%20Layout#stations here] for now.&lt;br /&gt;
&lt;br /&gt;
=== Minimum bridge height (1B) ===&lt;br /&gt;
&lt;br /&gt;
This property allows building bridges over stations.&lt;br /&gt;
&lt;br /&gt;
The bridge height property defines minimum clearances required for a bridge for each of the four [[Action0/Stations#Define_custom_layout_.280E.29|tile types]] of this station (or zero to not allow any bridge). Values are given in &amp;quot;height level&amp;quot; units (1 level == 8px).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; |-&lt;br /&gt;
!Height (1)!!Appearance&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align:center;&amp;quot; |x1 y1 ||plain platform&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align:center;&amp;quot; |x2 y2 ||platform with building&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align:center;&amp;quot; |x3 y3 ||platform with roof, left side&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align:center;&amp;quot; |x4 y4 ||platform with roof, right side&lt;br /&gt;
|}&lt;br /&gt;
(1) where the values are one byte pairs (x-direction, y-direction) expressed in hexadecimal notation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
1B &amp;lt;1st pair&amp;gt; &amp;lt;2nd pair&amp;gt; &amp;lt;3rd pair&amp;gt; &amp;lt;4th pair&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1B x1 y1 x2 y2 x3 y3 x4 y4&amp;lt;br /&amp;gt;&lt;br /&gt;
1B 01 01 02 02 03 03 03 03 // 8px 16px 24px 24px&lt;br /&gt;
&lt;br /&gt;
This property is currently only available for JGR&#039;s Patch Pack (v0.26.0 and later) and the developmental &amp;quot;New Map Features&amp;quot; (NMF) fork of OpenTTD.&lt;br /&gt;
&lt;br /&gt;
=== Station name (1C) ===&lt;br /&gt;
&lt;br /&gt;
=== Station class name (1D) ===&lt;br /&gt;
&lt;br /&gt;
=== Station sprite layout flags (1E) ===&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Since OpenTTD supports more than 8 sprite layouts to be used, props. 11, 14 and 15 are not sufficient to set the flags for all usable sprite layouts. This property is variable length and allows these flags to be set for each tile beyond the original limit of 8.&lt;br /&gt;
&lt;br /&gt;
The data is specified as flags for all sprite layouts in this way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;amp;lt;num&amp;amp;gt; &amp;amp;lt;flags1&amp;amp;gt; &amp;amp;lt;flags2&amp;amp;gt; ... &amp;amp;lt;flagsn&amp;amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B*||num||Number of different tiles supported (see below)&lt;br /&gt;
|-&lt;br /&gt;
|B||flags1...||The flags for each of the &amp;amp;lt;num&amp;amp;gt; tiles, as specified below&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The flag values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
|Bit||Value||Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||01||Tile should contain catenary pylons.&lt;br /&gt;
|-&lt;br /&gt;
|1||02||Tile should NOT contain catenary wires.&lt;br /&gt;
|-&lt;br /&gt;
|2||04||Tile is blocked to vehicles.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These should be combined as needed.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Using TTD&#039;s sprite layouts for certain tiles ===&lt;br /&gt;
&lt;br /&gt;
To use TTD&#039;s layout, you use &amp;lt;code&amp;gt;00 00 00 00&amp;lt;/code&amp;gt; for the ground sprite number and leave off everything else.&lt;br /&gt;
&lt;br /&gt;
So instead of for example&lt;br /&gt;
&lt;br /&gt;
 F4 03 00 00&lt;br /&gt;
    00 00 00    10 05 02    2E 84 00 00&lt;br /&gt;
    00 0B 00    10 05 02    30 84 00 00&lt;br /&gt;
    80&lt;br /&gt;
&lt;br /&gt;
you just put&lt;br /&gt;
&lt;br /&gt;
 00 00 00 00&lt;br /&gt;
&lt;br /&gt;
=== Using transparent sprites ===&lt;br /&gt;
&lt;br /&gt;
You can use transparent sprites to make for example the roof translucent like in TTD&#039;s stations. The roof of TTD&#039;s stations is made like this:&lt;br /&gt;
&lt;br /&gt;
 00 00 10    10 10 0A    37 84 00 00&lt;br /&gt;
 00 00 80    00 00 00    3B 44 22 03&lt;br /&gt;
&lt;br /&gt;
The first sprite here is the non-transparent frame of the roof, drawn in company colours (it has bit 15 set). The second part is a special &amp;quot;linked&amp;quot; sprite without its own bounding box, it shares that of the previous sprite. That&#039;s done by setting the z offset to 80.&lt;br /&gt;
&lt;br /&gt;
To make that second sprite transparent, bit 14 is set in the sprite number, and the upper word is set to 322 (*), so 0322443B means to take sprite 43B and draw it in transparent mode. The colours of that sprite are ignored entirely, every pixel in colour 0 is fully transparent, and all other pixels are semi-transparent (essentially just causing what they are drawn over to become darker).&lt;br /&gt;
&lt;br /&gt;
(*) This is the [[RecolorSprites#Default_recolour_sprites | recolour sprite]] for the glass effect.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5016</id>
		<title>Callback: Animation control</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5016"/>
		<updated>2025-04-26T14:24:20Z</updated>

		<summary type="html">&lt;p&gt;Frosch: ottd 15 additions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Animation control (1B/1C/25/140/148/152/159) ==&lt;br /&gt;
&lt;br /&gt;
These callbacks are called, when an animation trigger happens.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Callback!!Feature!!Mask property!!Trigger!!Variable 10!!Variable 18&lt;br /&gt;
|-&lt;br /&gt;
|1B||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 2]]&lt;br /&gt;
|[[Action0/Houses#Periodic_refresh_multiplier_.2816.29|Periodic, see property 16]] &amp;lt;ref&amp;gt;For multi-tile houses [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] controls, whether the trigger is synchronised across all house tiles. See details there.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] is set.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|1C||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 3]]&lt;br /&gt;
|[[VariationalAction2/Houses#Construction_stage_and_pseudo-random_values_.2840.29|Construction stage]] changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time.&amp;lt;br&amp;gt;{{ttdp|}} For the first call to happen, you also have to set [[Action0/Houses#Building_flags_.2809.29|property 9 bit 5]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
|{{ottdp|15|no}} Random bits&lt;br /&gt;
|{{ottdp|15|no}} First call &amp;lt;ref&amp;gt;Var 18 bit 0 is set, if the callback is called the first time for a new house. In-game the construction stage will be zero, at map generation and in scenario editor, it will be 3.&amp;lt;br&amp;gt;Other bits of var 18 are reserved, and must be masked.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|25||Industry tiles&lt;br /&gt;
|[[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot;&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if the trigger applies to multiple tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|140||Stations, road stops&lt;br /&gt;
|[[Action0/Stations#Animation_triggers_.2818.29|Station property 18]], [[Action0/Road_Stops#Animation_triggers_.2810.29|road stop property 10]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot; /&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Stations#Animation_triggers_.2818.29|station property 18]]&lt;br /&gt;
|-&lt;br /&gt;
|148||Houses&lt;br /&gt;
|[[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|Property 1E]]&lt;br /&gt;
|Watched cargo accepted &amp;lt;ref&amp;gt;Due to implementation details, up to 250 game ticks can pass between the actual acceptance and triggering this callback.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|See [[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|property 1E]]&lt;br /&gt;
|-&lt;br /&gt;
|154||Airport tiles&lt;br /&gt;
|[[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits &amp;lt;ref name=&amp;quot;randombits15&amp;quot;&amp;gt;{{ottdp|15|no}} Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if the trigger applies to multiple tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|159||Objects&lt;br /&gt;
|[[Action0/Objects#Animation_triggers_.2813.29|Property 13]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits &amp;lt;ref name=&amp;quot;randombits15&amp;quot; /&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Objects#Animation_triggers_.2813.29|property 13]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The return value has the format SSFF:&lt;br /&gt;
* FF: One of the following values:&lt;br /&gt;
: {| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00 - FC||Jump to this animation frame.&lt;br /&gt;
|-&lt;br /&gt;
|FD||leave the animation in its current state (do nothing)&lt;br /&gt;
|-&lt;br /&gt;
|FE||start animation with its current frame&lt;br /&gt;
|-&lt;br /&gt;
|FF||stop animation in its current frame&lt;br /&gt;
|}&lt;br /&gt;
* SS: Sound effect: If non-zero, the sound effect number to play at the tile.&lt;br /&gt;
&lt;br /&gt;
Note: Every time the animation frame is changed the map tile will be refreshed, even if the selected graphics stay the same. Therefore using the animation frame as a timer should be avoided, and animation triggers should be preferred instead.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5015</id>
		<title>Callback: Animation control</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5015"/>
		<updated>2025-04-25T10:31:41Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Animation control (1B/1C/25/140/148/152/159) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Animation control (1B/1C/25/140/148/152/159) ==&lt;br /&gt;
&lt;br /&gt;
These callbacks are called, when an animation trigger happens.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Callback!!Feature!!Mask property!!Trigger!!Variable 10!!Variable 18&lt;br /&gt;
|-&lt;br /&gt;
|1B||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 2]]&lt;br /&gt;
|[[Action0/Houses#Periodic_refresh_multiplier_.2816.29|Periodic, see property 16]] &amp;lt;ref&amp;gt;For multi-tile houses [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] controls, whether the trigger is synchronised across all house tiles. See details there.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] is set.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|1C||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 3]]&lt;br /&gt;
|[[VariationalAction2/Houses#Construction_stage_and_pseudo-random_values_.2840.29|Construction stage]] changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time.&amp;lt;br&amp;gt;{{ttdp|}} For the first call to happen, you also have to set [[Action0/Houses#Building_flags_.2809.29|property 9 bit 5]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|25||Industry tiles&lt;br /&gt;
|[[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot;&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if the trigger applies to multiple tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|140||Stations, road stops&lt;br /&gt;
|[[Action0/Stations#Animation_triggers_.2818.29|Station property 18]], [[Action0/Road_Stops#Animation_triggers_.2810.29|road stop property 10]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot; /&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Stations#Animation_triggers_.2818.29|station property 18]]&lt;br /&gt;
|-&lt;br /&gt;
|148||Houses&lt;br /&gt;
|[[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|Property 1E]]&lt;br /&gt;
|Watched cargo accepted &amp;lt;ref&amp;gt;Due to implementation details, up to 250 game ticks can pass between the actual acceptance and triggering this callback.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|See [[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|property 1E]]&lt;br /&gt;
|-&lt;br /&gt;
|154||Airport tiles&lt;br /&gt;
|[[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits &amp;lt;ref name=&amp;quot;randombits15&amp;quot;&amp;gt;{{ottdp|15|no}} Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if the trigger applies to multiple tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|159||Objects&lt;br /&gt;
|[[Action0/Objects#Animation_triggers_.2813.29|Property 13]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits &amp;lt;ref name=&amp;quot;randombits15&amp;quot; /&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Objects#Animation_triggers_.2813.29|property 13]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The return value has the format SSFF:&lt;br /&gt;
* FF: One of the following values:&lt;br /&gt;
: {| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00 - FC||Jump to this animation frame.&lt;br /&gt;
|-&lt;br /&gt;
|FD||leave the animation in its current state (do nothing)&lt;br /&gt;
|-&lt;br /&gt;
|FE||start animation with its current frame&lt;br /&gt;
|-&lt;br /&gt;
|FF||stop animation in its current frame&lt;br /&gt;
|}&lt;br /&gt;
* SS: Sound effect: If non-zero, the sound effect number to play at the tile.&lt;br /&gt;
&lt;br /&gt;
Note: Every time the animation frame is changed the map tile will be refreshed, even if the selected graphics stay the same. Therefore using the animation frame as a timer should be avoided, and animation triggers should be preferred instead.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Objects&amp;diff=5014</id>
		<title>Action0/Objects</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Objects&amp;diff=5014"/>
		<updated>2025-04-24T18:45:09Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Animation triggers (13) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Defining properties of new objects.&lt;br /&gt;
&lt;br /&gt;
Unlike vehicles or new stations, most new objects have no real equivalent in TTD.&lt;br /&gt;
&lt;br /&gt;
The IDs are therefore free to be chosen and will in fact be allocated automatically by the patch. In action 0, you only specify IDs relative to the set, i.e. the ID of the first object type is 00, the second object type is 01 and so on. &lt;br /&gt;
&lt;br /&gt;
OpenTTD supports 64000 object types per game, and 255 object IDs per grf file.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|14.0|no}} 64000 object IDs per grf file are supported since OpenTTD 14.0.&lt;br /&gt;
&lt;br /&gt;
The property you &#039;&#039;&#039;must&#039;&#039;&#039; set for each object ID is 08 (in addition to defining an action 3 for it). Also, all object IDs must get their classes in the right order, starting from ID 00 onwards.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{|&lt;br /&gt;
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||D||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Class label, see below&lt;br /&gt;
|-&lt;br /&gt;
|09||W||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Text ID for class&lt;br /&gt;
|-&lt;br /&gt;
|0A||W||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Text ID for this object&lt;br /&gt;
|-&lt;br /&gt;
|0B||B||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||[[Action0General#Climate availability|Climate availability]]&lt;br /&gt;
|-&lt;br /&gt;
|0C||B||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Byte representing size, see below&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Object build cost factor (sets object removal cost factor as well)&lt;br /&gt;
|-&lt;br /&gt;
|0E||D||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Introduction date, see below&lt;br /&gt;
|-&lt;br /&gt;
|0F||D||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||End of life date, see below&lt;br /&gt;
|-&lt;br /&gt;
|10||W||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Object flags, see below&lt;br /&gt;
|-&lt;br /&gt;
|11||W||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|12||B||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Animation speed&lt;br /&gt;
|-&lt;br /&gt;
|13||W||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Animation triggers&lt;br /&gt;
|-&lt;br /&gt;
|14||B||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Object removal cost factor (set after object build cost factor)&lt;br /&gt;
|-&lt;br /&gt;
|15||W||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Callback flags, see below&lt;br /&gt;
|-&lt;br /&gt;
|16||B||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Height of the building&lt;br /&gt;
|-&lt;br /&gt;
|17||B||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Number of object views&lt;br /&gt;
|-&lt;br /&gt;
|18||B||{{ottdp|1.4|no|ottdrev=r25879}}||Measure for number of objects placed upon map creation&lt;br /&gt;
|-&lt;br /&gt;
|19||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Check [http://pics.lakie.net/newObject-ActionStructure.png Lakie&#039;s Graphical Representation of the newObject Specifications]&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&lt;br /&gt;
&lt;br /&gt;
=== Object class (08) ===&lt;br /&gt;
&lt;br /&gt;
Class labels are unique identifiers composed of the letters A-Z and/or the numbers 0-9, &amp;amp;nbsp;analoguous to [[Action0Stations#Station class (08)|station class labels]].&lt;br /&gt;
&lt;br /&gt;
Their main use is to combine objects into classes and make them available by the top dropdown list in the object construction window.&lt;br /&gt;
&lt;br /&gt;
Unlike for stations, there is no default class for objects. Set authors have to specify their [[ObjectLabels|own labels]], although it is strongly recommended to follow a general scheme to try to avoid confusion.&lt;br /&gt;
&lt;br /&gt;
Class IDs must be set before any other property.&lt;br /&gt;
&lt;br /&gt;
=== Object class text ID (09) ===&lt;br /&gt;
&lt;br /&gt;
The text ID for this class (word value). This textid should be either a TTD textid or a D4xx textid (set via D0xx in action4).&lt;br /&gt;
&lt;br /&gt;
When specifying an object, you don&#039;t need to set a class name again if you already did for another one with the same class.&lt;br /&gt;
&lt;br /&gt;
=== Object text ID (0A) ===&lt;br /&gt;
&lt;br /&gt;
The text ID for the object for query and selection (word value). Same requirements as for property09.&lt;br /&gt;
&lt;br /&gt;
=== Object size (0C) ===&lt;br /&gt;
&lt;br /&gt;
The object size up to 15x15 tiles.&lt;br /&gt;
&lt;br /&gt;
This byte value is divided into two nibbles. The first defines the size in y direction and the second defines the size in x (i.e., stored as YX).&lt;br /&gt;
&lt;br /&gt;
Note that any value lower than 0x11 will be rejected.&lt;br /&gt;
&lt;br /&gt;
=== Build Cost (0D) ===&lt;br /&gt;
&lt;br /&gt;
The build cost multiplier. This is multiplied by the number of tiles for evaluation of construction and removal costs of an object.&lt;br /&gt;
&lt;br /&gt;
=== Introduction date (0E) ===&lt;br /&gt;
&lt;br /&gt;
Introduction date of an object, in days since the year 0. This takes account of leap years; divisible by 4, but not 100 unless 400. A start date of 1920-01-01 is obtained with a value of 701265 (51 B3 0A 00). In TTDPatch anything before 1920 is considered to be always available, and it should allow for objects to work past 2044, the date is also the very first date you can build the object.&lt;br /&gt;
&lt;br /&gt;
=== End of life date (0F) ===&lt;br /&gt;
&lt;br /&gt;
Last year an object can be build, in days since the year 0. Same requirements as above. Also note that it must be a minimum of a year (365 days) after the introduction date or TTDPatch will ignore it.&lt;br /&gt;
&lt;br /&gt;
=== Object flags (10) ===&lt;br /&gt;
&lt;br /&gt;
The following flags control object behaviour and are cached for built objects, so changing these flags will have no effect on already constructed objects.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Only Available in the scenario editor&amp;lt;ref name=&amp;quot;incompatible&amp;quot;&amp;gt;Note that bits 0 and 7 are incompatible and setting both will make an object completely unavailable.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Irremovable&amp;lt;ref&amp;gt;Object cannot be removed through normal dynamite, control must be held and the removal cost will be multiplied by 25 (this is the usual behaviour for most class A objects in TTDPatch).&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Anything Can Remove (owned land behaviour)&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Allow construction of the object on water&lt;br /&gt;
|-&lt;br /&gt;
|4||16||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Removal cost is actually income (owned land behaviour)&lt;br /&gt;
|-&lt;br /&gt;
|5||32||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Do not display foundations if on a slope&lt;br /&gt;
|-&lt;br /&gt;
|6||64||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Object has animation&amp;lt;ref&amp;gt;Setting this flag will allow the object&#039;s animation counter to be increased, must be set if you plan to make use of animations. Like stations you must enable animation on a per tile basis by means of the &amp;quot;built tile&amp;quot; trigger and callback 159.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|7||128||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Only available during game play&amp;lt;ref name=&amp;quot;incompatible&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|8||256||{{ottdp|1.1|2.6|ottdrev=r20670|ttdprev=r2340}}||Allows 2cc mapping for objects instead of the default 1cc&lt;br /&gt;
|-&lt;br /&gt;
|9||512||{{ottdp|1.1|2.6|ttdprev=r2331}}||Disallows construction on land (also has bit 3 behaviour)&lt;br /&gt;
|-&lt;br /&gt;
|10||1024||{{ottdp|1.1|2.6|ttdprev=r2331}}||Draws the water under the object&amp;lt;ref&amp;gt;Only applies when built on top of a water tile, also replaces the ground tile of the object completely. (Does not work when object built on sloped water tiles).&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|11||2048||{{ottdp|1.1|no|ottdrev=r21455}}||Allow bridge over the object taking the building height into account&lt;br /&gt;
|-&lt;br /&gt;
|12||4096||{{ottdp|1.1|2.6|ottdrev=r21455|ttdprev=r2360}}||Random bits in the &amp;quot;next animation frame&amp;quot; callback&lt;br /&gt;
|-&lt;br /&gt;
|13||8192||{{ottdp|1.4|no|ottdrev=r25878}}||Scale amount of objects placed on map generation not by map area, but roughly by the length of the coastline&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Animation information (11) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this object (this is the default value).&lt;br /&gt;
&lt;br /&gt;
Since you can&#039;t have properties for individual object tiles, this property applies for every tile of the object. If you don&#039;t want to animate some tiles, you should check the current position during [[Callbacks#Animation control (1B/25/140/152/159)|callback 159]] and return FD if the current tile doesn&#039;t need to be animated. If you also need animations of different length per tile, you&#039;ll have to use [[Callbacks#Next animation frame (1A/26/141/153/158)|callback 158]] for that.&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (12) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for [[Action0Houses#Animation Speed (1B)|house property 1B]], but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 0.&lt;br /&gt;
&lt;br /&gt;
=== Animation triggers (13) ===&lt;br /&gt;
&lt;br /&gt;
This is a bit mask of events that should trigger [[Callbacks#Animation control (1B/25/140/152/159)|callback 159]], allowing to change the animation state&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Property bit, var18 byte 0!!Property value!!Meaning!!Happens on!!Var 18 byte 1&lt;br /&gt;
|-&lt;br /&gt;
|0||1||Object is built||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||Periodic tile loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||Synchronised periodic tile loop||all tiles||&lt;br /&gt;
|}&lt;br /&gt;
Currently no trigger provides additional information in var 18 byte 1. &lt;br /&gt;
&lt;br /&gt;
The synchronised periodic tile loop is called directly after the (unsynchronised) periodic tile loop of the northern tile.&lt;br /&gt;
&lt;br /&gt;
=== Object removal cost factor (14) ===&lt;br /&gt;
&lt;br /&gt;
Cost factor for the removal of an object. This must be set after property 0D (object build cost factor) as that overwrites this value.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (15) ===&lt;br /&gt;
&lt;br /&gt;
For objects, the following [[callbacks]] can be defined by setting the corresponding bit in property 15:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Bit!!Value!!Variable 0C value!!Callback&lt;br /&gt;
|-&lt;br /&gt;
|0||1||157||Custom slope check&lt;br /&gt;
|-&lt;br /&gt;
|1||2||158||Decide next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|2||4||15A||Decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|3||8||15B||Decide colour of building&lt;br /&gt;
|-&lt;br /&gt;
|4||16||15C||Show additional text in the build object window&lt;br /&gt;
|-&lt;br /&gt;
|5||32||15D||Allow/disallow autosloping&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Building height (16) ===&lt;br /&gt;
&lt;br /&gt;
Set the height of the building in heightlevels (8 pixels). For example if the structure is 16 pixels high you set this property to 2.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.1|no|ottdrev=r21455}} In OpenTTD this property is used to determine the height of the build object window; the height for the object preview is set to 32 + &amp;quot;value of property 16&amp;quot; * 8. The property is also uses to determine how high a bridge must be if it is allowed by the bit in property 10.&lt;br /&gt;
&lt;br /&gt;
=== Number of views (17) ===&lt;br /&gt;
&lt;br /&gt;
Objects may have &amp;quot;views&amp;quot;, i.e. different graphical representations, e.g. used to show rotated views of an object. Number of views may be 1, 2, or 4. Default value is 1.&lt;br /&gt;
&lt;br /&gt;
For non-square objects, x and y sizes are swapped for odd views. I.e., giving an object size of 1*2 (x = 1, y = 2), it will be displayed as 1*2 for num = &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;0,2] (x-direction) but as 2*1 for num = &amp;lt;nowiki&amp;gt;[&amp;lt;/nowiki&amp;gt;1,3] (y-direction).&lt;br /&gt;
&lt;br /&gt;
Use object varaction2 var48 to access particular views of an object.&lt;br /&gt;
==Examples==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Airport_Tiles&amp;diff=5013</id>
		<title>Action0/Airport Tiles</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Airport_Tiles&amp;diff=5013"/>
		<updated>2025-04-24T18:44:23Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Animation triggers via callback 152 (11) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.1|ottdrev=r19204}}&lt;br /&gt;
Airport tiles work like industry tiles and similarly to town buildings, except that they are not stand-alone. This means an airport tile can&#039;t stand alone, it&#039;s always part of an airport.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Version!![[GRFActionsDetailed|Size]]!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||{{ottdp|1.1|ottdrev=r19204}}||B||Substitute airport tile type&lt;br /&gt;
|-&lt;br /&gt;
|09||{{ottdp|1.1|ottdrev=r19204}}||B||Airport tile override&lt;br /&gt;
|-&lt;br /&gt;
|0E||{{ottdp|1.1|ottdrev=r19204}}||B||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0F||{{ottdp|1.1|ottdrev=r19204}}||W||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|10||{{ottdp|1.1|ottdrev=r19204}}||B||Animation speed.&lt;br /&gt;
|-&lt;br /&gt;
|11||{{ottdp|1.1|ottdrev=r19204}}||B||Animation triggers&lt;br /&gt;
|-&lt;br /&gt;
|12||{{ottdp|15}}||W n*W||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute tile type (08) ===&lt;br /&gt;
&lt;br /&gt;
This tile type will be used instead of your new one if your definition isn&#039;t available for any reason. Assigning this property copies the properties of the old type just like it does with houses. If this tile&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Airport tile override (09) ===&lt;br /&gt;
&lt;br /&gt;
Works like the house override property for houses and industry tiles.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0E) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!value!!version!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Next animation frame (1A/26/141/153/158) |callback 153]] to decide the next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Length of animation frame (20/27/142/154/15A) |callback 154]] to decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp}}||(reserved)&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp}}||(reserved)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.1|ottdrev=r19204}}||use callback xx to check if a slope is suitable (not yet implemented)&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Decide drawing default foundations (30/14E/150) |callback 150]] to decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp|1.1|ottdrev=r19204}}||use callback xx to allow or deny autosloping below the tile (not yet implemented)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please note that callback 152 doesn&#039;t have a bit here. To use [[Callbacks#Animation control (1B/25/140/152/159) |callback 152]], simply set the wanted bits in property 11 and it will work as intended.&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0F) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this tile (this is the default value).&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (10) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Animation triggers via [[Callback:_Animation_control |callback 152]] (11) ===&lt;br /&gt;
&lt;br /&gt;
This shares some flags with industry tiles and others with stations. Call [[Callback:_Animation_control|callback 152]] when:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property bit, var18 byte 0!!Property value!!Version!!Meaning!!Happens on||Var 18 byte 1&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|1.1|ottdrev=r19204}}||airport was just constructed||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.1|ottdrev=r19204}}||the tile is processed in the periodic processing loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|1.1|ottdrev=r19204}}||new cargo arrives at the station (for all airport tiles the same)||all tiles||Cargo type &amp;lt;ref name=&amp;quot;cargotype&amp;quot;&amp;gt;Bits 8..15 of var 18 contain the triggering cargo type. If your GRF has a cargo translation table, the cargo type will be an index in that table, or FFh if the cargo isn&#039;t in the table. If you don&#039;t have a cargo translation table, the cargo type will simply be the climate-dependent cargo type number.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|1.1|ottdrev=r19204}}||a cargo type gets removed from the station (for all airport tiles the same)||all tiles||Cargo type &amp;lt;ref name=&amp;quot;cargotype&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.1|ottdrev=r19204}}||every 250 ticks (for all airport tiles the same)||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.9}}||Triggered when an airplane (not a helicopter!) lands at airport||single tile||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Stations&amp;diff=5012</id>
		<title>Action0/Stations</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Stations&amp;diff=5012"/>
		<updated>2025-04-24T18:42:44Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Animation triggers (18) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Defining properties of new stations.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unlike vehicles, the new stations have no equivalent in TTD. The IDs are therefore free to be chosen and will in fact be allocated automatically. In action 0, you only specify IDs relative to the set, i.e. the ID of the first station type is 00, the second station type is 01 and so on.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} In TTDPatch each game can only have 255 station IDs for all active grf files.&lt;br /&gt;
&lt;br /&gt;
The only property you &#039;&#039;&#039;must&#039;&#039;&#039; set for each station ID is 08 (in addition to defining an [[Action3|action 3]] for it), anything else can be left at the default. It must be the first property you set for each station ID, because the station ID is actually undefined until it has been assigned a class through property 08. Also, all station IDs must get their classes in the right order, starting from ID 00 onwards.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||D||{{ottdp|0.6|2.5|ttdprev=alpha 19}}||Class ID, see below&lt;br /&gt;
|-&lt;br /&gt;
|09||V||{{ottdp|0.6|2.5|ttdprev=alpha 20}}||Sprite layout, see below&lt;br /&gt;
|-&lt;br /&gt;
|0A||B/B*||{{ottdp|0.6|2.5|ttdprev=alpha 20}}/{{ottdp|14.0}}||Copy sprite layout&lt;br /&gt;
|-&lt;br /&gt;
|0B||B||{{ottdp|0.6|2.5|ttdprev=alpha 22}}||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0C||B||{{ottdp|0.6|2.5|ttdprev=alpha 22}}||Bit mask of disabled numbers of platforms&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 22}}||Bit mask of disabled platform lengths&lt;br /&gt;
|-&lt;br /&gt;
|0E||V||{{ottdp|0.6|2.5|ttdprev=alpha 22}}||Define custom layout, see below&lt;br /&gt;
|-&lt;br /&gt;
|0F||B/B*||{{ottdp|0.6|2.5|ttdprev=alpha 22}}/{{ottdp|14.0}}||Copy custom layout from stationid given by argument&lt;br /&gt;
|-&lt;br /&gt;
|10||W||{{ottdp|0.6|2.5|ttdprev=alpha 25}}||Little/lots threshold&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 27}}||Pylon placement&lt;br /&gt;
|-&lt;br /&gt;
|12||D||{{ottdp|0.6|2.5|ttdprev=alpha 30}}||Bit mask of cargo type triggers for random sprites&lt;br /&gt;
|-&lt;br /&gt;
|13||B||{{ottdp|0.6|2.5|ttdprev=alpha 30}}||General flags&lt;br /&gt;
|-&lt;br /&gt;
|14||B||{{ottdp|0.6|2.5|ttdprev=alpha 47}}||Overhead wire placement&lt;br /&gt;
|-&lt;br /&gt;
|15||B||{{ottdp|0.6|2.5|ttdprev=alpha 51}}||Can train enter tile&lt;br /&gt;
|-&lt;br /&gt;
|16||W||{{ottdp|0.7|2.5|ttdprev=beta 9}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|17||B||{{ottdp|0.7|2.5|ttdprev=beta 9}}||Animation speed&lt;br /&gt;
|-&lt;br /&gt;
|18||W||{{ottdp|0.7|2.5|ttdprev=beta 9}}||Animation triggers&lt;br /&gt;
|-&lt;br /&gt;
|1A||V||{{ottdp|1.2|no|ottdrev=r22518}}||Advanced sprite layout with register modifiers&lt;br /&gt;
|-&lt;br /&gt;
|1B|| || ||Reserved&lt;br /&gt;
|-&lt;br /&gt;
|1C||W||{{ottdp|14}}||Station name&lt;br /&gt;
|-&lt;br /&gt;
|1D||W||{{ottdp|14}}||Station class name&lt;br /&gt;
|-&lt;br /&gt;
|1E||V||{{ottdp|15}}||Station sprite layout flags&lt;br /&gt;
|-&lt;br /&gt;
|1F||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unofficial additions and changes. Don&#039;t rely on them to ever work this way in OpenTTD or TTDPatch:&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description&lt;br /&gt;
|-&lt;br /&gt;
|1B||8*B||whatever-PP||Minimum bridge height for bridges over stations&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Station class (08) ===&lt;br /&gt;
TTDPatch groups sets of new station graphics into various classes. &amp;amp;nbsp;The classes can be selected by the top dropdown list in the construction window, and the individual stations within the class from the bottom dropdown list. &amp;amp;nbsp;In addition, each station can alter its appearance using [[VariationalAction2|variational]] and/or [[RandomAction2|random]] action 2 entries.&lt;br /&gt;
&lt;br /&gt;
Only two classes are pre-defined:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Name!!Class ID!!Intended use for station&lt;br /&gt;
|-&lt;br /&gt;
|DFLT||44 46 4C 54||Default, no special station type&lt;br /&gt;
|-&lt;br /&gt;
|WAYP||57 41 59 50||Non-cargo stations, waypoints, signal boxes etc.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may simply use other classes than the above, as long as no more than (at the moment) 16 classes are used among all active .grf files at any time.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Station classes which start with the byte FF are considered waypoint classes, and will appear in the waypoint construction window instead of the station construction window.&lt;br /&gt;
&lt;br /&gt;
When a waypoint station is built, it will not accept cargo nor will any cargo appear from nearby industries or towns. &amp;amp;nbsp;Trains will not stop at waypoint stations, regardless of the non-stop order and/or the nonstop switch.&lt;br /&gt;
&lt;br /&gt;
=== Sprite layout (09) ===&lt;br /&gt;
This controls what sprites are displayed, where they are displayed, and in what order. &amp;amp;nbsp;The property is variable sized, and contains the data for all 8 possible station tile types. &amp;amp;nbsp;If this property is set, the num-ent in the corresponding [[Action1|action 1]] need not be equal to 12 (hex), it can in fact be any number, and any number of sprites can be displayed in any order.&lt;br /&gt;
&lt;br /&gt;
The data is specified as data for all eight tiles in this way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;amp;lt;num&amp;amp;gt; &amp;amp;lt;data1&amp;amp;gt; &amp;amp;lt;data2&amp;amp;gt; ... &amp;amp;lt;datan&amp;amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B*||num||Number of different tiles supported (see below)&lt;br /&gt;
|-&lt;br /&gt;
|V||data1...||The variable size data for each of the &amp;amp;lt;num&amp;amp;gt; tiles, as specified below&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Number of tiles supported =====&lt;br /&gt;
* Normally this is 8, but you can specify fewer as well&lt;br /&gt;
* Using callback flags bit 1, specifying more makes sense too&lt;br /&gt;
* This value must be the same for all stations set by this action 0, even though it must be repeated for the prop. 09 definition of each station ID as well&lt;br /&gt;
&lt;br /&gt;
(Note that num is an extended byte, see [[GRFActionsDetailed]].)&lt;br /&gt;
&lt;br /&gt;
The content of each of the (usually eight) data sets is either a new sprite layout:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|D||groundsprite||the sprite to draw for the rails; this is by default a TTD sprite, but with bit 31 set an [[Action1|action 1]] sprite (42D+X) may be specified&lt;br /&gt;
|-&lt;br /&gt;
|V||spritedata||the data for station sprites, see below; each has a size of 10 bytes, and there may be several&lt;br /&gt;
|-&lt;br /&gt;
|B||80||a literal 80 ends the list of sprites for this tile&lt;br /&gt;
|}&lt;br /&gt;
or, alternatively, the instruction to use TTD&#039;s layout by using four zero bytes 00 00 00 00 instead of the groundsprite bytes. You can use [http://www.bytetransfer.de/projects/ttdpatch/docs/spriteidmapping.php the online sprite ID converter] to look up the sprite IDs you can use for all the climates.&lt;br /&gt;
&lt;br /&gt;
One can draw two types of sprites. &amp;amp;nbsp;One type is one that establishes a new 3D bounding box for use by the sprite sorter. &amp;amp;nbsp;The other type shares the 3D bounding box of the previous sprite(s). &amp;amp;nbsp;It must not be larger than the sprite which established the bounding box, nor must any part of it be outside this box. &amp;amp;nbsp;For simplicity, it should have the exact same dimensions as the sprite it shares the bounding box with. &amp;amp;nbsp;The latter type is supported in the station construction window display only since TTDPatch 2.6 r1684.&lt;br /&gt;
&lt;br /&gt;
The spritedata of sprites with their own bounding box has this format:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||xofs||x-offset from northern tile corner&lt;br /&gt;
|-&lt;br /&gt;
|B||yofs||y-offset from northern tile corner&lt;br /&gt;
|-&lt;br /&gt;
|B||zofs||z-offset from northern tile corner&lt;br /&gt;
|-&lt;br /&gt;
|B||xextent||size of sprite in x direction&lt;br /&gt;
|-&lt;br /&gt;
|B||yextent||size of sprite in y direction&lt;br /&gt;
|-&lt;br /&gt;
|B||zextent||size of sprite in z direction&lt;br /&gt;
|-&lt;br /&gt;
|D||sprite||sprite number to draw&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The spritedata of sprites sharing the bounding box has this format:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||xofs||x-offset relative to previous sprite&lt;br /&gt;
|-&lt;br /&gt;
|B||yofs||y-offset relative to previous sprite&lt;br /&gt;
|-&lt;br /&gt;
|B||80||a literal 80&lt;br /&gt;
|-&lt;br /&gt;
|B||00||(ignored)&lt;br /&gt;
|-&lt;br /&gt;
|B||00||(ignored)&lt;br /&gt;
|-&lt;br /&gt;
|B||00||(ignored)&lt;br /&gt;
|-&lt;br /&gt;
|D||sprite||sprite number to draw&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Since OpenTTD r18959 you can draw multiple ground sprites for a tile, which is useful if you want to use the usual rail/grass/concrete groundtile, but still need to add features to it without using a new bounding box. To do so use the syntax of sprites sharing the previous bounding box, but use it before the first bounding box definition. xpixeloffset and ypixeloffset refer to the usual spot of groundtiles. The same feature is also partially supported in TTDPatch since TTDPatch 2.6 r2312: TTDPatch ignores the xofs and yofs fields and always uses (0,0) for the offset. If you are developing a GRF that needs to be compatible with both OpenTTD and TTDPatch, you should always keep xofs and yofs zero to get the same effect in both games.&lt;br /&gt;
Note however that both implementations do not consider the [[Action0/Stations#General_Flags_.2813.29|setting of prop13 bit 0]], hence these &amp;quot;multiple ground sprites&amp;quot; have to be always part of the building sprites set and cannot be part of the different sprite set for ground sprites.&lt;br /&gt;
&lt;br /&gt;
The sprite number can have the following values (remember to use little endian, i.e. reversed byte order):&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Sprite&lt;br /&gt;
|-&lt;br /&gt;
|0000042D+X||use sprite X from the corresponding [[Action1|action 1]] block (i.e. 0000042D for the first, 0000042E for the second, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|0000842D+X||same, but draw it using company colour translation&lt;br /&gt;
|-&lt;br /&gt;
|0322442D+X||same, but draw in transparent mode (actual colours of the sprite are disregarded entirely); supported in station construction window display since TTDPatch 2.6 r1683&lt;br /&gt;
|-&lt;br /&gt;
|RRRR842D+X||draw sprite with colour translation defined in sprite RRRR; available since TTDPatch 2.6 r1683&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
With bit 31 set, this sprite will refer to a TTD sprite, not the action 1 sprite. For the first ground sprite the reverse meaning applies.&lt;br /&gt;
&lt;br /&gt;
Depending on the railtype the sprites may get additional offsets:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
! !! Normal/electrified rail !! Monorail !! Maglev&lt;br /&gt;
|-&lt;br /&gt;
|TTD sprites || 0 || 82 || 164&lt;br /&gt;
|-&lt;br /&gt;
|Action 1 sprite (first ground sprite) || 0 || 1 || 2&lt;br /&gt;
|-&lt;br /&gt;
|Action 1 sprite (other sprites in the layout) || 0 || 0 || 0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
So, TTD sprites and the first ground sprite are affected by the railtype, while other action 1 sprites in the layout are not. The offset &amp;quot;82&amp;quot; refers to the offset between the default TTD track sprites; if you are using non-track ground sprites which are not from an action 1, you need to supply fake spritenumbers which preemptively reverse the offsets (that is, you need different sprite layouts for every railtype your station is available for).&lt;br /&gt;
&lt;br /&gt;
Setting bit 30 forces this sprite to be displayed normally even in &amp;quot;transparent buildings&amp;quot; mode (supported only in TTDPatch 2.6 r1695 and later).&lt;br /&gt;
&lt;br /&gt;
See below for an example of linked sprites as well as transparent sprites (e.g. for a station roof).&lt;br /&gt;
&lt;br /&gt;
Note that the coordinates here are 3D coordinates with x running from top-right to bottom-left and y running from top-left to bottom-right, with the tile dimensions being 16x16 (and 8 for one height level). This means the x and y values should always be within 0-15 (decimal).&lt;br /&gt;
&lt;br /&gt;
This is different to and independent from the x/y offsets used in the actual .NFO file. &amp;amp;nbsp;The 3D bounding box is used by TTD&#039;s sprite sorter to figure out the order in which to draw the sprites, as well as telling it which sprites to draw, because those whose bounding box falls outside the currently updated screen rectangle will not be drawn. &amp;amp;nbsp;Make sure the 3D bounding box is large enough to contain the entire sprite, but not so large that the sprite sorter can&#039;t determine which sprites should be in front.&lt;br /&gt;
&lt;br /&gt;
This means that the order in which you specify sprites is irrelevant. &amp;amp;nbsp;Sprites will get drawn from back to front, in the order which the sprite sorter determines as correct, from their bounding boxes. &amp;amp;nbsp;There are two exceptions, however:&lt;br /&gt;
* Sprites sharing the same bounding box will always be drawn in the given order.&lt;br /&gt;
* The station construction window display doesn&#039;t use the sprite sorter. Tiles that may be displayed in that window need to be specified in the correct drawing order, back to front.&lt;br /&gt;
&lt;br /&gt;
=== Copy sprite layout (0A) ===&lt;br /&gt;
&lt;br /&gt;
This is not a property as such, but an action. &amp;amp;nbsp;It takes as argument a byte which is interpreted as station-ID to copy the custom sprite layout from.&lt;br /&gt;
&lt;br /&gt;
Since {{ottdp|14.0}} this property is now an extended byte.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0B) ===&lt;br /&gt;
For stations, the following [[callbacks]] can be defined by setting the corresponding bit in property 0B:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Variable 0C value!!Callback&lt;br /&gt;
|-&lt;br /&gt;
|0||1||13||Whether to make station available in construction window (non-zero callback return) or not (callback returns zero)&lt;br /&gt;
|-&lt;br /&gt;
|1||2||14||Use callback to select sprite layout&lt;br /&gt;
|-&lt;br /&gt;
|2||4||141||Decide next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|3||8||142||Decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|4||10||149||Custom slope check&lt;br /&gt;
|}&lt;br /&gt;
Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the [[VariationalAction2|VarAction2]] for callbacks.&lt;br /&gt;
&lt;br /&gt;
=== Selection of numbers of platforms and length (0C, 0D) ===&lt;br /&gt;
&lt;br /&gt;
By default all platform lengths and any number of platforms is available for the new stations. &amp;amp;nbsp;Using these properties, you can choose which ones should be unavailable by setting the corresponding bit in the property.&lt;br /&gt;
&lt;br /&gt;
The values are a byte, used as a bit mask. &amp;amp;nbsp;Bits 0 to 6 control the availability of number or length 1 to 7, and bit 7 controls the availability of the &amp;quot;+7&amp;quot; button. &amp;amp;nbsp;Each bit that is set disables the corresponding length or number of platforms.&lt;br /&gt;
&lt;br /&gt;
For compatibility with &amp;quot;largestations off&amp;quot;, at least one length between 1 and 5 (bits 0 to 4) and one number of platforms between 1 and 4 (bits 0 to 3) must be available, i.e. at least one of these bits must be unset.&lt;br /&gt;
&lt;br /&gt;
=== Define custom layout (0E) ===&lt;br /&gt;
&lt;br /&gt;
This allows choosing which tile type is built at which tile of a newly built station. &amp;amp;nbsp;There are four different types, which TTD normally defines as&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Tile type!!Appearance&lt;br /&gt;
|-&lt;br /&gt;
|00||plain platform&lt;br /&gt;
|-&lt;br /&gt;
|02||platform with building&lt;br /&gt;
|-&lt;br /&gt;
|04||platform with roof, left side&lt;br /&gt;
|-&lt;br /&gt;
|06||platform with roof, right side&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Since {{ottdp|15}}, all even values up to FE are supported if the sprite layout is defined via property 09/0A.&lt;br /&gt;
&lt;br /&gt;
These numbers are used for stations in NE-SW direction, or these numbers plus one for stations in the NW-SE direction. &amp;amp;nbsp;To define a custom layout, use this format:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||length||length of platforms for this layout&lt;br /&gt;
|-&lt;br /&gt;
|B||number||number of platforms for this layout&lt;br /&gt;
|-&lt;br /&gt;
|V||tiles||length*number bytes of tile types, one platform after another, only 00, 02, 04 or 06 are allowed as values&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Repeat this as often as necessary to define the layouts for all supported combinations of length and number. &amp;amp;nbsp;End the definitions with a 00 00 (zero length and zero number). &amp;amp;nbsp;Any combinations that are not defined will be built using TTD&#039;s default layout.&lt;br /&gt;
Note that it may be easier to draw different sprite sets using a [[VariationalAction2|VarAction2]] based on [[VarAction2Stations#Platform info 40 41 46 47 49|station variable 40]], rather than redefining the layout. &amp;amp;nbsp;In addition, [[Callbacks#Custom station layout 24|callback 24]] will be used to further customize the layout as defined by this property (or by TTD if no prop 0E layout is available). This may also be easier than defining a prop 0E layout for every combination of length and number of platforms.&lt;br /&gt;
&lt;br /&gt;
=== Copy custom layout (0F) ===&lt;br /&gt;
&lt;br /&gt;
Similar to property 0A, this copies the custom layout from the station-ID given by the argument.&lt;br /&gt;
&lt;br /&gt;
Since {{ottdp|14.0}} this property is now an extended byte.&lt;br /&gt;
&lt;br /&gt;
=== Little/lots threshold (10) ===&lt;br /&gt;
Amount of cargo for switching from &amp;quot;little&amp;quot; to &amp;quot;lots&amp;quot; of cargo. &amp;amp;nbsp;TTDPatch separates the full range of cargo amounts (0 to 4095) into two separate subranges, &amp;quot;little&amp;quot; and &amp;quot;lots&amp;quot; of cargo. &amp;amp;nbsp;This allows better control of cargo amount based graphics (if needed). &amp;amp;nbsp;Property 10 specifies at what amount of cargo the patch is to switch from one to the other subrange. &amp;amp;nbsp;See [[Action2Stations|Action 2 for stations]] for more information.&lt;br /&gt;
&lt;br /&gt;
=== Pylon placement (11) and wire placement (14) ===&lt;br /&gt;
Prop. 11 sets which tile types should have pylons when used with electrified tracks. By default, tiles 0-3 (default stations without roof) have pylons, and tiles 4-7 (default stations with roof) don&#039;t. This is a bit mask of tile types, with a bit set meaning that a pylon should be drawn. The tile types here do not consider [[Callbacks#Station sprite layout 14|callback 14]], but rather the type as it was built, i.e. from prop. 0E.&lt;br /&gt;
&lt;br /&gt;
Prop. 14 works in a similar way, except that it sets the tile types on which there should be &#039;&#039;no&#039;&#039; wires displayed. With the default value of &amp;quot;00&amp;quot;, wires are displayed everywhere, and for each bit set, the wire is omitted on that tile type.&lt;br /&gt;
&lt;br /&gt;
This property should only be used when the wires cause problems with the sprite sorter, because even when the wire is obscured by a station hall or similar, it should still show up in transparent mode so that each tile can easily be verified as being electrified.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Note: This property only allows setting the flags of the first 8 sprite layouts. Use Property 1E instead to set flags when more sprite layouts are used via prop. 0E or [[Callbacks#Custom_station_layout_.2824.29|callback 24]].&lt;br /&gt;
&lt;br /&gt;
=== Cargo types for random triggers (12) ===&lt;br /&gt;
&lt;br /&gt;
This sets which cargo types should trigger re-randomizing. The cargo types are given as a bitmask of the bits from column 3 (type B) in CargoTypes. &amp;amp;nbsp;If nothing is set (the default), the no random triggers will happen, to conserve CPU time.&lt;br /&gt;
&lt;br /&gt;
With GRF version 7 and above, the interpretation of bits changes. Instead of climate-dependent cargo slot numbers (type B), you have to set the bits of climate-independent cargo ID (type A).&lt;br /&gt;
&lt;br /&gt;
{{ottd|15.0}} Since 15.0, a default cargo translation table corresponding to the climate is used if one is not provided.&lt;br /&gt;
&lt;br /&gt;
=== General Flags (13) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.7|2.5}}||use different sprite set for ground sprites ([[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|var. 10]] is 1 for ground sprites, 0 otherwise)&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||when calculating the cargo amount to display, divide the amount by the station size (to simulate cargo distributed over the area of the station)&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.7|2.5}}||[[Callbacks#Next animation frame (1A/26/141/153/158)|callback 141]] needs random bits in var. 10&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|1.0|2.6}}||Use custom foundations on sloped tiles (the lowest byte of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|var. 10]] is 2 for foundation sprites)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.0|2.6}}||When bit 3 is set, use extended foundation block instead of the simple one&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bit 3 works somewhat similarly to bit 0: your sprite selection will be called again, with 2 in the lowest byte of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 10]]. If the chain ends on a callback result, the program will assume the foundation selection has failed and will use the default foundaton sprites. The low word of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 18]] will contain the tile type of the current tile; if you have [[Callbacks#Station sprite layout (14)|callback 14]] enabled, this will be the its return value - otherwise, the default TTD types (platform with building, platform with left roof etc.) are used. In either case, one is added for the NW-SE orientation, in case your station needs different foundations depending on its orientation. Bits 16 and 17 are set if the NW and and NE foundations are to merged with the corresponding neighbour tile, so you shouldn&#039;t draw the corresponding edge in the foundation sprite. Other bits of variable 10 and variable 18 are reserved for future use.&lt;br /&gt;
&lt;br /&gt;
Your sprite selection code should select a foundation sprite block. The contents of this block depends on whether bit 4 is set or not.&lt;br /&gt;
* Bit 4 clear (simple foundations):&lt;br /&gt;
[[File:simple_foundations.png]]&lt;br /&gt;
&lt;br /&gt;
The programme will combine the needed foundation from these 8 sprites depending on the current slope. You don&#039;t need to care about the merge data in bits 16..17 of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 18]]; it will be taken care of that automatically by adding the 7th and 8th sprite only when necessary.&lt;br /&gt;
* Bit 4 set (extended foundations):&lt;br /&gt;
[[File:extended_foundations.png]]&lt;br /&gt;
&lt;br /&gt;
You need to have one sprite for every slope that&#039;s possible below a rail station. The correct one will be automatically selected depending on the current slope. It can&#039;t handle the merging itself, however, so you need four foundation blocks: one with no edges removed, one with the NW edge removed, one with the NE edge removed and one with both north edges removed. Your sprite selection code is responsible for selecting the correct of those blocks according to the merge info in [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 18]].&lt;br /&gt;
&lt;br /&gt;
In both cases, you can put an additional value into register 100h, which will serve as an offset into the selected block. If you don&#039;t modify register 100h during the chain, it will default to 0. It is important that the dimensions of these sprites remain the same - thus bit 6 in the real sprites must be set to prevent GRFCodec from trimming the empty blue areas. The offset of these foundations must be -31 to the X direction and -9 to the Y direction.&lt;br /&gt;
&lt;br /&gt;
=== Can train enter tile (15) ===&lt;br /&gt;
&lt;br /&gt;
Like props. 11 and 14, this value contains eight bits relating to the eight possible tile types. If a bit is set, trains are prevented from routing through or entering any tile of this type.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Note: This property only allows setting the flags of the first 8 sprite layouts. Use Property 1E instead to set flags when more sprite layouts are used via prop. 0E or [[Callbacks#Custom_station_layout_.2824.29|callback 24]].&lt;br /&gt;
&lt;br /&gt;
=== Animation information (16) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this station (this is the default value).&lt;br /&gt;
Since you can&#039;t have properties for individual station tiles, this property applies for every tile of the station. If you don&#039;t want to animate some tiles, you should check the current position during [[Callbacks#Animation control (1B/25/140/152/159)|callback 140]] and return FD if the current tile doesn&#039;t need to be animated. If you also need animations of different length per tile, you&#039;ll have to use [[Callbacks#Next animation frame (1A/26/141/153/158)|callback 141]] for that.&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (17) ===&lt;br /&gt;
The meaning is the same as for [[Action0Houses#Animation Speed 1B|house property 1B]], but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Animation triggers (18) ===&lt;br /&gt;
This is a bit mask of events that should trigger [[Callbacks#Animation control (1B/25/140/152/159)|callback 140]], allowing to change the animation state&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property bit, var18 byte 0!!Property value!!Version!!Meaning!!Happens on!!Var 18 byte 1&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.7|2.5}}||Station part is built||the newly built tiles||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.7|2.5}}||New cargo arrives to station||whole station||Cargo type &amp;lt;ref name=&amp;quot;cargotype&amp;quot;&amp;gt;Bits 8..15 of var 18 contain the triggering cargo type. If your GRF has a cargo translation table, the cargo type will be an index in that table, or FFh if the cargo isn&#039;t in the table. If you don&#039;t have a cargo translation table, the cargo type will simply be the climate-dependent cargo type number.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.7|2.5}}||A cargo type gets removed from station||whole station||Cargo type &amp;lt;ref name=&amp;quot;cargotype&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.7|2.5}}||Train enters station (starts loading/unloading)||platform where the train is||&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.7|2.5}}||Train leaves station (done loading/unloading)||platform where the train is||&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.2|2.5|ottdrev=r22746}}||Train loads/unloads cargo||platform where the train is||&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp|0.7|2.5}}||Every 250 ticks||whole station||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The remaining bits are reserved for future triggers, they must be zero for now.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;happens on&amp;quot; column tells which tiles will [[Callbacks#Animation control (1B/25/140/152/159) |callback 140]] be called on.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Advanced sprite layout with register modifiers (1A) ===&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.2|no|ottdrev=r22518}}&lt;br /&gt;
Format:&lt;br /&gt;
 1A &amp;lt;num-layouts&amp;gt; &amp;lt;0x40 + num-sprites&amp;gt;&lt;br /&gt;
                  &amp;lt;groundsprite&amp;gt; &amp;lt;flags&amp;gt; [&amp;lt;register/value&amp;gt;]...&lt;br /&gt;
                  [ &amp;lt;buildingsprite&amp;gt; &amp;lt;flags&amp;gt;&lt;br /&gt;
                      ( &amp;lt;xoffset&amp;gt; &amp;lt;yoffset&amp;gt; &amp;lt;zoffset&amp;gt; &amp;lt;xextent&amp;gt; &amp;lt;yextent&amp;gt; &amp;lt;zextent&amp;gt; &lt;br /&gt;
                      | &amp;lt;xpixeloffset&amp;gt; &amp;lt;ypixeloffset&amp;gt; 80)&lt;br /&gt;
                    [&amp;lt;register/value&amp;gt;]...&lt;br /&gt;
                  ]...&lt;br /&gt;
&lt;br /&gt;
For further details see [https://wiki.openttd.org/en/Archive/Development/Advanced%20Sprite%20Layout#stations here] for now.&lt;br /&gt;
&lt;br /&gt;
=== Minimum bridge height (1B) ===&lt;br /&gt;
&lt;br /&gt;
This property allows building bridges over stations.&lt;br /&gt;
&lt;br /&gt;
The bridge height property defines minimum clearances required for a bridge for each of the four [[Action0/Stations#Define_custom_layout_.280E.29|tile types]] of this station (or zero to not allow any bridge). Values are given in &amp;quot;height level&amp;quot; units (1 level == 8px).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; |-&lt;br /&gt;
!Height (1)!!Appearance&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align:center;&amp;quot; |x1 y1 ||plain platform&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align:center;&amp;quot; |x2 y2 ||platform with building&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align:center;&amp;quot; |x3 y3 ||platform with roof, left side&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align:center;&amp;quot; |x4 y4 ||platform with roof, right side&lt;br /&gt;
|}&lt;br /&gt;
(1) where the values are one byte pairs (x-direction, y-direction) expressed in hexadecimal notation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
1B &amp;lt;1st pair&amp;gt; &amp;lt;2nd pair&amp;gt; &amp;lt;3rd pair&amp;gt; &amp;lt;4th pair&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
1B x1 y1 x2 y2 x3 y3 x4 y4&amp;lt;br /&amp;gt;&lt;br /&gt;
1B 01 01 02 02 03 03 03 03 // 8px 16px 24px 24px&lt;br /&gt;
&lt;br /&gt;
This property is currently only available for JGR&#039;s Patch Pack (v0.26.0 and later) and the developmental &amp;quot;New Map Features&amp;quot; (NMF) fork of OpenTTD.&lt;br /&gt;
&lt;br /&gt;
=== Station name (1C) ===&lt;br /&gt;
&lt;br /&gt;
=== Station class name (1D) ===&lt;br /&gt;
&lt;br /&gt;
=== Station sprite layout flags (1E) ===&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Since OpenTTD supports more than 8 sprite layouts to be used, props. 11, 14 and 15 are not sufficient to set the flags for all usable sprite layouts. This property is variable length and allows these flags to be set for each tile beyond the original limit of 8.&lt;br /&gt;
&lt;br /&gt;
The data is specified as flags for all sprite layouts in this way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;amp;lt;num&amp;amp;gt; &amp;amp;lt;flags1&amp;amp;gt; &amp;amp;lt;flags2&amp;amp;gt; ... &amp;amp;lt;flagsn&amp;amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Name!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B*||num||Number of different tiles supported (see below)&lt;br /&gt;
|-&lt;br /&gt;
|B||flags1...||The flags for each of the &amp;amp;lt;num&amp;amp;gt; tiles, as specified below&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The flag values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
|Bit||Value||Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||01||Tile should contain catenary pylons.&lt;br /&gt;
|-&lt;br /&gt;
|1||02||Tile should NOT contain catenary wires.&lt;br /&gt;
|-&lt;br /&gt;
|2||04||Tile is blocked to vehicles.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
These should be combined as needed.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
=== Using TTD&#039;s sprite layouts for certain tiles ===&lt;br /&gt;
&lt;br /&gt;
To use TTD&#039;s layout, you use &amp;lt;code&amp;gt;00 00 00 00&amp;lt;/code&amp;gt; for the ground sprite number and leave off everything else.&lt;br /&gt;
&lt;br /&gt;
So instead of for example&lt;br /&gt;
&lt;br /&gt;
 F4 03 00 00&lt;br /&gt;
    00 00 00    10 05 02    2E 84 00 00&lt;br /&gt;
    00 0B 00    10 05 02    30 84 00 00&lt;br /&gt;
    80&lt;br /&gt;
&lt;br /&gt;
you just put&lt;br /&gt;
&lt;br /&gt;
 00 00 00 00&lt;br /&gt;
&lt;br /&gt;
=== Using transparent sprites ===&lt;br /&gt;
&lt;br /&gt;
You can use transparent sprites to make for example the roof translucent like in TTD&#039;s stations. The roof of TTD&#039;s stations is made like this:&lt;br /&gt;
&lt;br /&gt;
 00 00 10    10 10 0A    37 84 00 00&lt;br /&gt;
 00 00 80    00 00 00    3B 44 22 03&lt;br /&gt;
&lt;br /&gt;
The first sprite here is the non-transparent frame of the roof, drawn in company colours (it has bit 15 set). The second part is a special &amp;quot;linked&amp;quot; sprite without its own bounding box, it shares that of the previous sprite. That&#039;s done by setting the z offset to 80.&lt;br /&gt;
&lt;br /&gt;
To make that second sprite transparent, bit 14 is set in the sprite number, and the upper word is set to 322 (*), so 0322443B means to take sprite 43B and draw it in transparent mode. The colours of that sprite are ignored entirely, every pixel in colour 0 is fully transparent, and all other pixels are semi-transparent (essentially just causing what they are drawn over to become darker).&lt;br /&gt;
&lt;br /&gt;
(*) This is the [[RecolorSprites#Default_recolour_sprites | recolour sprite]] for the glass effect.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5011</id>
		<title>Action0/Industry Tiles</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5011"/>
		<updated>2025-04-24T18:41:19Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Triggers for callback 25 (11) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Industry tiles work similarly to town buildings, except that they are not stand-alone; they are always part of an industry.&lt;br /&gt;
&lt;br /&gt;
Defining industry tiles follows the same schema as houses do: to start using an ID, you first need to define it by setting property 8 for it. If you try to reference an ID (either via action0 or via action3) that isn&#039;t defined, your request is ignored, but not reported as an error, either. This means that if you want to conditionally define an ID, all you need to do is skipping the action0 that sets property8, and everything else gets skipped automatically.&lt;br /&gt;
&lt;br /&gt;
Industry tile IDs are unique within each grf file. The per-GRF ID is specified as a byte, which means no GRF can define more than 256 tile IDs. You should use your industry tile IDs sparingly. [[VariationalAction2/Industry_Tiles#Relative_position_.2843.29| Variational action 2 variable 43]] for industry tiles can help you limiting tile consumption to 2 or 3 per industry. Avoid using tile FFh, so the tileID can be turned into an extended byte (in Action 3) in the distant future without breaking your NewGRF.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} In total, TTDPatch can have up to a total of 256 new industry tile IDs (i.e. old tile types don&#039;t count).&lt;br /&gt;
&lt;br /&gt;
{{ottd|}} OpenTTD can have 512 IDs for all active grf files, but that includes non-overridden original tiles.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property !![[GRFActionsDetailed|Size]] !!Version !! Description&lt;br /&gt;
|-&lt;br /&gt;
|08||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Substitute building type&lt;br /&gt;
|-&lt;br /&gt;
|09||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Industry tile override&lt;br /&gt;
|-&lt;br /&gt;
|0A,0B,0C||W||{{ottdp|0.6|2.5}}||Tile acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 49}}||Land shape flags&lt;br /&gt;
|-&lt;br /&gt;
|0E||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0F||W||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|10||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation speed.&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Triggers for callback 25&lt;br /&gt;
|-&lt;br /&gt;
|12||B||{{ottdp|0.6|2.5|ttdprev=beta 2}}||Special flags&lt;br /&gt;
|-&lt;br /&gt;
|13||V||{{ottdp|1.9|no|ottdrev=e66cec8f}}||Tile acceptance list&lt;br /&gt;
|-&lt;br /&gt;
|14||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute tile type (08) ===&lt;br /&gt;
&lt;br /&gt;
This tile type will be used instead of your new one if your definition isn&#039;t available for any reason. Valid values are [http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#Class8 00h-AEh]. Assigning this property copies the properties of the old type just like it does with houses.&lt;br /&gt;
&lt;br /&gt;
If this tile&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Industry tile override (09) ===&lt;br /&gt;
&lt;br /&gt;
Works like the house override property for houses.&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance (0A, 0B, 0C) ===&lt;br /&gt;
&lt;br /&gt;
These three words define what cargoes the tile accepts, and how much of them. The low byte defines the type of the cargo according to the current climate, while the high byte defines the degree of acceptance in 1/8 units. If you don&#039;t need all three cargo types, just zero out the high byte of the extra properties.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|7}} From GRF version 7 and above, the meaning of the low byte changes: instead of a climate-dependent cargo slot number, you have to give a climate-independent cargo ID. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it&#039;s the cargo bit. Acceptance of cargoes not currently present will automatically be disabled.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} These properties only support three cargos. Use property 13 instead to list more cargo types. &lt;br /&gt;
&lt;br /&gt;
=== Land shape flags (0D) ===&lt;br /&gt;
&lt;br /&gt;
This property defines which slopes the tile can be built on.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||NW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||NE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||SW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||SE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5}}||Can only be built on flat land&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||The tile is allowed on both land and water&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Industry tiles are never built on steep slopes unless [[Callbacks#Custom shape check (2F) |callback 2F]] is enabled, but bits 0..4 are ignored in that case.&lt;br /&gt;
&lt;br /&gt;
Bit 5 can be used to allow tiles of land industries built on water or vice versa. It effectively disables the land/water check code for the tile. If you need to customize the behavior further, you can use [[Callbacks#Custom shape check (2F) |callback 2F]] to decide what kind of water/land is allowed.&lt;br /&gt;
&lt;br /&gt;
;&#039;&#039;&#039;PLEASE NOTE&#039;&#039;&#039;: Be careful when setting this property. If you fail to set it correctly, your industry may end up building on a hillside, which is probably not what you want. The easiest way is to set bit 4 for middle tiles, bit 0 for the tiles along the SE edge, bit 1 for those along the SW edge and so on.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0E) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!value!!version!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp| | }}||use [[Callbacks#Next animation frame (1A/26/141/153/158) |callback 26]] to decide the next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp| | }}||use [[Callbacks#Length of animation frame (20/27/142/154/15A) |callback 27]] to decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Decide cargo acceptance (2B) |callback 2B]] to decide amount of acceptance&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Get accepted cargo types (2A/2C) |callback 2C]] to decide accepted types&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp| | }}||use [[Callbacks#Custom shape check (2F) |callback 2F]] to check if a slope is suitable&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp| | }}||use [[Callbacks#Decide drawing default foundations (30/14E/150) |callback 30]] to decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp| |2.5|ttdprev=beta 3}}||use [[Callbacks#Disable autosloping (3C/14F/15D) |callback 3C]] to allow or deny autosloping below the tile&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please note that [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] doesn&#039;t have a bit here. To use [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]], simply set the wanted bits in property 11 and it will work as intended.&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0F) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this tile (this is the default value).&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (10) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Triggers for [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] (11) ===&lt;br /&gt;
&lt;br /&gt;
Call [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] when:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property bit, var 18 byte 0!!Property value!!Version!!Meaning||Happens on||Var 18 byte 1&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||the construction state changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time.&amp;lt;br&amp;gt;{{ttdp|}} For the first call to happen, you also have to set [[Action0/Industry_Tiles#Animation_information_.280F.29|property 0F]] to some other value than 0xFFFF.&amp;lt;/ref&amp;gt;||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||the tile is processed in the periodic processing loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||the industry of the tile is processed in the periodic processing loop (synchronized animation)||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||the industry of the tile receives input cargo from a station||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5|ttdprev=beta 2}}||the industry distributes its output cargo to one of the stations nearby||all tiles||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently no trigger provides additional information in var 18 bytes 1 to 3.&lt;br /&gt;
&lt;br /&gt;
=== Special flags (12) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||[[Callbacks#Next animation frame (1A/26/141/153/158) |Callback 26]] needs random bits&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.9|no|ottdrev=e66cec8f}} In addition to the cargotypes set by property 0A..0C and 13, the tile accepts all cargotypes which the industry accepts.&lt;br /&gt;
* This considers industry properties 11 and 26 and callback 14B.&lt;br /&gt;
* This does not consider industry callback 3D.&lt;br /&gt;
* This property adds 8/8 acceptance for the matching cargotypes. You can list negative acceptances (-8/8) in property 13 to exclude specific cargos.&lt;br /&gt;
* Tile callback 2C overrides all acceptances including those added by this flag.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance list (13) ===&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} &lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
 &amp;lt;numinput&amp;gt; (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;)*&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Variable!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||numinput||Number of (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;) pairs to follow,&lt;br /&gt;
|-&lt;br /&gt;
|B||cargotype||Cargotype (from CTT) to accept.&lt;br /&gt;
|-&lt;br /&gt;
|B||acceptance||Acceptance in 1/8 units. May be negative to negate property 12 bit 1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property defines up to 16 cargotypes, which are accepted by the industry tile.&lt;br /&gt;
Use this property instead of property 0A..0C.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5010</id>
		<title>Callback: Animation control</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5010"/>
		<updated>2025-04-24T18:39:00Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Animation control (1B/1C/25/140/148/152/159) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Animation control (1B/1C/25/140/148/152/159) ==&lt;br /&gt;
&lt;br /&gt;
These callbacks are called, when an animation trigger happens.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Callback!!Feature!!Mask property!!Trigger!!Variable 10!!Variable 18&lt;br /&gt;
|-&lt;br /&gt;
|1B||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 2]]&lt;br /&gt;
|[[Action0/Houses#Periodic_refresh_multiplier_.2816.29|Periodic, see property 16]] &amp;lt;ref&amp;gt;For multi-tile houses [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] controls, whether the trigger is synchronised across all house tiles. See details there.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] is set.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|1C||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 3]]&lt;br /&gt;
|[[VariationalAction2/Houses#Construction_stage_and_pseudo-random_values_.2840.29|Construction stage]] changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time.&amp;lt;br&amp;gt;{{ttdp|}} For the first call to happen, you also have to set [[Action0/Houses#Building_flags_.2809.29|property 9 bit 5]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|25||Industry tiles&lt;br /&gt;
|[[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot;&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if the trigger applies to multiple tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|140||Stations, road stops&lt;br /&gt;
|[[Action0/Stations#Animation_triggers_.2818.29|Station property 18]], [[Action0/Road_Stops#Animation_triggers_.2810.29|road stop property 10]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot; /&amp;gt;&lt;br /&gt;
|Trigger and more, see [[Action0/Stations#Animation_triggers_.2818.29|station property 18]]&lt;br /&gt;
|-&lt;br /&gt;
|148||Houses&lt;br /&gt;
|[[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|Property 1E]]&lt;br /&gt;
|Watched cargo accepted &amp;lt;ref&amp;gt;Due to implementation details, up to 250 game ticks can pass between the actual acceptance and triggering this callback.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|See [[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|property 1E]]&lt;br /&gt;
|-&lt;br /&gt;
|154||Airport tiles&lt;br /&gt;
|[[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits&lt;br /&gt;
|Trigger and more, see [[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|159||Objects&lt;br /&gt;
|[[Action0/Objects#Animation_triggers_.2813.29|Property 13]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits&lt;br /&gt;
|Trigger and more, see [[Action0/Objects#Animation_triggers_.2813.29|property 13]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The return value has the format SSFF:&lt;br /&gt;
* FF: One of the following values:&lt;br /&gt;
: {| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00 - FC||Jump to this animation frame.&lt;br /&gt;
|-&lt;br /&gt;
|FD||leave the animation in its current state (do nothing)&lt;br /&gt;
|-&lt;br /&gt;
|FE||start animation with its current frame&lt;br /&gt;
|-&lt;br /&gt;
|FF||stop animation in its current frame&lt;br /&gt;
|}&lt;br /&gt;
* SS: Sound effect: If non-zero, the sound effect number to play at the tile.&lt;br /&gt;
&lt;br /&gt;
Note: Every time the animation frame is changed the map tile will be refreshed, even if the selected graphics stay the same. Therefore using the animation frame as a timer should be avoided, and animation triggers should be preferred instead.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5009</id>
		<title>Action0/Industry Tiles</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5009"/>
		<updated>2025-04-23T16:22:39Z</updated>

		<summary type="html">&lt;p&gt;Frosch: wording&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Industry tiles work similarly to town buildings, except that they are not stand-alone; they are always part of an industry.&lt;br /&gt;
&lt;br /&gt;
Defining industry tiles follows the same schema as houses do: to start using an ID, you first need to define it by setting property 8 for it. If you try to reference an ID (either via action0 or via action3) that isn&#039;t defined, your request is ignored, but not reported as an error, either. This means that if you want to conditionally define an ID, all you need to do is skipping the action0 that sets property8, and everything else gets skipped automatically.&lt;br /&gt;
&lt;br /&gt;
Industry tile IDs are unique within each grf file. The per-GRF ID is specified as a byte, which means no GRF can define more than 256 tile IDs. You should use your industry tile IDs sparingly. [[VariationalAction2/Industry_Tiles#Relative_position_.2843.29| Variational action 2 variable 43]] for industry tiles can help you limiting tile consumption to 2 or 3 per industry. Avoid using tile FFh, so the tileID can be turned into an extended byte (in Action 3) in the distant future without breaking your NewGRF.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} In total, TTDPatch can have up to a total of 256 new industry tile IDs (i.e. old tile types don&#039;t count).&lt;br /&gt;
&lt;br /&gt;
{{ottd|}} OpenTTD can have 512 IDs for all active grf files, but that includes non-overridden original tiles.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property !![[GRFActionsDetailed|Size]] !!Version !! Description&lt;br /&gt;
|-&lt;br /&gt;
|08||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Substitute building type&lt;br /&gt;
|-&lt;br /&gt;
|09||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Industry tile override&lt;br /&gt;
|-&lt;br /&gt;
|0A,0B,0C||W||{{ottdp|0.6|2.5}}||Tile acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 49}}||Land shape flags&lt;br /&gt;
|-&lt;br /&gt;
|0E||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0F||W||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|10||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation speed.&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Triggers for callback 25&lt;br /&gt;
|-&lt;br /&gt;
|12||B||{{ottdp|0.6|2.5|ttdprev=beta 2}}||Special flags&lt;br /&gt;
|-&lt;br /&gt;
|13||V||{{ottdp|1.9|no|ottdrev=e66cec8f}}||Tile acceptance list&lt;br /&gt;
|-&lt;br /&gt;
|14||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute tile type (08) ===&lt;br /&gt;
&lt;br /&gt;
This tile type will be used instead of your new one if your definition isn&#039;t available for any reason. Valid values are [http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#Class8 00h-AEh]. Assigning this property copies the properties of the old type just like it does with houses.&lt;br /&gt;
&lt;br /&gt;
If this tile&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Industry tile override (09) ===&lt;br /&gt;
&lt;br /&gt;
Works like the house override property for houses.&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance (0A, 0B, 0C) ===&lt;br /&gt;
&lt;br /&gt;
These three words define what cargoes the tile accepts, and how much of them. The low byte defines the type of the cargo according to the current climate, while the high byte defines the degree of acceptance in 1/8 units. If you don&#039;t need all three cargo types, just zero out the high byte of the extra properties.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|7}} From GRF version 7 and above, the meaning of the low byte changes: instead of a climate-dependent cargo slot number, you have to give a climate-independent cargo ID. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it&#039;s the cargo bit. Acceptance of cargoes not currently present will automatically be disabled.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} These properties only support three cargos. Use property 13 instead to list more cargo types. &lt;br /&gt;
&lt;br /&gt;
=== Land shape flags (0D) ===&lt;br /&gt;
&lt;br /&gt;
This property defines which slopes the tile can be built on.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||NW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||NE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||SW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||SE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5}}||Can only be built on flat land&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||The tile is allowed on both land and water&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Industry tiles are never built on steep slopes unless [[Callbacks#Custom shape check (2F) |callback 2F]] is enabled, but bits 0..4 are ignored in that case.&lt;br /&gt;
&lt;br /&gt;
Bit 5 can be used to allow tiles of land industries built on water or vice versa. It effectively disables the land/water check code for the tile. If you need to customize the behavior further, you can use [[Callbacks#Custom shape check (2F) |callback 2F]] to decide what kind of water/land is allowed.&lt;br /&gt;
&lt;br /&gt;
;&#039;&#039;&#039;PLEASE NOTE&#039;&#039;&#039;: Be careful when setting this property. If you fail to set it correctly, your industry may end up building on a hillside, which is probably not what you want. The easiest way is to set bit 4 for middle tiles, bit 0 for the tiles along the SE edge, bit 1 for those along the SW edge and so on.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0E) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!value!!version!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp| | }}||use [[Callbacks#Next animation frame (1A/26/141/153/158) |callback 26]] to decide the next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp| | }}||use [[Callbacks#Length of animation frame (20/27/142/154/15A) |callback 27]] to decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Decide cargo acceptance (2B) |callback 2B]] to decide amount of acceptance&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Get accepted cargo types (2A/2C) |callback 2C]] to decide accepted types&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp| | }}||use [[Callbacks#Custom shape check (2F) |callback 2F]] to check if a slope is suitable&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp| | }}||use [[Callbacks#Decide drawing default foundations (30/14E/150) |callback 30]] to decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp| |2.5|ttdprev=beta 3}}||use [[Callbacks#Disable autosloping (3C/14F/15D) |callback 3C]] to allow or deny autosloping below the tile&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please note that [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] doesn&#039;t have a bit here. To use [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]], simply set the wanted bits in property 11 and it will work as intended.&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0F) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this tile (this is the default value).&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (10) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Triggers for [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] (11) ===&lt;br /&gt;
&lt;br /&gt;
Call [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] when:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning||Happens on||Var 18&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||the construction state changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time. For the first call to happen, you also have to set [[Action0/Industry_Tiles#Animation_information_.280F.29|property 0F]] to some other value than 0xFFFF.&amp;lt;/ref&amp;gt;||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||the tile is processed in the periodic processing loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||the industry of the tile is processed in the periodic processing loop (synchronized animation)||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||the industry of the tile receives input cargo from a station||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5|ttdprev=beta 2}}||the industry distributes its output cargo to one of the stations nearby||all tiles||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently no trigger provides additional information in var 18.&lt;br /&gt;
&lt;br /&gt;
=== Special flags (12) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||[[Callbacks#Next animation frame (1A/26/141/153/158) |Callback 26]] needs random bits&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.9|no|ottdrev=e66cec8f}} In addition to the cargotypes set by property 0A..0C and 13, the tile accepts all cargotypes which the industry accepts.&lt;br /&gt;
* This considers industry properties 11 and 26 and callback 14B.&lt;br /&gt;
* This does not consider industry callback 3D.&lt;br /&gt;
* This property adds 8/8 acceptance for the matching cargotypes. You can list negative acceptances (-8/8) in property 13 to exclude specific cargos.&lt;br /&gt;
* Tile callback 2C overrides all acceptances including those added by this flag.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance list (13) ===&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} &lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
 &amp;lt;numinput&amp;gt; (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;)*&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Variable!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||numinput||Number of (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;) pairs to follow,&lt;br /&gt;
|-&lt;br /&gt;
|B||cargotype||Cargotype (from CTT) to accept.&lt;br /&gt;
|-&lt;br /&gt;
|B||acceptance||Acceptance in 1/8 units. May be negative to negate property 12 bit 1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property defines up to 16 cargotypes, which are accepted by the industry tile.&lt;br /&gt;
Use this property instead of property 0A..0C.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Airport_Tiles&amp;diff=5008</id>
		<title>Action0/Airport Tiles</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Airport_Tiles&amp;diff=5008"/>
		<updated>2025-04-23T16:22:20Z</updated>

		<summary type="html">&lt;p&gt;Frosch: wording&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.1|ottdrev=r19204}}&lt;br /&gt;
Airport tiles work like industry tiles and similarly to town buildings, except that they are not stand-alone. This means an airport tile can&#039;t stand alone, it&#039;s always part of an airport.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Version!![[GRFActionsDetailed|Size]]!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||{{ottdp|1.1|ottdrev=r19204}}||B||Substitute airport tile type&lt;br /&gt;
|-&lt;br /&gt;
|09||{{ottdp|1.1|ottdrev=r19204}}||B||Airport tile override&lt;br /&gt;
|-&lt;br /&gt;
|0E||{{ottdp|1.1|ottdrev=r19204}}||B||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0F||{{ottdp|1.1|ottdrev=r19204}}||W||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|10||{{ottdp|1.1|ottdrev=r19204}}||B||Animation speed.&lt;br /&gt;
|-&lt;br /&gt;
|11||{{ottdp|1.1|ottdrev=r19204}}||B||Animation triggers&lt;br /&gt;
|-&lt;br /&gt;
|12||{{ottdp|15}}||W n*W||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute tile type (08) ===&lt;br /&gt;
&lt;br /&gt;
This tile type will be used instead of your new one if your definition isn&#039;t available for any reason. Assigning this property copies the properties of the old type just like it does with houses. If this tile&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Airport tile override (09) ===&lt;br /&gt;
&lt;br /&gt;
Works like the house override property for houses and industry tiles.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0E) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!value!!version!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Next animation frame (1A/26/141/153/158) |callback 153]] to decide the next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Length of animation frame (20/27/142/154/15A) |callback 154]] to decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp}}||(reserved)&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp}}||(reserved)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.1|ottdrev=r19204}}||use callback xx to check if a slope is suitable (not yet implemented)&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Decide drawing default foundations (30/14E/150) |callback 150]] to decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp|1.1|ottdrev=r19204}}||use callback xx to allow or deny autosloping below the tile (not yet implemented)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please note that callback 152 doesn&#039;t have a bit here. To use [[Callbacks#Animation control (1B/25/140/152/159) |callback 152]], simply set the wanted bits in property 11 and it will work as intended.&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0F) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this tile (this is the default value).&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (10) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Animation triggers via [[Callback:_Animation_control |callback 152]] (11) ===&lt;br /&gt;
&lt;br /&gt;
This shares some flags with industry tiles and others with stations. Call [[Callback:_Animation_control|callback 152]] when:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning!!Happens on||Var 18&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|1.1|ottdrev=r19204}}||airport was just constructed||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.1|ottdrev=r19204}}||the tile is processed in the periodic processing loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|1.1|ottdrev=r19204}}||new cargo arrives at the station (for all airport tiles the same)||all tiles||&amp;lt;ref name=&amp;quot;cargotype&amp;quot;&amp;gt;Bits 8..15 of var 18 contain the triggering cargo type. If your GRF has a cargo translation table, the cargo type will be an index in that table, or FFh if the cargo isn&#039;t in the table. If you don&#039;t have a cargo translation table, the cargo type will simply be the climate-dependent cargo type number.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|1.1|ottdrev=r19204}}||a cargo type gets removed from the station (for all airport tiles the same)||all tiles||&amp;lt;ref name=&amp;quot;cargotype&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.1|ottdrev=r19204}}||every 250 ticks (for all airport tiles the same)||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.9}}||Triggered when an airplane (not a helicopter!) lands at airport||single tile||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Airport_Tiles&amp;diff=5007</id>
		<title>Action0/Airport Tiles</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Airport_Tiles&amp;diff=5007"/>
		<updated>2025-04-23T16:21:41Z</updated>

		<summary type="html">&lt;p&gt;Frosch: add trigger area&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.1|ottdrev=r19204}}&lt;br /&gt;
Airport tiles work like industry tiles and similarly to town buildings, except that they are not stand-alone. This means an airport tile can&#039;t stand alone, it&#039;s always part of an airport.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Version!![[GRFActionsDetailed|Size]]!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||{{ottdp|1.1|ottdrev=r19204}}||B||Substitute airport tile type&lt;br /&gt;
|-&lt;br /&gt;
|09||{{ottdp|1.1|ottdrev=r19204}}||B||Airport tile override&lt;br /&gt;
|-&lt;br /&gt;
|0E||{{ottdp|1.1|ottdrev=r19204}}||B||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0F||{{ottdp|1.1|ottdrev=r19204}}||W||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|10||{{ottdp|1.1|ottdrev=r19204}}||B||Animation speed.&lt;br /&gt;
|-&lt;br /&gt;
|11||{{ottdp|1.1|ottdrev=r19204}}||B||Animation triggers&lt;br /&gt;
|-&lt;br /&gt;
|12||{{ottdp|15}}||W n*W||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute tile type (08) ===&lt;br /&gt;
&lt;br /&gt;
This tile type will be used instead of your new one if your definition isn&#039;t available for any reason. Assigning this property copies the properties of the old type just like it does with houses. If this tile&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Airport tile override (09) ===&lt;br /&gt;
&lt;br /&gt;
Works like the house override property for houses and industry tiles.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0E) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!value!!version!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Next animation frame (1A/26/141/153/158) |callback 153]] to decide the next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Length of animation frame (20/27/142/154/15A) |callback 154]] to decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp}}||(reserved)&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp}}||(reserved)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.1|ottdrev=r19204}}||use callback xx to check if a slope is suitable (not yet implemented)&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.1|ottdrev=r19204}}||use [[Callbacks#Decide drawing default foundations (30/14E/150) |callback 150]] to decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp|1.1|ottdrev=r19204}}||use callback xx to allow or deny autosloping below the tile (not yet implemented)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please note that callback 152 doesn&#039;t have a bit here. To use [[Callbacks#Animation control (1B/25/140/152/159) |callback 152]], simply set the wanted bits in property 11 and it will work as intended.&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0F) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this tile (this is the default value).&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (10) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Animation triggers via [[Callback:_Animation_control |callback 152]] (11) ===&lt;br /&gt;
&lt;br /&gt;
This shares some flags with industry tiles and others with stations. Call [[Callback:_Animation_control|callback 152]] when:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning!!Trigger area||Var 18&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|1.1|ottdrev=r19204}}||airport was just constructed||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.1|ottdrev=r19204}}||the tile is processed in the periodic processing loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|1.1|ottdrev=r19204}}||new cargo arrives at the station (for all airport tiles the same)||all tiles||&amp;lt;ref name=&amp;quot;cargotype&amp;quot;&amp;gt;Bits 8..15 of var 18 contain the triggering cargo type. If your GRF has a cargo translation table, the cargo type will be an index in that table, or FFh if the cargo isn&#039;t in the table. If you don&#039;t have a cargo translation table, the cargo type will simply be the climate-dependent cargo type number.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|1.1|ottdrev=r19204}}||a cargo type gets removed from the station (for all airport tiles the same)||all tiles||&amp;lt;ref name=&amp;quot;cargotype&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.1|ottdrev=r19204}}||every 250 ticks (for all airport tiles the same)||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.9}}||Triggered when an airplane (not a helicopter!) lands at airport||single tile||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5006</id>
		<title>Action0/Industry Tiles</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5006"/>
		<updated>2025-04-23T16:18:49Z</updated>

		<summary type="html">&lt;p&gt;Frosch: add trigger area&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Industry tiles work similarly to town buildings, except that they are not stand-alone; they are always part of an industry.&lt;br /&gt;
&lt;br /&gt;
Defining industry tiles follows the same schema as houses do: to start using an ID, you first need to define it by setting property 8 for it. If you try to reference an ID (either via action0 or via action3) that isn&#039;t defined, your request is ignored, but not reported as an error, either. This means that if you want to conditionally define an ID, all you need to do is skipping the action0 that sets property8, and everything else gets skipped automatically.&lt;br /&gt;
&lt;br /&gt;
Industry tile IDs are unique within each grf file. The per-GRF ID is specified as a byte, which means no GRF can define more than 256 tile IDs. You should use your industry tile IDs sparingly. [[VariationalAction2/Industry_Tiles#Relative_position_.2843.29| Variational action 2 variable 43]] for industry tiles can help you limiting tile consumption to 2 or 3 per industry. Avoid using tile FFh, so the tileID can be turned into an extended byte (in Action 3) in the distant future without breaking your NewGRF.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} In total, TTDPatch can have up to a total of 256 new industry tile IDs (i.e. old tile types don&#039;t count).&lt;br /&gt;
&lt;br /&gt;
{{ottd|}} OpenTTD can have 512 IDs for all active grf files, but that includes non-overridden original tiles.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property !![[GRFActionsDetailed|Size]] !!Version !! Description&lt;br /&gt;
|-&lt;br /&gt;
|08||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Substitute building type&lt;br /&gt;
|-&lt;br /&gt;
|09||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Industry tile override&lt;br /&gt;
|-&lt;br /&gt;
|0A,0B,0C||W||{{ottdp|0.6|2.5}}||Tile acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 49}}||Land shape flags&lt;br /&gt;
|-&lt;br /&gt;
|0E||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0F||W||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|10||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation speed.&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Triggers for callback 25&lt;br /&gt;
|-&lt;br /&gt;
|12||B||{{ottdp|0.6|2.5|ttdprev=beta 2}}||Special flags&lt;br /&gt;
|-&lt;br /&gt;
|13||V||{{ottdp|1.9|no|ottdrev=e66cec8f}}||Tile acceptance list&lt;br /&gt;
|-&lt;br /&gt;
|14||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute tile type (08) ===&lt;br /&gt;
&lt;br /&gt;
This tile type will be used instead of your new one if your definition isn&#039;t available for any reason. Valid values are [http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#Class8 00h-AEh]. Assigning this property copies the properties of the old type just like it does with houses.&lt;br /&gt;
&lt;br /&gt;
If this tile&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Industry tile override (09) ===&lt;br /&gt;
&lt;br /&gt;
Works like the house override property for houses.&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance (0A, 0B, 0C) ===&lt;br /&gt;
&lt;br /&gt;
These three words define what cargoes the tile accepts, and how much of them. The low byte defines the type of the cargo according to the current climate, while the high byte defines the degree of acceptance in 1/8 units. If you don&#039;t need all three cargo types, just zero out the high byte of the extra properties.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|7}} From GRF version 7 and above, the meaning of the low byte changes: instead of a climate-dependent cargo slot number, you have to give a climate-independent cargo ID. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it&#039;s the cargo bit. Acceptance of cargoes not currently present will automatically be disabled.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} These properties only support three cargos. Use property 13 instead to list more cargo types. &lt;br /&gt;
&lt;br /&gt;
=== Land shape flags (0D) ===&lt;br /&gt;
&lt;br /&gt;
This property defines which slopes the tile can be built on.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||NW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||NE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||SW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||SE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5}}||Can only be built on flat land&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||The tile is allowed on both land and water&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Industry tiles are never built on steep slopes unless [[Callbacks#Custom shape check (2F) |callback 2F]] is enabled, but bits 0..4 are ignored in that case.&lt;br /&gt;
&lt;br /&gt;
Bit 5 can be used to allow tiles of land industries built on water or vice versa. It effectively disables the land/water check code for the tile. If you need to customize the behavior further, you can use [[Callbacks#Custom shape check (2F) |callback 2F]] to decide what kind of water/land is allowed.&lt;br /&gt;
&lt;br /&gt;
;&#039;&#039;&#039;PLEASE NOTE&#039;&#039;&#039;: Be careful when setting this property. If you fail to set it correctly, your industry may end up building on a hillside, which is probably not what you want. The easiest way is to set bit 4 for middle tiles, bit 0 for the tiles along the SE edge, bit 1 for those along the SW edge and so on.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0E) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!value!!version!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp| | }}||use [[Callbacks#Next animation frame (1A/26/141/153/158) |callback 26]] to decide the next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp| | }}||use [[Callbacks#Length of animation frame (20/27/142/154/15A) |callback 27]] to decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Decide cargo acceptance (2B) |callback 2B]] to decide amount of acceptance&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Get accepted cargo types (2A/2C) |callback 2C]] to decide accepted types&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp| | }}||use [[Callbacks#Custom shape check (2F) |callback 2F]] to check if a slope is suitable&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp| | }}||use [[Callbacks#Decide drawing default foundations (30/14E/150) |callback 30]] to decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp| |2.5|ttdprev=beta 3}}||use [[Callbacks#Disable autosloping (3C/14F/15D) |callback 3C]] to allow or deny autosloping below the tile&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please note that [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] doesn&#039;t have a bit here. To use [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]], simply set the wanted bits in property 11 and it will work as intended.&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0F) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this tile (this is the default value).&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (10) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Triggers for [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] (11) ===&lt;br /&gt;
&lt;br /&gt;
Call [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] when:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning||Trigger area||Var 18&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||the construction state changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time. For the first call to happen, you also have to set [[Action0/Industry_Tiles#Animation_information_.280F.29|property 0F]] to some other value than 0xFFFF.&amp;lt;/ref&amp;gt;||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||the tile is processed in the periodic processing loop||single tile||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||the industry of the tile is processed in the periodic processing loop (synchronized animation)||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||the industry of the tile receives input cargo from a station||all tiles||&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5|ttdprev=beta 2}}||the industry distributes its output cargo to one of the stations nearby||all tiles||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently no trigger provides additional information in var 18.&lt;br /&gt;
&lt;br /&gt;
=== Special flags (12) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||[[Callbacks#Next animation frame (1A/26/141/153/158) |Callback 26]] needs random bits&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.9|no|ottdrev=e66cec8f}} In addition to the cargotypes set by property 0A..0C and 13, the tile accepts all cargotypes which the industry accepts.&lt;br /&gt;
* This considers industry properties 11 and 26 and callback 14B.&lt;br /&gt;
* This does not consider industry callback 3D.&lt;br /&gt;
* This property adds 8/8 acceptance for the matching cargotypes. You can list negative acceptances (-8/8) in property 13 to exclude specific cargos.&lt;br /&gt;
* Tile callback 2C overrides all acceptances including those added by this flag.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance list (13) ===&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} &lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
 &amp;lt;numinput&amp;gt; (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;)*&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Variable!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||numinput||Number of (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;) pairs to follow,&lt;br /&gt;
|-&lt;br /&gt;
|B||cargotype||Cargotype (from CTT) to accept.&lt;br /&gt;
|-&lt;br /&gt;
|B||acceptance||Acceptance in 1/8 units. May be negative to negate property 12 bit 1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property defines up to 16 cargotypes, which are accepted by the industry tile.&lt;br /&gt;
Use this property instead of property 0A..0C.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5005</id>
		<title>Action0/Industry Tiles</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Industry_Tiles&amp;diff=5005"/>
		<updated>2025-04-23T16:14:37Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Triggers for callback 25 (11) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Industry tiles work similarly to town buildings, except that they are not stand-alone; they are always part of an industry.&lt;br /&gt;
&lt;br /&gt;
Defining industry tiles follows the same schema as houses do: to start using an ID, you first need to define it by setting property 8 for it. If you try to reference an ID (either via action0 or via action3) that isn&#039;t defined, your request is ignored, but not reported as an error, either. This means that if you want to conditionally define an ID, all you need to do is skipping the action0 that sets property8, and everything else gets skipped automatically.&lt;br /&gt;
&lt;br /&gt;
Industry tile IDs are unique within each grf file. The per-GRF ID is specified as a byte, which means no GRF can define more than 256 tile IDs. You should use your industry tile IDs sparingly. [[VariationalAction2/Industry_Tiles#Relative_position_.2843.29| Variational action 2 variable 43]] for industry tiles can help you limiting tile consumption to 2 or 3 per industry. Avoid using tile FFh, so the tileID can be turned into an extended byte (in Action 3) in the distant future without breaking your NewGRF.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} In total, TTDPatch can have up to a total of 256 new industry tile IDs (i.e. old tile types don&#039;t count).&lt;br /&gt;
&lt;br /&gt;
{{ottd|}} OpenTTD can have 512 IDs for all active grf files, but that includes non-overridden original tiles.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Property !![[GRFActionsDetailed|Size]] !!Version !! Description&lt;br /&gt;
|-&lt;br /&gt;
|08||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Substitute building type&lt;br /&gt;
|-&lt;br /&gt;
|09||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Industry tile override&lt;br /&gt;
|-&lt;br /&gt;
|0A,0B,0C||W||{{ottdp|0.6|2.5}}||Tile acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 49}}||Land shape flags&lt;br /&gt;
|-&lt;br /&gt;
|0E||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Callback flags&lt;br /&gt;
|-&lt;br /&gt;
|0F||W||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|10||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Animation speed.&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 54}}||Triggers for callback 25&lt;br /&gt;
|-&lt;br /&gt;
|12||B||{{ottdp|0.6|2.5|ttdprev=beta 2}}||Special flags&lt;br /&gt;
|-&lt;br /&gt;
|13||V||{{ottdp|1.9|no|ottdrev=e66cec8f}}||Tile acceptance list&lt;br /&gt;
|-&lt;br /&gt;
|14||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute tile type (08) ===&lt;br /&gt;
&lt;br /&gt;
This tile type will be used instead of your new one if your definition isn&#039;t available for any reason. Valid values are [http://marcin.ttdpatch.net/sv1codec/TTD-locations.html#Class8 00h-AEh]. Assigning this property copies the properties of the old type just like it does with houses.&lt;br /&gt;
&lt;br /&gt;
If this tile&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Industry tile override (09) ===&lt;br /&gt;
&lt;br /&gt;
Works like the house override property for houses.&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance (0A, 0B, 0C) ===&lt;br /&gt;
&lt;br /&gt;
These three words define what cargoes the tile accepts, and how much of them. The low byte defines the type of the cargo according to the current climate, while the high byte defines the degree of acceptance in 1/8 units. If you don&#039;t need all three cargo types, just zero out the high byte of the extra properties.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|7}} From GRF version 7 and above, the meaning of the low byte changes: instead of a climate-dependent cargo slot number, you have to give a climate-independent cargo ID. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it&#039;s the cargo bit. Acceptance of cargoes not currently present will automatically be disabled.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} These properties only support three cargos. Use property 13 instead to list more cargo types. &lt;br /&gt;
&lt;br /&gt;
=== Land shape flags (0D) ===&lt;br /&gt;
&lt;br /&gt;
This property defines which slopes the tile can be built on.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||NW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||NE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||SW edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||SE edge cannot be lowered&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5}}||Can only be built on flat land&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||The tile is allowed on both land and water&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Industry tiles are never built on steep slopes unless [[Callbacks#Custom shape check (2F) |callback 2F]] is enabled, but bits 0..4 are ignored in that case.&lt;br /&gt;
&lt;br /&gt;
Bit 5 can be used to allow tiles of land industries built on water or vice versa. It effectively disables the land/water check code for the tile. If you need to customize the behavior further, you can use [[Callbacks#Custom shape check (2F) |callback 2F]] to decide what kind of water/land is allowed.&lt;br /&gt;
&lt;br /&gt;
;&#039;&#039;&#039;PLEASE NOTE&#039;&#039;&#039;: Be careful when setting this property. If you fail to set it correctly, your industry may end up building on a hillside, which is probably not what you want. The easiest way is to set bit 4 for middle tiles, bit 0 for the tiles along the SE edge, bit 1 for those along the SW edge and so on.&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (0E) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!value!!version!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp| | }}||use [[Callbacks#Next animation frame (1A/26/141/153/158) |callback 26]] to decide the next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp| | }}||use [[Callbacks#Length of animation frame (20/27/142/154/15A) |callback 27]] to decide animation speed&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Decide cargo acceptance (2B) |callback 2B]] to decide amount of acceptance&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp| |2.5|ttdprev=alpha 55 vcs 3}}||use [[Callbacks#Get accepted cargo types (2A/2C) |callback 2C]] to decide accepted types&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp| | }}||use [[Callbacks#Custom shape check (2F) |callback 2F]] to check if a slope is suitable&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp| | }}||use [[Callbacks#Decide drawing default foundations (30/14E/150) |callback 30]] to decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp| |2.5|ttdprev=beta 3}}||use [[Callbacks#Disable autosloping (3C/14F/15D) |callback 3C]] to allow or deny autosloping below the tile&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please note that [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] doesn&#039;t have a bit here. To use [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]], simply set the wanted bits in property 11 and it will work as intended.&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0F) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this tile (this is the default value).&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (10) ===&lt;br /&gt;
&lt;br /&gt;
The meaning is the same as for house property 1B, but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Triggers for [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] (11) ===&lt;br /&gt;
&lt;br /&gt;
Call [[Callbacks#Animation control (1B/25/140/152/159) |callback 25]] when:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning||Trigger area||Var 18&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||all ||the construction state changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time. For the first call to happen, you also have to set [[Action0/Industry_Tiles#Animation_information_.280F.29|property 0F]] to some other value than 0xFFFF.&amp;lt;/ref&amp;gt;||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||the tile is processed in the periodic processing loop||&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||the industry of the tile is processed in the periodic processing loop (synchronized animation)||&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||the industry of the tile receives input cargo from a station||&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5|ttdprev=beta 2}}||the industry distributes its output cargo to one of the stations nearby||&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently no trigger provides additional information in var 18.&lt;br /&gt;
&lt;br /&gt;
=== Special flags (12) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||[[Callbacks#Next animation frame (1A/26/141/153/158) |Callback 26]] needs random bits&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.9|no|ottdrev=e66cec8f}} In addition to the cargotypes set by property 0A..0C and 13, the tile accepts all cargotypes which the industry accepts.&lt;br /&gt;
* This considers industry properties 11 and 26 and callback 14B.&lt;br /&gt;
* This does not consider industry callback 3D.&lt;br /&gt;
* This property adds 8/8 acceptance for the matching cargotypes. You can list negative acceptances (-8/8) in property 13 to exclude specific cargos.&lt;br /&gt;
* Tile callback 2C overrides all acceptances including those added by this flag.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance list (13) ===&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=e66cec8f}} &lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
 &amp;lt;numinput&amp;gt; (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;)*&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Variable!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||numinput||Number of (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;) pairs to follow,&lt;br /&gt;
|-&lt;br /&gt;
|B||cargotype||Cargotype (from CTT) to accept.&lt;br /&gt;
|-&lt;br /&gt;
|B||acceptance||Acceptance in 1/8 units. May be negative to negate property 12 bit 1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property defines up to 16 cargotypes, which are accepted by the industry tile.&lt;br /&gt;
Use this property instead of property 0A..0C.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5004</id>
		<title>Callback: Animation control</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5004"/>
		<updated>2025-04-23T16:04:11Z</updated>

		<summary type="html">&lt;p&gt;Frosch: house construction stage trigger&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Animation control (1B/1C/25/140/148/152/159) ==&lt;br /&gt;
&lt;br /&gt;
These callbacks are called, when an animation trigger happens.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Callback!!Feature!!Mask property!!Trigger!!Variable 10!!Variable 18&lt;br /&gt;
|-&lt;br /&gt;
|1B||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 2]]&lt;br /&gt;
|[[Action0/Houses#Periodic_refresh_multiplier_.2816.29|Periodic, see property 16]] &amp;lt;ref&amp;gt;For multi-tile houses [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] controls, whether the trigger is synchronised across all house tiles. See details there.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] is set.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|1C||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 3]]&lt;br /&gt;
|[[VariationalAction2/Houses#Construction_stage_and_pseudo-random_values_.2840.29|Construction stage]] changes &amp;lt;ref&amp;gt;During normal gameplay called 4 times per tile. During map generation called 1 time. For the first call to happen, you also have to set [[Action0/Houses#Building_flags_.2809.29|property 9 bit 5]].&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|25||Industry tiles&lt;br /&gt;
|[[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot;&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if the trigger applies to multiple tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|See [[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|140||Stations, road stops&lt;br /&gt;
|[[Action0/Stations#Animation_triggers_.2818.29|Station property 18]], [[Action0/Road_Stops#Animation_triggers_.2810.29|road stop property 10]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot; /&amp;gt;&lt;br /&gt;
|See [[Action0/Stations#Animation_triggers_.2818.29|station property 18]]&lt;br /&gt;
|-&lt;br /&gt;
|148||Houses&lt;br /&gt;
|[[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|Property 1E]]&lt;br /&gt;
|Watched cargo accepted &amp;lt;ref&amp;gt;Due to implementation details, up to 250 game ticks can pass between the actual acceptance and triggering this callback.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|See [[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|property 1E]]&lt;br /&gt;
|-&lt;br /&gt;
|154||Airport tiles&lt;br /&gt;
|[[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits&lt;br /&gt;
|See [[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|159||Objects&lt;br /&gt;
|[[Action0/Objects#Animation_triggers_.2813.29|Property 13]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits&lt;br /&gt;
|See [[Action0/Objects#Animation_triggers_.2813.29|property 13]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The return value has the format SSFF:&lt;br /&gt;
* FF: One of the following values:&lt;br /&gt;
: {| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00 - FC||Jump to this animation frame.&lt;br /&gt;
|-&lt;br /&gt;
|FD||leave the animation in its current state (do nothing)&lt;br /&gt;
|-&lt;br /&gt;
|FE||start animation with its current frame&lt;br /&gt;
|-&lt;br /&gt;
|FF||stop animation in its current frame&lt;br /&gt;
|}&lt;br /&gt;
* SS: Sound effect: If non-zero, the sound effect number to play at the tile.&lt;br /&gt;
&lt;br /&gt;
Note: Every time the animation frame is changed the map tile will be refreshed, even if the selected graphics stay the same. Therefore using the animation frame as a timer should be avoided, and animation triggers should be preferred instead.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callbacks&amp;diff=5003</id>
		<title>Callbacks</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callbacks&amp;diff=5003"/>
		<updated>2025-04-23T15:49:58Z</updated>

		<summary type="html">&lt;p&gt;Frosch: dead links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
A callback is a special action 2 that the patch &amp;quot;calls&amp;quot; in order to modify various features, an example being the visual effect of train vehicles. &amp;amp;nbsp;See the [[ttwiki:CallbacksTut|callback tutorial]] on how to use them.&lt;br /&gt;
&lt;br /&gt;
In the final action 2 of a chain of VarAction2s, the second byte of the matching entry has to have bit 7 set to identify it as a callback result.&lt;br /&gt;
&lt;br /&gt;
For example, 04 00 is not a callback result (but it may be the ID of another chained action 2), whereas 04 80 is a callback result with a value of 4. In total a callback has 15 bit result values, where the upper 7 bits are stored in the second byte. For example, 54 C2 is a callback result with a value of 4254=16980, where again the second byte has bit 7 set, changing the 42 into C2.&lt;br /&gt;
&lt;br /&gt;
{{grfTill|7}} For GRF version 7 and below not all 15 bit values are available as return values, only values between 00 and 7EFF.&lt;br /&gt;
For compatibility with earlier patch versions, FF in the high byte is taken to mean the same thing as 80, so 04 FF also has a callback result of 4. Note that if your grf file needs to be compatible with versions before TTDPatch 2.0.1 alpha 40, you must set the high byte to FF, and so can use only 8 bit results.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|8}} For GRF version 8 and above this compatibility layer has been removed. Callbacks can return all 15 bit values between 00 and 7FFF.&lt;br /&gt;
&lt;br /&gt;
To check for a specific callback, use an [[VariationalAction2]] or [[VarAction2Advanced]] to check for variable 0C.&lt;br /&gt;
* Variable 0C contains the callback number.&lt;br /&gt;
* Variable 0C is a word, thus the VarAction2 must use type 85.&lt;br /&gt;
* Results can be specified directly using 8xxx values (see above), or with 8xxx value in subsequent (Basic/Variational/Random)Action2 which are referenced as usual with their set-id.&lt;br /&gt;
* The default case of the VarAction2 must point to the regular graphics chain, so that unknown/future callbacks results in a &amp;quot;callback failure&amp;quot; result.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;lt;Sprite-number&amp;gt; * &amp;lt;Length&amp;gt; 02 &amp;lt;feature&amp;gt; &amp;lt;set-id&amp;gt; 85 0C 00 \wxFFFF&lt;br /&gt;
                               &amp;lt;nvar&amp;gt; (&amp;lt;set-id/result&amp;gt; \wx &amp;lt;callback&amp;gt; \wx &amp;lt;callback&amp;gt;){n}&lt;br /&gt;
                                       &amp;lt;set-id of graphics chain&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The format for VarAction2 is explained in detail on the [[VariationalAction2]] page.&lt;br /&gt;
&lt;br /&gt;
== List of callbacks ==&lt;br /&gt;
&lt;br /&gt;
The following callbacks are defined by the patch. &amp;amp;nbsp;The number of the callback is what will be stored in variable 0C so that you can return the right results if you have several callbacks. &amp;amp;nbsp;All callbacks are explained in more detail below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PLEASE NOTE:&#039;&#039;&#039; Since TTDPatch 2.5 beta 5, the size of variable 0C has changed, and now there are word-sized callback numbers as well. To maintain backwards compatibility, only callbacks 10..3F can be checked using a byte-sized check. Callbacks 140 and above, on the other hand, must be checked using a word or dword sized check, to make sure they are identified uniquely.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Feature(s)!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|10||Vehicles||[[Callback: Visual effect and wagon power|Visual effect and wagon power]]&lt;br /&gt;
|-&lt;br /&gt;
|11||Vehicles||[[Callback: Wagon length|Wagon length]]&lt;br /&gt;
|-&lt;br /&gt;
|12||Vehicles||[[Callback: Load amount|Load amount]]&lt;br /&gt;
|-&lt;br /&gt;
|13||Stations/Roadstops||[[Callback: Station availability|Station availability]]&lt;br /&gt;
|-&lt;br /&gt;
|14||Stations||[[Callback: Station sprite layout|Select sprite layout]]&lt;br /&gt;
|-&lt;br /&gt;
|15||Vehicles||[[Callback: Refitted capacity callback|Refitted capacity callback]]&lt;br /&gt;
|-&lt;br /&gt;
|16||Trains||[[Callback: Articulated engine|Build articulated engines]]&lt;br /&gt;
|-&lt;br /&gt;
|17||Houses||[[Callback: House construction check|House construction check]]&lt;br /&gt;
|-&lt;br /&gt;
|18||Several &amp;lt;ref name=&amp;quot;generic&amp;quot;&amp;gt;Generic callbacks are called for the feature, not any specific vehicle ID. Read the [[Action3#n-id|Action 3]] entry on how to define these.&amp;lt;/ref&amp;gt;||[[Callback: AI construction/purchase selection|AI construction/purchase selection]]&lt;br /&gt;
|-&lt;br /&gt;
|19||Vehicles||[[Callback: Cargo Subtype Display|Cargo sub-type display]]&lt;br /&gt;
|-&lt;br /&gt;
|1A||Houses||Next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1B||Houses||Animation control&lt;br /&gt;
|-&lt;br /&gt;
|1C||Houses||Construction stage changes&lt;br /&gt;
|-&lt;br /&gt;
|1D||Trains||Can wagon be attached&lt;br /&gt;
|-&lt;br /&gt;
|1E||Houses||Decide colour of building&lt;br /&gt;
|-&lt;br /&gt;
|1F||Houses||Cargo acceptance&lt;br /&gt;
|-&lt;br /&gt;
|20||Houses||Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|21||Houses||Trigger building destruction&lt;br /&gt;
|-&lt;br /&gt;
|22||Industries||Availability&lt;br /&gt;
|-&lt;br /&gt;
|23||Vehicles||Additional text in purchase screen&lt;br /&gt;
|-&lt;br /&gt;
|24||Stations||Custom station layout&lt;br /&gt;
|-&lt;br /&gt;
|25||Industry tiles||Animation control&lt;br /&gt;
|-&lt;br /&gt;
|26||Industry tiles||Next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|27||Industry tiles||Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|28||Industries||Industry location permissibility&lt;br /&gt;
|-&lt;br /&gt;
|29||Industries||Random production change&lt;br /&gt;
|-&lt;br /&gt;
|2A||Houses||Get accepted cargo types&lt;br /&gt;
|-&lt;br /&gt;
|2B||Industry tiles||Decide cargo acceptance&lt;br /&gt;
|-&lt;br /&gt;
|2C||Industry tiles||Get accepted cargo types&lt;br /&gt;
|-&lt;br /&gt;
|2D||Vehicles||Select colour mapping for vehicle&lt;br /&gt;
|-&lt;br /&gt;
|2E||Houses||Custom cargo production&lt;br /&gt;
|-&lt;br /&gt;
|2F||Industry tiles||Custom shape check&lt;br /&gt;
|-&lt;br /&gt;
|30||Industry tiles||Decide drawing default foundations&lt;br /&gt;
|-&lt;br /&gt;
|31||Vehicles||Start/stop check&lt;br /&gt;
|-&lt;br /&gt;
|32||Vehicles||32-day callback&lt;br /&gt;
|-&lt;br /&gt;
|33||Several||Sound effect callback&lt;br /&gt;
|-&lt;br /&gt;
|34||Vehicles &amp;lt;ref name=&amp;quot;generic&amp;quot;/&amp;gt;||Autoreplace vehicle selection&lt;br /&gt;
|-&lt;br /&gt;
|35||Industries||Monthly random production change&lt;br /&gt;
|-&lt;br /&gt;
|36||Vehicles||Change vehicle Properties&lt;br /&gt;
|-&lt;br /&gt;
|37||Industries||Cargo sub-type display&lt;br /&gt;
|-&lt;br /&gt;
|38||Industries||Show additional text in fund window&lt;br /&gt;
|-&lt;br /&gt;
|39||Cargoes||Custom profit calculation&lt;br /&gt;
|-&lt;br /&gt;
|3A||Industries||Show additional text in industry window&lt;br /&gt;
|-&lt;br /&gt;
|3B||Industries||Control special effects&lt;br /&gt;
|-&lt;br /&gt;
|3C||Industry tiles||Disable autosloping&lt;br /&gt;
|-&lt;br /&gt;
|3D||Industries||Opt out of accepting cargo&lt;br /&gt;
|-&lt;br /&gt;
|40..13F|| ||--Reserved--&lt;br /&gt;
|-&lt;br /&gt;
|140||Stations/Roadstops||Animation control&lt;br /&gt;
|-&lt;br /&gt;
|141||Stations/Roadstops||Next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|142||Stations/Roadstops||Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|143||Houses||Protect building conditionally&lt;br /&gt;
|-&lt;br /&gt;
|144||Sounds &amp;lt;ref name=&amp;quot;generic&amp;quot;/&amp;gt;||{{ottdp|1.2|2.6|ottdrev=r23144|ttdprev=r821}} Ambient sound effects&lt;br /&gt;
|-&lt;br /&gt;
|145||Cargoes||Custom station rating calculation&lt;br /&gt;
|-&lt;br /&gt;
|146||New Signals &amp;lt;ref name=&amp;quot;generic&amp;quot;/&amp;gt;||New signals sprite drawing&lt;br /&gt;
|-&lt;br /&gt;
|147||Canals||Add sprite offset&lt;br /&gt;
|-&lt;br /&gt;
|148||Houses||Watched cargo accepted&lt;br /&gt;
|-&lt;br /&gt;
|149||Stations||Land slope check&lt;br /&gt;
|-&lt;br /&gt;
|14A||Industries||Decide industry color&lt;br /&gt;
|-&lt;br /&gt;
|14B||Industries||Decide input cargo types&lt;br /&gt;
|-&lt;br /&gt;
|14C||Industries||Decide output cargo types&lt;br /&gt;
|-&lt;br /&gt;
|14D||Houses||Customized building name&lt;br /&gt;
|-&lt;br /&gt;
|14E||Houses||Decide drawing default foundations&lt;br /&gt;
|-&lt;br /&gt;
|14F||Houses||Disable autosloping&lt;br /&gt;
|-&lt;br /&gt;
|150||Airport tiles||{{ottdp|1.1|no|ottdrev=r19197}} Decide drawing default foundations&lt;br /&gt;
|-&lt;br /&gt;
|152||Airport tiles||{{ottdp|1.1|no|ottdrev=r19197}} Animation control&lt;br /&gt;
|-&lt;br /&gt;
|153||Airport tiles||{{ottdp|1.1|no|ottdrev=r19197}} Next Animation frame&lt;br /&gt;
|-&lt;br /&gt;
|154||Airport tiles||{{ottdp|1.1|no|ottdrev=r19197}} Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|155||Airports||{{ottdp|1.1|no|ottdrev=r20373}} Extra information about airport layout in the build gui&lt;br /&gt;
|-&lt;br /&gt;
|156||Airports||{{ottdp|1.1|no|ottdrev=r20373}} Airport layout name&lt;br /&gt;
|-&lt;br /&gt;
|157||Objects||Land slope check&lt;br /&gt;
|-&lt;br /&gt;
|158||Objects||Next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|159||Objects||Animation control&lt;br /&gt;
|-&lt;br /&gt;
|15A||Objects||Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|15B||Objects||Decide colour of building&lt;br /&gt;
|-&lt;br /&gt;
|15C||Objects||Show additional text in building window&lt;br /&gt;
|-&lt;br /&gt;
|15D||Objects||Disable autosloping&lt;br /&gt;
|-&lt;br /&gt;
|15E||Vehicles||{{ottdp|1.2|no|ottdrev=r23124}} Refit cost factor&lt;br /&gt;
|-&lt;br /&gt;
|15F||Industries||{{ottdp|1.3|no|ottdrev=r24186}} Set initial production level on construction&lt;br /&gt;
|-&lt;br /&gt;
|160||Vehicles||{{ottdp|1.5|no|ottdrev=r26747}} Advanced effect creation&lt;br /&gt;
|-&lt;br /&gt;
|161||Vehicles||{{ottdp|14|no|ottdrev=g05ed9f56fd}} Engine name&lt;br /&gt;
|-&lt;br /&gt;
|162||Vehicles||{{ottdp|14|no|ottdrev=gddd609ce9b}} Probability of reversing rail vehicle on build&lt;br /&gt;
|-&lt;br /&gt;
|163||Vehicles||{{ottdp|15|no|ottdrev=gd2496b6ec4}} Custom refit&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Callback: Visual effect and wagon power}}&lt;br /&gt;
{{:Callback: Wagon length}}&lt;br /&gt;
{{:Callback: Load amount}}&lt;br /&gt;
{{:Callback: Station availability}}&lt;br /&gt;
{{:Callback: Station sprite layout}}&lt;br /&gt;
{{:Callback: Refitted capacity callback}}&lt;br /&gt;
{{:Callback: Articulated engine}}&lt;br /&gt;
{{:Callback: House construction check}}&lt;br /&gt;
{{:Callback: AI construction/purchase selection}}&lt;br /&gt;
{{:Callback: Cargo Subtype Display}}&lt;br /&gt;
{{:Callback: Next animation frame}}&lt;br /&gt;
{{:Callback: Animation control}}&lt;br /&gt;
{{:Callback: Can wagon be attached}}&lt;br /&gt;
{{:Callback: Building colour}}&lt;br /&gt;
{{:Callback: Cargo acceptance}}&lt;br /&gt;
{{:Callback: Length of animation frame}}&lt;br /&gt;
{{:Callback: Trigger building destruction}}&lt;br /&gt;
{{:Callback: Industry availability}}&lt;br /&gt;
{{:Callback: Additional text in purchase screen}}&lt;br /&gt;
{{:Callback: Custom station layout}}&lt;br /&gt;
{{:Callback: Industry location permissibility}}&lt;br /&gt;
{{:Callback: Random production change}}&lt;br /&gt;
{{:Callback: Get accepted cargo types}}&lt;br /&gt;
{{:Callback: Decide cargo acceptance}}&lt;br /&gt;
{{:Callback: Select colour mapping for vehicle}}&lt;br /&gt;
{{:Callback: Custom cargo production}}&lt;br /&gt;
{{:Callback: Custom shape check}}&lt;br /&gt;
{{:Callback: Decide drawing default foundations}}&lt;br /&gt;
{{:Callback: Vehicle Start/stop check}}&lt;br /&gt;
{{:Callback: 32-day callback}}&lt;br /&gt;
{{:Callback: Sound effect}}&lt;br /&gt;
{{:Callback: Autoreplace vehicle selection}}&lt;br /&gt;
{{:Callback: Monthly random production change}}&lt;br /&gt;
{{:Callback: Change vehicle properties}}&lt;br /&gt;
{{:Callback: Cargo sub-type display for industries}}&lt;br /&gt;
{{:Callback: Show additional text in fund/building window}}&lt;br /&gt;
{{:Callback: Custom profit calculation for cargoes}}&lt;br /&gt;
{{:Callback: Show additional text in industry window}}&lt;br /&gt;
{{:Callback: Control special industry effects}}&lt;br /&gt;
{{:Callback: Disable autosloping}}&lt;br /&gt;
{{:Callback: Opt out of accepting cargo}}&lt;br /&gt;
{{:Callback: Protect building conditionally}}&lt;br /&gt;
{{:Callback: Ambient sound effects}}&lt;br /&gt;
{{:Callback: Custom station rating calculation}}&lt;br /&gt;
{{:Callback: New signals sprite drawing callback}}&lt;br /&gt;
{{:Callback: Add sprite offset callback}}&lt;br /&gt;
{{:Callback: Station slope check}}&lt;br /&gt;
{{:Callback: Decide industry colour}}&lt;br /&gt;
{{:Callback: Decide input and output cargo types}}&lt;br /&gt;
{{:Callback: Customized building name}}&lt;br /&gt;
{{:Callback: Extra information about layout in the build gui}}&lt;br /&gt;
{{:Callback: Layout name}}&lt;br /&gt;
{{:Callback: Object slope check}}&lt;br /&gt;
{{:Callback: Decide object colour}}&lt;br /&gt;
{{:Callback: Refit cost factor}}&lt;br /&gt;
{{:Callback: Set initial production level on construction}}&lt;br /&gt;
{{:Callback: Advanced effect creation}}&lt;br /&gt;
{{:Callback: Engine name}}&lt;br /&gt;
{{:Callback: Build probability}}&lt;br /&gt;
{{:Callback: Custom refit}}&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5002</id>
		<title>Callback: Animation control</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=5002"/>
		<updated>2025-04-23T15:45:39Z</updated>

		<summary type="html">&lt;p&gt;Frosch: reshuffle paragraphs into table&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Animation control (1B/1C/25/140/148/152/159) ==&lt;br /&gt;
&lt;br /&gt;
These callbacks are called, when an animation trigger happens.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Callback!!Feature!!Mask property!!Trigger!!Variable 10!!Variable 18&lt;br /&gt;
|-&lt;br /&gt;
|1B||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 2]]&lt;br /&gt;
|[[Action0/Houses#Periodic_refresh_multiplier_.2816.29|Periodic, see property 16]] &amp;lt;ref&amp;gt;For multi-tile houses [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] controls, whether the trigger is synchronised across all house tiles. See details there.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if [[Action0/Houses#Extra_Flags_.2819.29|property 19 bit 2]] is set.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|1C||Houses&lt;br /&gt;
|[[Action0/Houses#House_callback_flags_.2814.2C1D.29|Property 14 bit 3]]&lt;br /&gt;
|[[VariationalAction2/Houses#Construction_stage_and_pseudo-random_values_.2840.29|Construction stage]] changes &amp;lt;ref&amp;gt;Called during normal gameplay (3 times per tile), not during map generation.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|-&lt;br /&gt;
|25||Industry tiles&lt;br /&gt;
|[[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot;&amp;gt;Lower 16 bits are random per tile. Upper 16 bits are the same for all tiles, if the trigger applies to multiple tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|See [[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|140||Stations, road stops&lt;br /&gt;
|[[Action0/Stations#Animation_triggers_.2818.29|Station property 18]], [[Action0/Road_Stops#Animation_triggers_.2810.29|road stop property 10]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|{{ottdp| |2.5|ttdprev=beta 2}} Random bits &amp;lt;ref name=&amp;quot;randombits&amp;quot; /&amp;gt;&lt;br /&gt;
|See [[Action0/Stations#Animation_triggers_.2818.29|station property 18]]&lt;br /&gt;
|-&lt;br /&gt;
|148||Houses&lt;br /&gt;
|[[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|Property 1E]]&lt;br /&gt;
|Watched cargo accepted &amp;lt;ref&amp;gt;Due to implementation details, up to 250 game ticks can pass between the actual acceptance and triggering this callback.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|Reserved for future use&lt;br /&gt;
|See [[Action0/Houses#Cargo_acceptance_watch_list_.2820.29|property 1E]]&lt;br /&gt;
|-&lt;br /&gt;
|154||Airport tiles&lt;br /&gt;
|[[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|Property 11]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits&lt;br /&gt;
|See [[Action0/Airport_Tiles#Animation_triggers_via_callback_152_.2811.29|property 11]]&lt;br /&gt;
|-&lt;br /&gt;
|159||Objects&lt;br /&gt;
|[[Action0/Objects#Animation_triggers_.2813.29|Property 13]]&lt;br /&gt;
|All triggers, see variable 18&lt;br /&gt;
|Random bits&lt;br /&gt;
|See [[Action0/Objects#Animation_triggers_.2813.29|property 13]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The return value has the format SSFF:&lt;br /&gt;
* FF: One of the following values:&lt;br /&gt;
: {| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|00 - FC||Jump to this animation frame.&lt;br /&gt;
|-&lt;br /&gt;
|FD||leave the animation in its current state (do nothing)&lt;br /&gt;
|-&lt;br /&gt;
|FE||start animation with its current frame&lt;br /&gt;
|-&lt;br /&gt;
|FF||stop animation in its current frame&lt;br /&gt;
|}&lt;br /&gt;
* SS: Sound effect: If non-zero, the sound effect number to play at the tile.&lt;br /&gt;
&lt;br /&gt;
Note: Every time the animation frame is changed the map tile will be refreshed, even if the selected graphics stay the same. Therefore using the animation frame as a timer should be avoided, and animation triggers should be preferred instead.&lt;br /&gt;
&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Houses&amp;diff=5001</id>
		<title>Action0/Houses</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Houses&amp;diff=5001"/>
		<updated>2025-04-23T15:24:28Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Cargo acceptance watch list (20) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
For town buildings (or simply houses), the offset defines the first house ID for this action 0. House IDs, like station IDs, are unique within each grf file, and in total each game can only have 255 IDs in TTDPatch and 512 IDs in OpenTTD for all active grf files. &lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Since OpenTTD 15, the limits are increased to 4096 IDs, both per-grf and in total.&lt;br /&gt;
&lt;br /&gt;
To start using a house ID, you must first define it by setting its property 08 (see below). If you try to modify a house ID whose property 08 isn&#039;t set, your request is ignored, but not reported as an error, either.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Substitute building type&lt;br /&gt;
|-&lt;br /&gt;
|09||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Building flags&lt;br /&gt;
|-&lt;br /&gt;
|0A||W||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Availability years&lt;br /&gt;
|-&lt;br /&gt;
|0B||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Population&lt;br /&gt;
|-&lt;br /&gt;
|0C||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Mail generation multiplier&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Passenger acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0E||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Mail acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0F||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Goods, food or fizzy drinks acceptance&lt;br /&gt;
|-&lt;br /&gt;
|10||W||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||LA rating decrease on removal (should be set to the same value for every tile for multi-tile buildings)&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Removal cost multiplier (should be set to the same value for every tile for multi-tile buildings)&lt;br /&gt;
|-&lt;br /&gt;
|12||W||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Building name ID&lt;br /&gt;
|-&lt;br /&gt;
|13||W||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Building availability mask&lt;br /&gt;
|-&lt;br /&gt;
|14||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||House callback flags&lt;br /&gt;
|-&lt;br /&gt;
|15||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||House override byte&lt;br /&gt;
|-&lt;br /&gt;
|16||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Periodic refresh multiplier&lt;br /&gt;
|-&lt;br /&gt;
|17||4*B||{{ottdp|0.6|2.5|ttdprev=alpha 35}}||Four random colours to use&lt;br /&gt;
|-&lt;br /&gt;
|18||B||{{ottdp|0.6|2.5|ttdprev=alpha 35}}||Relative probability of appearing&lt;br /&gt;
|-&lt;br /&gt;
|19||B||{{ottdp|0.6|2.5|ttdprev=alpha 38}}||Extra flags&lt;br /&gt;
|-&lt;br /&gt;
|1A||B||{{ottdp|0.6|2.5|ttdprev=alpha 39}}||Animation frames&lt;br /&gt;
|-&lt;br /&gt;
|1B||B||{{ottdp|0.6|2.5|ttdprev=alpha 39}}||Animation speed&lt;br /&gt;
|-&lt;br /&gt;
|1C||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Class of the building type&lt;br /&gt;
|-&lt;br /&gt;
|1D||B||{{ottdp|0.6|2.5|ttdprev=alpha 55 vcs 2}}||Callback flags 2&lt;br /&gt;
|-&lt;br /&gt;
|1E||D||{{ottdp|0.6|2.5|ttdprev=alpha 55 vcs 2}}||Accepted cargo types&lt;br /&gt;
|-&lt;br /&gt;
|1F||B||{{ottdp|0.6|2.6|ttdprev=r1554}}||Minimum life span in years&lt;br /&gt;
|-&lt;br /&gt;
|20||V||{{ottdp|1.2|2.6|ottdrev=r23072|ttdprev=r1677}}||Cargo acceptance watch list&lt;br /&gt;
|-&lt;br /&gt;
|21||W||{{ottdp|0.7|no|ottdrev=r13437}}||Long year (zero based) of minimum appearance&lt;br /&gt;
|-&lt;br /&gt;
|22||W||{{ottdp|0.7|no|ottdrev=r13437}}||Long year (zero based) of maximum appearance&lt;br /&gt;
|-&lt;br /&gt;
|23||V||{{ottdp|1.9|no|ottdrev=48b334cf}}||Tile acceptance list &lt;br /&gt;
|-&lt;br /&gt;
|24||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When a town decides to expand, each active house type (both old and new ones) has a uniform probability to appear, so the more new houses you define, the fewer old TTD buildings will appear.&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute building type (08) ===&lt;br /&gt;
&lt;br /&gt;
This building type will be used instead of your new one if your definition isn&#039;t available for any reason (the grf file is not found, for example).&lt;br /&gt;
&lt;br /&gt;
Don&#039;t set a substitute building type that is larger than your new one (for example, don&#039;t set 14 (stadium) for an 1x1 building) because this may corrupt savegames. Setting this property automatically copies every property of the substitute building to your new building, so you don&#039;t have to change properties that are the same as the substitute.&lt;br /&gt;
&lt;br /&gt;
House flags 40 and 80 are exceptions; these flags are never set automatically. Only the first property 08 setting copies properties; if you later change it, properties will stay.&lt;br /&gt;
&lt;br /&gt;
There&#039;s a special use of this property beginning from alpha 72: if you set it to FFh, you can disable an old house type. In this case, the ID used must be the number of old house type you want to disable. Disabling only prevents building the type in towns; houses already present on the map will stay unchanged. The type can still be overridden, and overriding affects houses present on the map.&lt;br /&gt;
&lt;br /&gt;
If this house&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Building flags (09) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||This is a 1x1 building&lt;br /&gt;
|-&lt;br /&gt;
|1||2||This building can be built only on flat land (if clear, foundations are automatically displayed on sloped land)&lt;br /&gt;
|-&lt;br /&gt;
|2||4||This is a 2x1 building&amp;lt;ref name=&amp;quot;large&amp;quot;&amp;gt;If your building isn&#039;t 1x1, set flags for the north tile, then define the next 1 or 3 tiles tiles (by setting their property 8). The only bit that can be set in the flags of additional tiles is bit 5 (animation). There should be no property 8 setting between the first tile and the additional tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||This is a 1x2 building&amp;lt;ref name=&amp;quot;large&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|4||10||This is a 2x2 building&amp;lt;ref name=&amp;quot;large&amp;quot; /&amp;gt;&amp;lt;ref&amp;gt;For 2x2 buildings, the first additional tile is the east one, the second is the west part and the third is the south part. You probably want to set the substitute for additional tiles to a TTD additional tile whose flags are already zero. 2x2 buildings are always built on flat land no matter how bit 1 is set.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|5||20||Animation flag, set in tiles 04 and 05 (large office block). New buildings have a different animation scheme than large office blocks, but animation is still enabled with this bit.&amp;lt;ref&amp;gt;The animation flag works on a per-tile basis, so you should enable it for additional tiles of multi-tile buildings as well if you want all tiles to be animated.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|6||40||This building is a church&amp;lt;ref name=&amp;quot;only1&amp;quot;&amp;gt;Only one church and one stadium can exist in a town. The town won&#039;t build buildings with the according flag set until the old church/stadium is removed. (This can be done by either the town or a player)&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|7||80||This building is a stadium&amp;lt;ref name=&amp;quot;only1&amp;quot; /&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Availability years (0A) ===&lt;br /&gt;
&lt;br /&gt;
The low byte is the minimum year, the high is the maximum. The building can only be built between these two years (inclusive). 1920 is added to both bytes before using the values.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|no| }}&lt;br /&gt;
Since the year counting stops in TTDPatch in 2070 even with [[ttwiki:EternalGame|EternalGame]] on, start years above 150 mean &amp;quot;never&amp;quot;, and end years above 150 mean &amp;quot;forever&amp;quot;. In OpenTTD there is no limit for the maximum year (resp. it is 5000000).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING:&#039;&#039;&#039; Don&#039;t set the start year below 1930 (0Ah) unless you know what you&#039;re doing!&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} If TTDPatch finds a building that is available before 1930, it will not build old building types until that year, so you have to provide at least one custom building type that is available before 1930 for every [[TownZones|town zone]], or TTD may deadlock while trying to create a random game or expand a town.&lt;br /&gt;
&lt;br /&gt;
{{ottd|}} The availability of all active houses with the lowest availability year is set to start from year 0, so that always at least one house is available irrespective of starting year. Thus, if you de-activate default houses or set an introduction date prior to the default houses introduction year 1930, you should have at least for each [[TownZones|town zone]] a house with the same earliest availability year or you might end up with a situation where no house can be placed in a [[TownZones|town zone]].&lt;br /&gt;
&lt;br /&gt;
=== Population (0B) and Mail generation multiplier (0C) ===&lt;br /&gt;
[[Image:House_production.png|frame|right|Actual house production roughly depends on squared value of the population / mail generation multiplier.]]&lt;br /&gt;
&lt;br /&gt;
The population of the town will be increased by the amount set in prop. 0B if this building is built. Additional house parts should have a population of zero. The higher this value is, the more passengers this building generates.&lt;br /&gt;
&lt;br /&gt;
The higher the mail generation multiplier is, the more mail the building generates. For multi-tile buildings, mail generation is done in per-tile basis, so you can specify different values for every tile, although distributing the generation equally between tiles is suggested.&lt;br /&gt;
&lt;br /&gt;
This is how exactly passengers are generated: In each periodic processing (i.e. every 256 ticks), a random value 0&amp;lt;=X&amp;lt;=255 is generated for each house tile. If X isn&#039;t smaller than the population of the tile, no passengers are generated. Otherwise, X/8+1 passengers are generated (rounded down). If there is a recession going on, the number of generated passengers is halved, but this division gets rounded up instead of down. Mail generation happens in a similar manner, but with a new random value, and checking against the mail generation multiplier instead of the population.&lt;br /&gt;
&lt;br /&gt;
You can further customize how the cargo is generated with the [[Callbacks#Custom_cargo_production_.282E.29 |callback 2E]].&amp;lt;br style=&amp;quot;clear:both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Passenger (0D), Mail (0E) and Good/Food/Fizzy drinks (0F) acceptance ===&lt;br /&gt;
&lt;br /&gt;
The acceptance is given in units of 1/8th and must not be larger than 8 eighths.&lt;br /&gt;
&lt;br /&gt;
For property 0F, positive values indicate that the building accepts goods, and negative values (i.e. FF = 1/8th, FE = 2/8ths etc.) indicate acceptance of food or fizzy drinks, depending on the climate.&lt;br /&gt;
&lt;br /&gt;
All the above three values can be set independently for tiles of multi-tile buildings, since every tile is processed individually when determining what a station accepts.&lt;br /&gt;
&lt;br /&gt;
The type of accepted cargo can be modified using [[Action0Houses#Accepted_cargo_types|property 1E]].&lt;br /&gt;
&lt;br /&gt;
{{ottdp|no| }} Note that in TTDPatch the officefood switch may modify acceptance in the sub-arctic and subtropical climates.&lt;br /&gt;
&lt;br /&gt;
=== Building name ID (12) ===&lt;br /&gt;
&lt;br /&gt;
The ID of the text that should be displayed in the land query window. The name can also be set by [[Action4|action 4]] (see there). Should be set to the same value for every tile for multi-tile buildings.&lt;br /&gt;
&lt;br /&gt;
=== Building availability mask (13) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0..4||1,2,4,8,10||which [[VariationalAction2/Houses#Town zone (42)|town zone(s)]] the building can be built in&lt;br /&gt;
|-&lt;br /&gt;
|11||800||can appear in sub-arctic climate above the snow line&lt;br /&gt;
|-&lt;br /&gt;
|12||1000||can appear in temperate climate&lt;br /&gt;
|-&lt;br /&gt;
|13||2000||can appear in sub-arctic climate below the snow line&lt;br /&gt;
|-&lt;br /&gt;
|14||4000||can appear in subtropical climate&lt;br /&gt;
|-&lt;br /&gt;
|15||8000||can appear in toyland climate&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property should be set to zero for additional building tiles.&lt;br /&gt;
&lt;br /&gt;
=== House callback flags (14,1D) ===&lt;br /&gt;
&lt;br /&gt;
For houses, the following [[callbacks]] can be defined by setting the corresponding bit in property 14:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Variable 0C value!!Version!!Callback&lt;br /&gt;
|-&lt;br /&gt;
|0||1||17||{{ottdp| | }}||decide whether the house can be built on a given tile&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1A||{{ottdp| | }}||decide the following frame of the animations&lt;br /&gt;
|-&lt;br /&gt;
|2||4||1B||{{ottdp| | }}||periodically start/stop the animation&lt;br /&gt;
|-&lt;br /&gt;
|3||8||1C||{{ottdp| | }}||change animation when construction state changes&lt;br /&gt;
|-&lt;br /&gt;
|4||10||1E||{{ottdp| | }}||decide the color of the building&lt;br /&gt;
|-&lt;br /&gt;
|5||20||1F||{{ottdp| | }}||decide the cargos amounts accepted&lt;br /&gt;
|-&lt;br /&gt;
|6||40||20||{{ottdp| | }}||decide the length of the current animation frame&lt;br /&gt;
|-&lt;br /&gt;
|7||80||21||{{ottdp| | }}||trigger destruction of building&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Property 1D was introduced after all bits of property 14 were filled. Its usage is the same, only the meaning of bits is different:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Variable 0C value!!Version!!Callback&lt;br /&gt;
|-&lt;br /&gt;
|0||1||2A||{{ottdp| | }}||decide the cargo types accepted&lt;br /&gt;
|-&lt;br /&gt;
|1||2||2E||{{ottdp| | }}||custom cargo production&lt;br /&gt;
|-&lt;br /&gt;
|2||4||143||{{ottdp| | }}||conditional protection&lt;br /&gt;
|-&lt;br /&gt;
|3||8||14E||{{ottdp|1.0|2.6|ottdrev=r17558|ttdprev=2249}}||decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|4||10||14F||{{ottdp|1.0|2.6|ottdrev=r17558|ttdprev=2249}}||allow or deny autosloping below the tile&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the variational Action2 for callbacks.&lt;br /&gt;
&lt;br /&gt;
Callback flags are ignored for additional building tiles.&lt;br /&gt;
&lt;br /&gt;
=== House override byte (15) ===&lt;br /&gt;
&lt;br /&gt;
Setting this property makes this building appear instead of the given old TTD building type. Setting the property is ignored if the given old house type is already overridden. You can set this property more than once to override more old building types.&lt;br /&gt;
&lt;br /&gt;
No new house of the overridden types will be built in towns.&lt;br /&gt;
&lt;br /&gt;
This property works in a per-tile basis, so you override tiles of old multi-tile buildings individually, although the old type will still be built if you don&#039;t override its north tile.&lt;br /&gt;
&lt;br /&gt;
=== Periodic refresh multiplier (16) ===&lt;br /&gt;
&lt;br /&gt;
This is used for random triggers, and sets how often the tile is re-randomized. When set to X, the tile will be re-randomized on every (X+1)-th periodic processing. (In other words, every (X+1)*256 game ticks.) If you want all tiles to be re-randomized, you must set this (but not necessarily to the same value) for each tile.&lt;br /&gt;
&lt;br /&gt;
If callback 1B is enabled in property 14, it is also called after re-randomizing random bits.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.1|2.5|ttdprev=2.5 beta 9}} In TTDPatch versions before TTDPatch 2.6 r1639 and TTDPatch 2.5 beta 9 (including beta 9), this variable could have any value between 0 and 255. After these versions, the upper limit has been lowered to 63. To maintain compatibility, values above 63 will be interpreted as 63.&lt;br /&gt;
&lt;br /&gt;
=== Random colours (17) ===&lt;br /&gt;
&lt;br /&gt;
This specifies four colors used for random painting (see [[Action2HousesIndustryTiles]]). Each byte of the dword defines a color, the values are the same as in Action2, except that numbering starts from zero instead of 775. If not set, this defaults to 04 08 0c 06 (red, blue, orange and green, the colors of the modern office building). Can be set to different values for tiles of multi-tile buildings.&lt;br /&gt;
&lt;br /&gt;
=== Probability (18) ===&lt;br /&gt;
&lt;br /&gt;
This sets the relative probability of this house being built. Old TTD house types have a probability of 16, and this is the default for new types as well.&lt;br /&gt;
&lt;br /&gt;
Increase (or better multiply) this value to make your building appear relatively more often, or decrease (divide) it to make it rarer. If you set this to zero, the house type never appears. The minimal useful value 1 means it&#039;s sixteen times less probable to build this type than a normal type, while the maximum setting of 255 means it&#039;s almost sixteen times more probable.&lt;br /&gt;
&lt;br /&gt;
The probability is relative since the absolute probability depends on the count and probability of other houses as well: the more types are available (and the higher their probabilities are), the less the chance is that your type will be chosen.&lt;br /&gt;
&lt;br /&gt;
=== Extra Flags (19) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||This building appears during the generation of a town, but not later, i.e. will appear in random games, but new ones won&#039;t be built during the game. Useful for buildings that are intended to be historical.&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||This building is protected, i.e. towns and AI players won&#039;t remove it. Human players can still remove it, so you may need to set a high remove cost/rating to make them think twice.&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||Synchronized [[Callbacks#Animation_control_.281B.2F25.2F140.2F152.2F159.29| callback 1B]]. (for multi-tile buildings)&amp;lt;ref&amp;gt;If synchronized callbacks are enabled, callback 1B will be called when the periodic processing reaches the main tile of the building, and not when it reaches the current tile. This is useful if your animation must run synchronously on every tile of the building. If this bit is set, callback 1B is called according to the main tile&#039;s property 16, not the current one, to make sure every tile stays in sync. This bit can also be set for a subset of the tiles of a house, and will only affect those tiles then.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5|ttdprev=beta 2}}||[[Callbacks#Next animation frame (1A/26/141/153/158) |Callback 1A]] needs random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Animation Frames (1A) ===&lt;br /&gt;
&lt;br /&gt;
The bottom seven bits define how many frames the animation consists of, minus one. (I.e. 0 means 1 frame, 1 means 2 frames etc.) The highest bit has another purpose (see below), so the biggest supported value is 7F (128 frames).&lt;br /&gt;
&lt;br /&gt;
The highest bit is set if the animation is looping, i.e. it should start again from the first frame after showing the last frame. Non-looping animations stop after the last frame, leaving it on the screen. Both kinds of animations start automatically when the building is created. It&#039;s recommended to use callback 1B with non-looping animations, so they are played multiple times.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6|2.5|ottdrev=r12347|ttdprev=r1639}} In TTDPatch versions before TTDPatch 2.6 r1639 and TTDPatch 2.5 beta 9 (including beta 9) and OpenTTD before r12347, the frame number was limited to 32. If you intend to maintain compatibility with those versions, you should not use animations longer than 32 frames.&lt;br /&gt;
&lt;br /&gt;
=== Animation Speed (1B) ===&lt;br /&gt;
&lt;br /&gt;
This is the amount of time between switching frames.&lt;br /&gt;
&lt;br /&gt;
The default value is 2, which means the switch occurs every 108 milliseconds. Increasing this value by one doubles the wait, i.e. 3 will cause 216 ms delay, while 4 will pause 432 ms, and so on. Values below 2 have the same effect as 2, so the default is the fastest possible setting. The maximum is 16, which means 1769 seconds (approx. half an hour) delay. Settings above this value may cause strange behaviour.&lt;br /&gt;
&lt;br /&gt;
=== Building Class (1C) ===&lt;br /&gt;
&lt;br /&gt;
Types that were given the same class byte are considered to be in the same class. If you don&#039;t explicitly set this value, the type is considered to have no class (it won&#039;t be considered to be class 0). The scope of a class is the current GRF file, so two types are never in the same class if they were defined by different GRF files. Currently, this property affects variable 44 only.&lt;br /&gt;
&lt;br /&gt;
This property is a per-tile one, you can set it for additional tiles as well. It&#039;s a better idea, however, to set it for the main tile only, since var. 44 counts tiles, not buildings, and you may count multi-tile multiple times otherwise.&lt;br /&gt;
&lt;br /&gt;
=== Accepted cargo types (1E) ===&lt;br /&gt;
&lt;br /&gt;
There may be cases when you want your house to accept something other than the default types (passenger, mail, goods and food). This property allows you to do that. If this property is set to FFFFFFFFh (the default), the meaning of properties 0D, 0E and 0F aren&#039;t changed, that is, they are the passenger, mail and goods/food acceptances, accordingly. If this property isn&#039;t FFFFFFFFh, the first three bytes must be climate-dependent cargo slot numbers (the fourth byte is ignored). In this case property 0D is the amount of acceptance of the first cargo type given, 0E is the same for the second type and 0F is the same for the third type.&lt;br /&gt;
&lt;br /&gt;
From GRF version 7 and above, the meaning of this property changes: instead of climate-dependent cargo slot numbers, you have to give climate-independent cargo IDs. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it&#039;s the cargo slot number. Acceptance of cargoes not currently present will automatically be disabled.&lt;br /&gt;
&lt;br /&gt;
{{ottd|15.0}} Since 15.0, a default cargo translation table corresponding to the climate is used if one is not provided.&lt;br /&gt;
&lt;br /&gt;
=== Minimum life span in years (1F) ===&lt;br /&gt;
&lt;br /&gt;
Towns are prevented from destroying the house if it hasn&#039;t yet reached the age given here. The default is 0, which means towns are free to remove the house any time they like. Please note that this setting doesn&#039;t prevent AI players from removing the house; only towns are affected. If you need to protect your building from AI players as well, you can set the &amp;quot;protected&amp;quot; flag (property 19 bit 1), or use [[Callbacks#Protect building conditionally (143) |callback 143]] and use your custom code to decide who (and when) is allowed to remove the building.&lt;br /&gt;
&lt;br /&gt;
For this to operate consequently on multi-tile buildings, you must set the same minimum lifespan for all tiles of the building.&lt;br /&gt;
&lt;br /&gt;
=== Cargo acceptance watch list (20) ===&lt;br /&gt;
&lt;br /&gt;
This property is a list of cargo types, types whose acceptance should be watched. The first byte is the length of the list, the remaining bytes identify cargo types. {{grfFrom|7}} If your GRF is version 7 or above, and has a cargo translation table, the bytes are indexes in the table; otherwise, they are cargo slot numbers.&lt;br /&gt;
&lt;br /&gt;
When a cargo from this list is accepted by the current tile (i.e. the tile is in the acceptance area of a station), [[Callbacks#Watched cargo accepted (148) |callback 148]] is called on &#039;&#039;all&#039;&#039; tiles of the building:&lt;br /&gt;
* The callback will be called for each tile of a multi-tile building whenever a tile with property 20 accepts cargo. This means if more than one tile has cargoes specified in property 20, the callback can be called multiple times on the same tile in the same tick.&lt;br /&gt;
* Variable 18 has the format RRRRYYXX&lt;br /&gt;
** YYXX: Relative position of the triggering tile to the current tile in X and Y direction. 0 if the current tile is the triggering tile, negative if the triggering tile is northward, positive if southward. With this, you can tell apart the callings within the same tick.&lt;br /&gt;
** RRRR: Random bits, same for all tiles of a multi-tile building.&lt;br /&gt;
&lt;br /&gt;
Via [[VariationalAction2/Houses#Cargo_acceptance_history_of_nearby_stations_.2864.29|Variable 64]] the triggering cargo types can be determined.&lt;br /&gt;
&lt;br /&gt;
Return values are the same as for all [[Callbacks#Animation_control_.281B.2F25.2F140.2F152.2F159.29|animation trigger callbacks]].&lt;br /&gt;
&lt;br /&gt;
Due to implementation details, up to 250 game ticks can pass between the actual acceptance and triggering this callback.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} This property has no effect if the station2 structure isn&#039;t present. The station2 structure is present if any of the following is true:&lt;br /&gt;
* Generalfixes is on, and miscmods.noextendstationrange is off&lt;br /&gt;
* Any of fifoloading, newcargos or irregularstations is on&lt;br /&gt;
&lt;br /&gt;
=== Availability years (long format) - Minimum (21) - Maximum (22) ===&lt;br /&gt;
&lt;br /&gt;
Those two properties allow to specify a range of dates (based on year zero(0) that are not limited to the 1930 dates. So earlier buildings can be introduced. Be sure to add substantial houses to the sets, if you do not wat to have uniform towns, since the current earliest houses will remain in their current 1920 era. Mind also the warning wrt. introduction years as described at property 0A.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15|no}} A value of FFFF is treated as the game&#039;s MAX_YEAR instead of a literal year 65535.&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance list (23) ===&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=48b334cf}} &lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
 &amp;lt;numinput&amp;gt; (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;)*&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Variable!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||numinput||Number of (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;) pairs to follow,&lt;br /&gt;
|-&lt;br /&gt;
|B||cargotype||Cargotype (from CTT) to accept.&lt;br /&gt;
|-&lt;br /&gt;
|B||acceptance||Acceptance in 1/8 units.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property defines up to 16 cargotypes, which are accepted by the house.&lt;br /&gt;
Use this property instead of property 0D..0F.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Houses&amp;diff=4988</id>
		<title>Action0/Houses</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Houses&amp;diff=4988"/>
		<updated>2025-04-16T13:42:17Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Extra Flags (19) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
For town buildings (or simply houses), the offset defines the first house ID for this action 0. House IDs, like station IDs, are unique within each grf file, and in total each game can only have 255 IDs in TTDPatch and 512 IDs in OpenTTD for all active grf files. &lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Since OpenTTD 15, the limits are increased to 4096 IDs, both per-grf and in total.&lt;br /&gt;
&lt;br /&gt;
To start using a house ID, you must first define it by setting its property 08 (see below). If you try to modify a house ID whose property 08 isn&#039;t set, your request is ignored, but not reported as an error, either.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Substitute building type&lt;br /&gt;
|-&lt;br /&gt;
|09||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Building flags&lt;br /&gt;
|-&lt;br /&gt;
|0A||W||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Availability years&lt;br /&gt;
|-&lt;br /&gt;
|0B||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Population&lt;br /&gt;
|-&lt;br /&gt;
|0C||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Mail generation multiplier&lt;br /&gt;
|-&lt;br /&gt;
|0D||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Passenger acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0E||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Mail acceptance&lt;br /&gt;
|-&lt;br /&gt;
|0F||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Goods, food or fizzy drinks acceptance&lt;br /&gt;
|-&lt;br /&gt;
|10||W||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||LA rating decrease on removal (should be set to the same value for every tile for multi-tile buildings)&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Removal cost multiplier (should be set to the same value for every tile for multi-tile buildings)&lt;br /&gt;
|-&lt;br /&gt;
|12||W||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Building name ID&lt;br /&gt;
|-&lt;br /&gt;
|13||W||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Building availability mask&lt;br /&gt;
|-&lt;br /&gt;
|14||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||House callback flags&lt;br /&gt;
|-&lt;br /&gt;
|15||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||House override byte&lt;br /&gt;
|-&lt;br /&gt;
|16||B||{{ottdp|0.6|2.5|ttdprev=alpha 34}}||Periodic refresh multiplier&lt;br /&gt;
|-&lt;br /&gt;
|17||4*B||{{ottdp|0.6|2.5|ttdprev=alpha 35}}||Four random colours to use&lt;br /&gt;
|-&lt;br /&gt;
|18||B||{{ottdp|0.6|2.5|ttdprev=alpha 35}}||Relative probability of appearing&lt;br /&gt;
|-&lt;br /&gt;
|19||B||{{ottdp|0.6|2.5|ttdprev=alpha 38}}||Extra flags&lt;br /&gt;
|-&lt;br /&gt;
|1A||B||{{ottdp|0.6|2.5|ttdprev=alpha 39}}||Animation frames&lt;br /&gt;
|-&lt;br /&gt;
|1B||B||{{ottdp|0.6|2.5|ttdprev=alpha 39}}||Animation speed&lt;br /&gt;
|-&lt;br /&gt;
|1C||B||{{ottdp|0.6|2.5|ttdprev=alpha 43}}||Class of the building type&lt;br /&gt;
|-&lt;br /&gt;
|1D||B||{{ottdp|0.6|2.5|ttdprev=alpha 55 vcs 2}}||Callback flags 2&lt;br /&gt;
|-&lt;br /&gt;
|1E||D||{{ottdp|0.6|2.5|ttdprev=alpha 55 vcs 2}}||Accepted cargo types&lt;br /&gt;
|-&lt;br /&gt;
|1F||B||{{ottdp|0.6|2.6|ttdprev=r1554}}||Minimum life span in years&lt;br /&gt;
|-&lt;br /&gt;
|20||V||{{ottdp|1.2|2.6|ottdrev=r23072|ttdprev=r1677}}||Cargo acceptance watch list&lt;br /&gt;
|-&lt;br /&gt;
|21||W||{{ottdp|0.7|no|ottdrev=r13437}}||Long year (zero based) of minimum appearance&lt;br /&gt;
|-&lt;br /&gt;
|22||W||{{ottdp|0.7|no|ottdrev=r13437}}||Long year (zero based) of maximum appearance&lt;br /&gt;
|-&lt;br /&gt;
|23||V||{{ottdp|1.9|no|ottdrev=48b334cf}}||Tile acceptance list &lt;br /&gt;
|-&lt;br /&gt;
|24||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When a town decides to expand, each active house type (both old and new ones) has a uniform probability to appear, so the more new houses you define, the fewer old TTD buildings will appear.&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&lt;br /&gt;
&lt;br /&gt;
=== Substitute building type (08) ===&lt;br /&gt;
&lt;br /&gt;
This building type will be used instead of your new one if your definition isn&#039;t available for any reason (the grf file is not found, for example).&lt;br /&gt;
&lt;br /&gt;
Don&#039;t set a substitute building type that is larger than your new one (for example, don&#039;t set 14 (stadium) for an 1x1 building) because this may corrupt savegames. Setting this property automatically copies every property of the substitute building to your new building, so you don&#039;t have to change properties that are the same as the substitute.&lt;br /&gt;
&lt;br /&gt;
House flags 40 and 80 are exceptions; these flags are never set automatically. Only the first property 08 setting copies properties; if you later change it, properties will stay.&lt;br /&gt;
&lt;br /&gt;
There&#039;s a special use of this property beginning from alpha 72: if you set it to FFh, you can disable an old house type. In this case, the ID used must be the number of old house type you want to disable. Disabling only prevents building the type in towns; houses already present on the map will stay unchanged. The type can still be overridden, and overriding affects houses present on the map.&lt;br /&gt;
&lt;br /&gt;
If this house&#039;s action 3 appears before this property is set, the action 3 will have no effect.&lt;br /&gt;
&lt;br /&gt;
=== Building flags (09) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||This is a 1x1 building&lt;br /&gt;
|-&lt;br /&gt;
|1||2||This building can be built only on flat land (if clear, foundations are automatically displayed on sloped land)&lt;br /&gt;
|-&lt;br /&gt;
|2||4||This is a 2x1 building&amp;lt;ref name=&amp;quot;large&amp;quot;&amp;gt;If your building isn&#039;t 1x1, set flags for the north tile, then define the next 1 or 3 tiles tiles (by setting their property 8). The only bit that can be set in the flags of additional tiles is bit 5 (animation). There should be no property 8 setting between the first tile and the additional tiles.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||This is a 1x2 building&amp;lt;ref name=&amp;quot;large&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|4||10||This is a 2x2 building&amp;lt;ref name=&amp;quot;large&amp;quot; /&amp;gt;&amp;lt;ref&amp;gt;For 2x2 buildings, the first additional tile is the east one, the second is the west part and the third is the south part. You probably want to set the substitute for additional tiles to a TTD additional tile whose flags are already zero. 2x2 buildings are always built on flat land no matter how bit 1 is set.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|5||20||Animation flag, set in tiles 04 and 05 (large office block). New buildings have a different animation scheme than large office blocks, but animation is still enabled with this bit.&amp;lt;ref&amp;gt;The animation flag works on a per-tile basis, so you should enable it for additional tiles of multi-tile buildings as well if you want all tiles to be animated.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|6||40||This building is a church&amp;lt;ref name=&amp;quot;only1&amp;quot;&amp;gt;Only one church and one stadium can exist in a town. The town won&#039;t build buildings with the according flag set until the old church/stadium is removed. (This can be done by either the town or a player)&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|7||80||This building is a stadium&amp;lt;ref name=&amp;quot;only1&amp;quot; /&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Availability years (0A) ===&lt;br /&gt;
&lt;br /&gt;
The low byte is the minimum year, the high is the maximum. The building can only be built between these two years (inclusive). 1920 is added to both bytes before using the values.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|no| }}&lt;br /&gt;
Since the year counting stops in TTDPatch in 2070 even with [[ttwiki:EternalGame|EternalGame]] on, start years above 150 mean &amp;quot;never&amp;quot;, and end years above 150 mean &amp;quot;forever&amp;quot;. In OpenTTD there is no limit for the maximum year (resp. it is 5000000).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING:&#039;&#039;&#039; Don&#039;t set the start year below 1930 (0Ah) unless you know what you&#039;re doing!&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} If TTDPatch finds a building that is available before 1930, it will not build old building types until that year, so you have to provide at least one custom building type that is available before 1930 for every [[TownZones|town zone]], or TTD may deadlock while trying to create a random game or expand a town.&lt;br /&gt;
&lt;br /&gt;
{{ottd|}} The availability of all active houses with the lowest availability year is set to start from year 0, so that always at least one house is available irrespective of starting year. Thus, if you de-activate default houses or set an introduction date prior to the default houses introduction year 1930, you should have at least for each [[TownZones|town zone]] a house with the same earliest availability year or you might end up with a situation where no house can be placed in a [[TownZones|town zone]].&lt;br /&gt;
&lt;br /&gt;
=== Population (0B) and Mail generation multiplier (0C) ===&lt;br /&gt;
[[Image:House_production.png|frame|right|Actual house production roughly depends on squared value of the population / mail generation multiplier.]]&lt;br /&gt;
&lt;br /&gt;
The population of the town will be increased by the amount set in prop. 0B if this building is built. Additional house parts should have a population of zero. The higher this value is, the more passengers this building generates.&lt;br /&gt;
&lt;br /&gt;
The higher the mail generation multiplier is, the more mail the building generates. For multi-tile buildings, mail generation is done in per-tile basis, so you can specify different values for every tile, although distributing the generation equally between tiles is suggested.&lt;br /&gt;
&lt;br /&gt;
This is how exactly passengers are generated: In each periodic processing (i.e. every 256 ticks), a random value 0&amp;lt;=X&amp;lt;=255 is generated for each house tile. If X isn&#039;t smaller than the population of the tile, no passengers are generated. Otherwise, X/8+1 passengers are generated (rounded down). If there is a recession going on, the number of generated passengers is halved, but this division gets rounded up instead of down. Mail generation happens in a similar manner, but with a new random value, and checking against the mail generation multiplier instead of the population.&lt;br /&gt;
&lt;br /&gt;
You can further customize how the cargo is generated with the [[Callbacks#Custom_cargo_production_.282E.29 |callback 2E]].&amp;lt;br style=&amp;quot;clear:both&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Passenger (0D), Mail (0E) and Good/Food/Fizzy drinks (0F) acceptance ===&lt;br /&gt;
&lt;br /&gt;
The acceptance is given in units of 1/8th and must not be larger than 8 eighths.&lt;br /&gt;
&lt;br /&gt;
For property 0F, positive values indicate that the building accepts goods, and negative values (i.e. FF = 1/8th, FE = 2/8ths etc.) indicate acceptance of food or fizzy drinks, depending on the climate.&lt;br /&gt;
&lt;br /&gt;
All the above three values can be set independently for tiles of multi-tile buildings, since every tile is processed individually when determining what a station accepts.&lt;br /&gt;
&lt;br /&gt;
The type of accepted cargo can be modified using [[Action0Houses#Accepted_cargo_types|property 1E]].&lt;br /&gt;
&lt;br /&gt;
{{ottdp|no| }} Note that in TTDPatch the officefood switch may modify acceptance in the sub-arctic and subtropical climates.&lt;br /&gt;
&lt;br /&gt;
=== Building name ID (12) ===&lt;br /&gt;
&lt;br /&gt;
The ID of the text that should be displayed in the land query window. The name can also be set by [[Action4|action 4]] (see there). Should be set to the same value for every tile for multi-tile buildings.&lt;br /&gt;
&lt;br /&gt;
=== Building availability mask (13) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0..4||1,2,4,8,10||which [[VariationalAction2/Houses#Town zone (42)|town zone(s)]] the building can be built in&lt;br /&gt;
|-&lt;br /&gt;
|11||800||can appear in sub-arctic climate above the snow line&lt;br /&gt;
|-&lt;br /&gt;
|12||1000||can appear in temperate climate&lt;br /&gt;
|-&lt;br /&gt;
|13||2000||can appear in sub-arctic climate below the snow line&lt;br /&gt;
|-&lt;br /&gt;
|14||4000||can appear in subtropical climate&lt;br /&gt;
|-&lt;br /&gt;
|15||8000||can appear in toyland climate&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property should be set to zero for additional building tiles.&lt;br /&gt;
&lt;br /&gt;
=== House callback flags (14,1D) ===&lt;br /&gt;
&lt;br /&gt;
For houses, the following [[callbacks]] can be defined by setting the corresponding bit in property 14:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Variable 0C value!!Version!!Callback&lt;br /&gt;
|-&lt;br /&gt;
|0||1||17||{{ottdp| | }}||decide whether the house can be built on a given tile&lt;br /&gt;
|-&lt;br /&gt;
|1||2||1A||{{ottdp| | }}||decide the following frame of the animations&lt;br /&gt;
|-&lt;br /&gt;
|2||4||1B||{{ottdp| | }}||periodically start/stop the animation&lt;br /&gt;
|-&lt;br /&gt;
|3||8||1C||{{ottdp| | }}||change animation when construction state changes&lt;br /&gt;
|-&lt;br /&gt;
|4||10||1E||{{ottdp| | }}||decide the color of the building&lt;br /&gt;
|-&lt;br /&gt;
|5||20||1F||{{ottdp| | }}||decide the cargos amounts accepted&lt;br /&gt;
|-&lt;br /&gt;
|6||40||20||{{ottdp| | }}||decide the length of the current animation frame&lt;br /&gt;
|-&lt;br /&gt;
|7||80||21||{{ottdp| | }}||trigger destruction of building&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Property 1D was introduced after all bits of property 14 were filled. Its usage is the same, only the meaning of bits is different:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Variable 0C value!!Version!!Callback&lt;br /&gt;
|-&lt;br /&gt;
|0||1||2A||{{ottdp| | }}||decide the cargo types accepted&lt;br /&gt;
|-&lt;br /&gt;
|1||2||2E||{{ottdp| | }}||custom cargo production&lt;br /&gt;
|-&lt;br /&gt;
|2||4||143||{{ottdp| | }}||conditional protection&lt;br /&gt;
|-&lt;br /&gt;
|3||8||14E||{{ottdp|1.0|2.6|ottdrev=r17558|ttdprev=2249}}||decide if default foundations need to be drawn&lt;br /&gt;
|-&lt;br /&gt;
|4||10||14F||{{ottdp|1.0|2.6|ottdrev=r17558|ttdprev=2249}}||allow or deny autosloping below the tile&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the variational Action2 for callbacks.&lt;br /&gt;
&lt;br /&gt;
Callback flags are ignored for additional building tiles.&lt;br /&gt;
&lt;br /&gt;
=== House override byte (15) ===&lt;br /&gt;
&lt;br /&gt;
Setting this property makes this building appear instead of the given old TTD building type. Setting the property is ignored if the given old house type is already overridden. You can set this property more than once to override more old building types.&lt;br /&gt;
&lt;br /&gt;
No new house of the overridden types will be built in towns.&lt;br /&gt;
&lt;br /&gt;
This property works in a per-tile basis, so you override tiles of old multi-tile buildings individually, although the old type will still be built if you don&#039;t override its north tile.&lt;br /&gt;
&lt;br /&gt;
=== Periodic refresh multiplier (16) ===&lt;br /&gt;
&lt;br /&gt;
This is used for random triggers, and sets how often the tile is re-randomized. When set to X, the tile will be re-randomized on every (X+1)-th periodic processing. (In other words, every (X+1)*256 game ticks.) If you want all tiles to be re-randomized, you must set this (but not necessarily to the same value) for each tile.&lt;br /&gt;
&lt;br /&gt;
If callback 1B is enabled in property 14, it is also called after re-randomizing random bits.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.1|2.5|ttdprev=2.5 beta 9}} In TTDPatch versions before TTDPatch 2.6 r1639 and TTDPatch 2.5 beta 9 (including beta 9), this variable could have any value between 0 and 255. After these versions, the upper limit has been lowered to 63. To maintain compatibility, values above 63 will be interpreted as 63.&lt;br /&gt;
&lt;br /&gt;
=== Random colours (17) ===&lt;br /&gt;
&lt;br /&gt;
This specifies four colors used for random painting (see [[Action2HousesIndustryTiles]]). Each byte of the dword defines a color, the values are the same as in Action2, except that numbering starts from zero instead of 775. If not set, this defaults to 04 08 0c 06 (red, blue, orange and green, the colors of the modern office building). Can be set to different values for tiles of multi-tile buildings.&lt;br /&gt;
&lt;br /&gt;
=== Probability (18) ===&lt;br /&gt;
&lt;br /&gt;
This sets the relative probability of this house being built. Old TTD house types have a probability of 16, and this is the default for new types as well.&lt;br /&gt;
&lt;br /&gt;
Increase (or better multiply) this value to make your building appear relatively more often, or decrease (divide) it to make it rarer. If you set this to zero, the house type never appears. The minimal useful value 1 means it&#039;s sixteen times less probable to build this type than a normal type, while the maximum setting of 255 means it&#039;s almost sixteen times more probable.&lt;br /&gt;
&lt;br /&gt;
The probability is relative since the absolute probability depends on the count and probability of other houses as well: the more types are available (and the higher their probabilities are), the less the chance is that your type will be chosen.&lt;br /&gt;
&lt;br /&gt;
=== Extra Flags (19) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|0.6|2.5}}||This building appears during the generation of a town, but not later, i.e. will appear in random games, but new ones won&#039;t be built during the game. Useful for buildings that are intended to be historical.&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||This building is protected, i.e. towns and AI players won&#039;t remove it. Human players can still remove it, so you may need to set a high remove cost/rating to make them think twice.&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|0.6|2.5}}||Synchronized [[Callbacks#Animation_control_.281B.2F25.2F140.2F152.2F159.29| callback 1B]]. (for multi-tile buildings)&amp;lt;ref&amp;gt;If synchronized callbacks are enabled, callback 1B will be called when the periodic processing reaches the main tile of the building, and not when it reaches the current tile. This is useful if your animation must run synchronously on every tile of the building. If this bit is set, callback 1B is called according to the main tile&#039;s property 16, not the current one, to make sure every tile stays in sync. This bit can also be set for a subset of the tiles of a house, and will only affect those tiles then.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5|ttdprev=beta 2}}||[[Callbacks#Next animation frame (1A/26/141/153/158) |Callback 1A]] needs random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Animation Frames (1A) ===&lt;br /&gt;
&lt;br /&gt;
The bottom seven bits define how many frames the animation consists of, minus one. (I.e. 0 means 1 frame, 1 means 2 frames etc.) The highest bit has another purpose (see below), so the biggest supported value is 7F (128 frames).&lt;br /&gt;
&lt;br /&gt;
The highest bit is set if the animation is looping, i.e. it should start again from the first frame after showing the last frame. Non-looping animations stop after the last frame, leaving it on the screen. Both kinds of animations start automatically when the building is created. It&#039;s recommended to use callback 1B with non-looping animations, so they are played multiple times.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6|2.5|ottdrev=r12347|ttdprev=r1639}} In TTDPatch versions before TTDPatch 2.6 r1639 and TTDPatch 2.5 beta 9 (including beta 9) and OpenTTD before r12347, the frame number was limited to 32. If you intend to maintain compatibility with those versions, you should not use animations longer than 32 frames.&lt;br /&gt;
&lt;br /&gt;
=== Animation Speed (1B) ===&lt;br /&gt;
&lt;br /&gt;
This is the amount of time between switching frames.&lt;br /&gt;
&lt;br /&gt;
The default value is 2, which means the switch occurs every 108 milliseconds. Increasing this value by one doubles the wait, i.e. 3 will cause 216 ms delay, while 4 will pause 432 ms, and so on. Values below 2 have the same effect as 2, so the default is the fastest possible setting. The maximum is 16, which means 1769 seconds (approx. half an hour) delay. Settings above this value may cause strange behaviour.&lt;br /&gt;
&lt;br /&gt;
=== Building Class (1C) ===&lt;br /&gt;
&lt;br /&gt;
Types that were given the same class byte are considered to be in the same class. If you don&#039;t explicitly set this value, the type is considered to have no class (it won&#039;t be considered to be class 0). The scope of a class is the current GRF file, so two types are never in the same class if they were defined by different GRF files. Currently, this property affects variable 44 only.&lt;br /&gt;
&lt;br /&gt;
This property is a per-tile one, you can set it for additional tiles as well. It&#039;s a better idea, however, to set it for the main tile only, since var. 44 counts tiles, not buildings, and you may count multi-tile multiple times otherwise.&lt;br /&gt;
&lt;br /&gt;
=== Accepted cargo types (1E) ===&lt;br /&gt;
&lt;br /&gt;
There may be cases when you want your house to accept something other than the default types (passenger, mail, goods and food). This property allows you to do that. If this property is set to FFFFFFFFh (the default), the meaning of properties 0D, 0E and 0F aren&#039;t changed, that is, they are the passenger, mail and goods/food acceptances, accordingly. If this property isn&#039;t FFFFFFFFh, the first three bytes must be climate-dependent cargo slot numbers (the fourth byte is ignored). In this case property 0D is the amount of acceptance of the first cargo type given, 0E is the same for the second type and 0F is the same for the third type.&lt;br /&gt;
&lt;br /&gt;
From GRF version 7 and above, the meaning of this property changes: instead of climate-dependent cargo slot numbers, you have to give climate-independent cargo IDs. If your GRF has a cargo translation table, then this ID is the index in that table; otherwise, it&#039;s the cargo slot number. Acceptance of cargoes not currently present will automatically be disabled.&lt;br /&gt;
&lt;br /&gt;
{{ottd|15.0}} Since 15.0, a default cargo translation table corresponding to the climate is used if one is not provided.&lt;br /&gt;
&lt;br /&gt;
=== Minimum life span in years (1F) ===&lt;br /&gt;
&lt;br /&gt;
Towns are prevented from destroying the house if it hasn&#039;t yet reached the age given here. The default is 0, which means towns are free to remove the house any time they like. Please note that this setting doesn&#039;t prevent AI players from removing the house; only towns are affected. If you need to protect your building from AI players as well, you can set the &amp;quot;protected&amp;quot; flag (property 19 bit 1), or use [[Callbacks#Protect building conditionally (143) |callback 143]] and use your custom code to decide who (and when) is allowed to remove the building.&lt;br /&gt;
&lt;br /&gt;
For this to operate consequently on multi-tile buildings, you must set the same minimum lifespan for all tiles of the building.&lt;br /&gt;
&lt;br /&gt;
=== Cargo acceptance watch list (20) ===&lt;br /&gt;
&lt;br /&gt;
This property is a list of cargo types, types whose acceptance should be watched. The first byte is the length of the list, the remaining bytes identify cargo types. {{grfFrom|7}} If your GRF is version 7 or above, and has a cargo translation table, the bytes are indexes in the table; otherwise, they are cargo slot numbers. When a cargo from this list is accepted by the current tile, [[Callbacks#Watched cargo accepted (148) |callback 148]] is called on &#039;&#039;all&#039;&#039; tiles of the building. See [[Callbacks#Watched cargo accepted (148) |callback 148]] for more details about how this happens.&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} This property has no effect if the station2 structure isn&#039;t present. The station2 structure is present if any of the following is true:&lt;br /&gt;
* Generalfixes is on, and miscmods.noextendstationrange is off&lt;br /&gt;
* Any of fifoloading, newcargos or irregularstations is on&lt;br /&gt;
&lt;br /&gt;
=== Availability years (long format) - Minimum (21) - Maximum (22) ===&lt;br /&gt;
&lt;br /&gt;
Those two properties allow to specify a range of dates (based on year zero(0) that are not limited to the 1930 dates. So earlier buildings can be introduced. Be sure to add substantial houses to the sets, if you do not wat to have uniform towns, since the current earliest houses will remain in their current 1920 era. Mind also the warning wrt. introduction years as described at property 0A.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15|no}} A value of FFFF is treated as the game&#039;s MAX_YEAR instead of a literal year 65535.&lt;br /&gt;
&lt;br /&gt;
=== Tile acceptance list (23) ===&lt;br /&gt;
{{ottdp|1.9|no|ottdrev=48b334cf}} &lt;br /&gt;
&lt;br /&gt;
Format:&lt;br /&gt;
 &amp;lt;numinput&amp;gt; (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;)*&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Size!!Variable!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|B||numinput||Number of (&amp;lt;cargotype&amp;gt; &amp;lt;acceptance&amp;gt;) pairs to follow,&lt;br /&gt;
|-&lt;br /&gt;
|B||cargotype||Cargotype (from CTT) to accept.&lt;br /&gt;
|-&lt;br /&gt;
|B||acceptance||Acceptance in 1/8 units.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This property defines up to 16 cargotypes, which are accepted by the house.&lt;br /&gt;
Use this property instead of property 0D..0F.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Road_Stops&amp;diff=4985</id>
		<title>Action0/Road Stops</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Road_Stops&amp;diff=4985"/>
		<updated>2025-04-15T11:46:14Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Animation triggers (10) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Defining properties of road stops.&lt;br /&gt;
&lt;br /&gt;
Road stop IDs may be freely chosen. In action 0, you need only specify IDs relative to the set, i.e. the ID of the first road stop type is 00, the second road type is 01 and so on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
OpenTTD supports 64000 road stops per game, and 64000 road stop IDs per GRF file.&lt;br /&gt;
&lt;br /&gt;
The property you &#039;&#039;&#039;must&#039;&#039;&#039; set for each road stop ID is 08 (in addition to defining an action 3 for it). Also, all road stop IDs must get their classes in the right order, starting from ID 00 onwards.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
{|&lt;br /&gt;
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description&lt;br /&gt;
|-&lt;br /&gt;
|08||D||{{ottdp|14}}||Class label, see below&lt;br /&gt;
|-&lt;br /&gt;
|09||B||{{ottdp|14}}||Road stop type&lt;br /&gt;
|-&lt;br /&gt;
|0A||W||{{ottdp|14}}||Road stop name text ID&lt;br /&gt;
|-&lt;br /&gt;
|0B||W||{{ottdp|14}}||Class name text ID&lt;br /&gt;
|-&lt;br /&gt;
|0C||B||{{ottdp|14}}||Draw mode&lt;br /&gt;
|-&lt;br /&gt;
|0D||D||{{ottdp|14}}||Random trigger cargoes&lt;br /&gt;
|-&lt;br /&gt;
|0E||W||{{ottdp|14}}||Animation information&lt;br /&gt;
|-&lt;br /&gt;
|0F||B||{{ottdp|14}}||Animation speed&lt;br /&gt;
|-&lt;br /&gt;
|10||W||{{ottdp|14}}||Animation triggers&lt;br /&gt;
|-&lt;br /&gt;
|11||B||{{ottdp|14}}||Callback flags, see below&lt;br /&gt;
|-&lt;br /&gt;
|12||D||{{ottdp|14}}||General flags, see below&lt;br /&gt;
|-&lt;br /&gt;
|15||W||{{ottdp|14}}||Cost multipiers, see below&lt;br /&gt;
|-&lt;br /&gt;
|16||W n*W||{{ottdp|15}}||List of badges&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&lt;br /&gt;
&lt;br /&gt;
=== Road stop class (08) ===&lt;br /&gt;
&lt;br /&gt;
New road stops are grouped graphics into classes.&lt;br /&gt;
&lt;br /&gt;
Only two classes are pre-defined:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Name!!Class ID!!Intended use for road stops&lt;br /&gt;
|-&lt;br /&gt;
|DFLT||44 46 4C 54||Default road stops&lt;br /&gt;
|-&lt;br /&gt;
|WAYP||57 41 59 50||{{ottdp|15}} Road waypoints&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{ottdp|15}} Road stop classes which start with the byte FF are considered road waypoint classes, and will appear in the road waypoint construction window instead of the road bus/truck stop construction windows.&lt;br /&gt;
&lt;br /&gt;
It is recommended that the class identifier used is unique to your GRF(s).&lt;br /&gt;
&lt;br /&gt;
=== Road stop type (09) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||Passenger/bus stop&lt;br /&gt;
|-&lt;br /&gt;
|1||Freight/lorry stop&lt;br /&gt;
|-&lt;br /&gt;
|2||Both passenger/bus and freight/lorry stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The default value is 2: Both passenger/bus and freight/lorry stops&lt;br /&gt;
&lt;br /&gt;
=== Road stop name text ID (0A) ===&lt;br /&gt;
&lt;br /&gt;
The text ID for this road stop (word value). This textid should be either a TTD textid or a D4xx textid (set via D0xx in action4).&lt;br /&gt;
&lt;br /&gt;
=== Class name text ID (0B) ===&lt;br /&gt;
&lt;br /&gt;
The text ID for the road stop class.&lt;br /&gt;
&lt;br /&gt;
When specifying a road stop, you don&#039;t need to set a class name again if you already did for another one with the same class.&lt;br /&gt;
&lt;br /&gt;
=== Draw mode (0C) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||Bay stops: Draw road type ground sprite&lt;br /&gt;
|-&lt;br /&gt;
|1||2||Drive through stops: Draw road/tram type overlays&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|15}} Road waypoints: Draw the sprite layout ground tile (on top of the road)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The default value is 3 (bits 0 and 1 both set).&lt;br /&gt;
&lt;br /&gt;
The remaining bits are reserved for future use.&lt;br /&gt;
&lt;br /&gt;
=== Cargo types for random triggers (0D) ===&lt;br /&gt;
&lt;br /&gt;
This sets which cargo types should trigger re-randomizing. The cargo types are given as a bitmask of the bits from column 3 (type B) in CargoTypes. &amp;amp;nbsp;If nothing is set (the default), the no random triggers will happen, to conserve CPU time.&lt;br /&gt;
&lt;br /&gt;
With GRF version 7 and above, the interpretation of bits changes. Instead of climate-dependent cargo slot numbers (type B), you have to set the bits of climate-independent cargo ID (type A).&lt;br /&gt;
&lt;br /&gt;
=== Animation information (0E) ===&lt;br /&gt;
&lt;br /&gt;
The low byte specifies the number of animation frames minus one, so 00 means 1 frame, 01 means 2 frames etc. The maximum number of frames is 256, although you can have some problems if your animation exceeds FD (253) frames. The high byte must be 0 for non-looping animations and 01 for looping animations. Every other value is reserved for future use. In addition, if the whole word contains FFFF, animation is turned off for this station (this is the default value).&lt;br /&gt;
Since you can&#039;t have properties for individual station tiles, this property applies for every tile of the station. If you don&#039;t want to animate some tiles, you should check the current position during [[Callbacks#Animation control (1B/25/140/152/159)|callback 140]] and return FD if the current tile doesn&#039;t need to be animated. If you also need animations of different length per tile, you&#039;ll have to use [[Callbacks#Next animation frame (1A/26/141/153/158)|callback 141]] for that.&lt;br /&gt;
&lt;br /&gt;
=== Animation speed (0F) ===&lt;br /&gt;
The meaning is the same as for [[Action0Houses#Animation Speed 1B|house property 1B]], but the lower limit is 0 instead of 2, so the fastest possible animation changes frames every game tick (27ms). The default value is 2.&lt;br /&gt;
&lt;br /&gt;
=== Animation triggers (10) ===&lt;br /&gt;
This is a bit mask of events that should trigger [[Callbacks#Animation control (1B/25/140/152/159)|callback 140]], allowing to change the animation state&lt;br /&gt;
&lt;br /&gt;
Roadstops have the same animation triggers as [[Action0/Stations#Animation_triggers_.2818.29|rail stations]].&lt;br /&gt;
&lt;br /&gt;
=== Callback flags (11) ===&lt;br /&gt;
For road stops, the following [[callbacks]] can be defined by setting the corresponding bit in property 0B:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Variable 0C value!!Callback&lt;br /&gt;
|-&lt;br /&gt;
|0||1||13||Whether to make the road stop available in construction window (non-zero callback return) or not (callback returns zero)&lt;br /&gt;
|-&lt;br /&gt;
|1||2||141||Decide next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|2||4||142||Decide animation speed&lt;br /&gt;
|}&lt;br /&gt;
Bit is the bit you have to set, you do this by adding all the values for all the bits. Variable 0C value is what variable 0C will be set to, for checking it in the [[VariationalAction2|VarAction2]] for callbacks.&lt;br /&gt;
&lt;br /&gt;
=== General Flags (12) ===&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||1||[[Callbacks#Next animation frame (1A/26/141/153/158)|callback 141]] needs random bits in var. 10&lt;br /&gt;
|-&lt;br /&gt;
|2||4||Do not show catenary graphics&lt;br /&gt;
|-&lt;br /&gt;
|3||8||Only allow drive-through stops (not bay stops)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||Do not automatically build connecting road pieces&lt;br /&gt;
|-&lt;br /&gt;
|5||20||Only show in the road build menu (not tram)&lt;br /&gt;
|-&lt;br /&gt;
|6||40||Only show in the tram build menu (not road)&lt;br /&gt;
|-&lt;br /&gt;
|8||100||{{ottdp|15}} Read the draw mode from register 0x100, overriding the default value in property 0C&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The default value is 0 (no bits set).&lt;br /&gt;
&lt;br /&gt;
The remaining bits are reserved for future use.&lt;br /&gt;
&lt;br /&gt;
=== Cost multipiers (15) ===&lt;br /&gt;
&lt;br /&gt;
The first byte is the build cost multiplier.&lt;br /&gt;
&lt;br /&gt;
The second byte is the removal cost multiplier.&lt;br /&gt;
&lt;br /&gt;
The total property length is 2 bytes.&lt;br /&gt;
&lt;br /&gt;
A value of 16 produces a build or removal cost the same as non-NewGRF road stops.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=4984</id>
		<title>Callback: Animation control</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Animation_control&amp;diff=4984"/>
		<updated>2025-04-15T11:45:06Z</updated>

		<summary type="html">&lt;p&gt;Frosch: roadstops&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Animation control (1B/25/140/152/159) ==&lt;br /&gt;
&lt;br /&gt;
Called periodically, in a time interval specified in property 16 (houses) or when an animation trigger happens (industry tiles, stations, roadstops, airport tiles and objects). Returns the number of the frame the animation should jump to, or one of the following special values:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|FF||stop animation in its current frame&lt;br /&gt;
|-&lt;br /&gt;
|FE||start animation with its current frame&lt;br /&gt;
|-&lt;br /&gt;
|FD||leave the animation in its current state (do nothing)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* For multi-tile town buildings, [[Action0/Houses#Extra_Flags_.2819.29|property 19/bit 2]] modifies this callback slightly, see details there.&lt;br /&gt;
&lt;br /&gt;
* Except for CB 1B (houses), the low byte of variable 18 contains the reason (animation trigger) for the call. This is formatted as the number of the bit that was set in the relevant action 0 property. The other bits may contain additional information specific for the trigger/reason.&lt;br /&gt;
:{| |-&lt;br /&gt;
! Feature !! Callback !! Animation triggers&lt;br /&gt;
|-&lt;br /&gt;
| Houses || 1B || none&lt;br /&gt;
|-&lt;br /&gt;
| Industry tiles || 25 || [[Action0/Industry_Tiles#Triggers_for_callback_25_.2811.29|Property 11]]&lt;br /&gt;
|-&lt;br /&gt;
| Stations/Roadstops || 140 || [[Action0/Stations#Animation_triggers_.2818.29|Property 18]]&lt;br /&gt;
|-&lt;br /&gt;
| Airport tiles || 152 || [[Action0/Airport_Tiles#Animation_triggers_via_callback_153_.2811.29|Property 11]]&lt;br /&gt;
|-&lt;br /&gt;
| Objects || 159 || [[Action0/Objects#Animation_triggers_.2813.29|Property 13]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Except for CB 1B (houses), the callbacks are always used when defined, no bit in the action 0 property needs to be set to activate them.&lt;br /&gt;
&lt;br /&gt;
* {{ottdp| |2.5|ttdprev=beta 2}} Since TTDPatch 2.5 beta 2, these callbacks get random bits in variable 10, to allow randomizing changes.&lt;br /&gt;
&lt;br /&gt;
* For callback 1B (houses), the exact randomness depends on bit 2 of [[Action0/Houses#Extra_Flags_.2819.29|property 19]] (synchronized callback 1B). If the callback is synchronized, the high 16 bits will be the same for all tiles and the low 16 bits will be different for each tile. Otherwise, all 32 bits will be independent for each tile.&lt;br /&gt;
&lt;br /&gt;
* For CB 25 (industry tiles), the randomness depends on the type of the event. For triggers that happen for the whole industry (triggers 2, 3 and 4), the high 16 bits will be the same for all tiles, while the low 16 bits will be different. For other triggers, all 32 bits are independent.&lt;br /&gt;
&lt;br /&gt;
* For CB 140 (stations, roadstops), the high 16 bits are the same for all tiles triggered, while the low 16 bits are different for each tile.&lt;br /&gt;
&lt;br /&gt;
* Like all animation callbacks, if the high byte of the result is nonzero, it will be interpreted as a sound effect number, and the corresponding sound effect will be played at the tile.&lt;br /&gt;
[[Category:Callbacks]]&lt;br /&gt;
&lt;br /&gt;
Note: Every time the animation frame is changed the map tile will be refreshed, even if the selected graphics stay the same. Therefore using the animation frame as a timer should be avoided, and animation triggers should be preferred instead.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Next_animation_frame&amp;diff=4983</id>
		<title>Callback: Next animation frame</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Next_animation_frame&amp;diff=4983"/>
		<updated>2025-04-15T11:42:10Z</updated>

		<summary type="html">&lt;p&gt;Frosch: roadstops&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Next animation frame (1A/26/141/153/158) ==&lt;br /&gt;
&lt;br /&gt;
Called in every animation frame, this callback returns the number of the next frame to display. Additionally, it can return these special values:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|FF||stop animation. The current frame stays on screen until the animation is restarted.&lt;br /&gt;
|-&lt;br /&gt;
|FE||continue with next frame as usual. You can return this for stages where you don&#039;t want to do anything special.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{ottdp| |2.5|ttdprev=beta 2}} From TTDPatch 2.5 beta 2, you can ask for random bits in variable 10. To enable this, set bit 3 of property 19 for houses, bit 0 of property 12 for industry tiles, bit 2 of property 13 for stations, bit 0 of property 12 for roadstops, or bit 12 of property 10 for objects.&lt;br /&gt;
&lt;br /&gt;
Like all animation callbacks, if the high byte of the result is nonzero, it will be interpreted as a sound effect number, and the corresponding sound effect will be played at the tile.&lt;br /&gt;
[[Category:Callbacks]]&lt;br /&gt;
&lt;br /&gt;
Note: Every time the animation frame is changed the map tile will be refreshed, even if the selected graphics stay the same. Therefore using the animation frame as a timer should be avoided, and animation triggers should be preferred instead.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Station_availability&amp;diff=4982</id>
		<title>Callback: Station availability</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callback:_Station_availability&amp;diff=4982"/>
		<updated>2025-04-15T11:39:39Z</updated>

		<summary type="html">&lt;p&gt;Frosch: roadstops&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Station/Rodstop availability (13) ==&lt;br /&gt;
&lt;br /&gt;
This sets whether a station/roadstop can be constructed or not, i.e. whether it can be selected in the station construction window. &amp;amp;nbsp;Returning 1 as callback return indicates the station can be built, and a return code of 0 removes the station from the selection.&lt;br /&gt;
&lt;br /&gt;
{{grfTill|7}} Note that GRF versions 7 and lower only distinguished zero and non-zero return values.&lt;br /&gt;
[[Category:Callbacks]]&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Callbacks&amp;diff=4981</id>
		<title>Callbacks</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Callbacks&amp;diff=4981"/>
		<updated>2025-04-15T11:37:50Z</updated>

		<summary type="html">&lt;p&gt;Frosch: roadstops&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
A callback is a special action 2 that the patch &amp;quot;calls&amp;quot; in order to modify various features, an example being the visual effect of train vehicles. &amp;amp;nbsp;See the [[ttwiki:CallbacksTut|callback tutorial]] on how to use them.&lt;br /&gt;
&lt;br /&gt;
In the final action 2 of a chain of VarAction2s, the second byte of the matching entry has to have bit 7 set to identify it as a callback result.&lt;br /&gt;
&lt;br /&gt;
For example, 04 00 is not a callback result (but it may be the ID of another chained action 2), whereas 04 80 is a callback result with a value of 4. In total a callback has 15 bit result values, where the upper 7 bits are stored in the second byte. For example, 54 C2 is a callback result with a value of 4254=16980, where again the second byte has bit 7 set, changing the 42 into C2.&lt;br /&gt;
&lt;br /&gt;
{{grfTill|7}} For GRF version 7 and below not all 15 bit values are available as return values, only values between 00 and 7EFF.&lt;br /&gt;
For compatibility with earlier patch versions, FF in the high byte is taken to mean the same thing as 80, so 04 FF also has a callback result of 4. Note that if your grf file needs to be compatible with versions before TTDPatch 2.0.1 alpha 40, you must set the high byte to FF, and so can use only 8 bit results.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|8}} For GRF version 8 and above this compatibility layer has been removed. Callbacks can return all 15 bit values between 00 and 7FFF.&lt;br /&gt;
&lt;br /&gt;
To check for a specific callback, use an [[VariationalAction2]] or [[VarAction2Advanced]] to check for variable 0C.&lt;br /&gt;
* Variable 0C contains the callback number.&lt;br /&gt;
* Variable 0C is a word, thus the VarAction2 must use type 85.&lt;br /&gt;
* Results can be specified directly using 8xxx values (see above), or with 8xxx value in subsequent (Basic/Variational/Random)Action2 which are referenced as usual with their set-id.&lt;br /&gt;
* The default case of the VarAction2 must point to the regular graphics chain, so that unknown/future callbacks results in a &amp;quot;callback failure&amp;quot; result.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 &amp;lt;Sprite-number&amp;gt; * &amp;lt;Length&amp;gt; 02 &amp;lt;feature&amp;gt; &amp;lt;set-id&amp;gt; 85 0C 00 \wxFFFF&lt;br /&gt;
                               &amp;lt;nvar&amp;gt; (&amp;lt;set-id/result&amp;gt; \wx &amp;lt;callback&amp;gt; \wx &amp;lt;callback&amp;gt;){n}&lt;br /&gt;
                                       &amp;lt;set-id of graphics chain&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The format for VarAction2 is explained in detail on the [[VariationalAction2]] page.&lt;br /&gt;
&lt;br /&gt;
== List of callbacks ==&lt;br /&gt;
&lt;br /&gt;
The following callbacks are defined by the patch. &amp;amp;nbsp;The number of the callback is what will be stored in variable 0C so that you can return the right results if you have several callbacks. &amp;amp;nbsp;All callbacks are explained in more detail below.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PLEASE NOTE:&#039;&#039;&#039; Since TTDPatch 2.5 beta 5, the size of variable 0C has changed, and now there are word-sized callback numbers as well. To maintain backwards compatibility, only callbacks 10..3F can be checked using a byte-sized check. Callbacks 140 and above, on the other hand, must be checked using a word or dword sized check, to make sure they are identified uniquely.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Number!!Feature(s)!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|10||Vehicles||[[Callback: Visual effect and wagon power|Visual effect and wagon power]]&lt;br /&gt;
|-&lt;br /&gt;
|11||Vehicles||[[Callback: Wagon length|Wagon length]]&lt;br /&gt;
|-&lt;br /&gt;
|12||Vehicles||[[Callback: Load amount|Load amount]]&lt;br /&gt;
|-&lt;br /&gt;
|13||Stations/Roadstops||[[Callback: Station availability|Station availability]]&lt;br /&gt;
|-&lt;br /&gt;
|14||Stations||[[Callback: Station sprite layout|Select sprite layout]]&lt;br /&gt;
|-&lt;br /&gt;
|15||Vehicles||[[Callback: Refitted capacity callback|Refitted capacity callback]]&lt;br /&gt;
|-&lt;br /&gt;
|16||Trains||[[Callback: Articulated engine|Build articulated engines]]&lt;br /&gt;
|-&lt;br /&gt;
|17||Houses||[[Callback: House construction check|House construction check]]&lt;br /&gt;
|-&lt;br /&gt;
|18||Several &amp;lt;ref name=&amp;quot;generic&amp;quot;&amp;gt;Generic callbacks are called for the feature, not any specific vehicle ID. Read the [[Action3#n-id|Action 3]] entry on how to define these.&amp;lt;/ref&amp;gt;||[[Callback: AI construction/purchase selection|AI construction/purchase selection]]&lt;br /&gt;
|-&lt;br /&gt;
|19||Vehicles||[[Callback: Cargo Subtype Display|Cargo sub-type display]]&lt;br /&gt;
|-&lt;br /&gt;
|1A||Houses||Next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|1B||Houses||Animation control&lt;br /&gt;
|-&lt;br /&gt;
|1C||Houses||Construction stage changes&lt;br /&gt;
|-&lt;br /&gt;
|1D||Trains||Can wagon be attached&lt;br /&gt;
|-&lt;br /&gt;
|1E||Houses||Decide colour of building&lt;br /&gt;
|-&lt;br /&gt;
|1F||Houses||Cargo acceptance&lt;br /&gt;
|-&lt;br /&gt;
|20||Houses||Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|21||Houses||Trigger building destruction&lt;br /&gt;
|-&lt;br /&gt;
|22||Industries||Availability&lt;br /&gt;
|-&lt;br /&gt;
|23||Vehicles||Additional text in purchase screen&lt;br /&gt;
|-&lt;br /&gt;
|24||Stations||Custom station layout&lt;br /&gt;
|-&lt;br /&gt;
|25||Industry tiles||Animation control&lt;br /&gt;
|-&lt;br /&gt;
|26||Industry tiles||Next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|27||Industry tiles||Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|28||Industries||Industry location permissibility&lt;br /&gt;
|-&lt;br /&gt;
|29||Industries||Random production change&lt;br /&gt;
|-&lt;br /&gt;
|2A||Houses||Get accepted cargo types&lt;br /&gt;
|-&lt;br /&gt;
|2B||Industry tiles||Decide cargo acceptance&lt;br /&gt;
|-&lt;br /&gt;
|2C||Industry tiles||Get accepted cargo types&lt;br /&gt;
|-&lt;br /&gt;
|2D||Vehicles||Select colour mapping for vehicle&lt;br /&gt;
|-&lt;br /&gt;
|2E||Houses||Custom cargo production&lt;br /&gt;
|-&lt;br /&gt;
|2F||Industry tiles||Custom shape check&lt;br /&gt;
|-&lt;br /&gt;
|30||Industry tiles||Decide drawing default foundations&lt;br /&gt;
|-&lt;br /&gt;
|31||Vehicles||Start/stop check&lt;br /&gt;
|-&lt;br /&gt;
|32||Vehicles||32-day callback&lt;br /&gt;
|-&lt;br /&gt;
|33||Several||Sound effect callback&lt;br /&gt;
|-&lt;br /&gt;
|34||Vehicles &amp;lt;ref name=&amp;quot;generic&amp;quot;/&amp;gt;||Autoreplace vehicle selection&lt;br /&gt;
|-&lt;br /&gt;
|35||Industries||Monthly random production change&lt;br /&gt;
|-&lt;br /&gt;
|36||Vehicles||Change vehicle Properties&lt;br /&gt;
|-&lt;br /&gt;
|37||Industries||Cargo sub-type display&lt;br /&gt;
|-&lt;br /&gt;
|38||Industries||Show additional text in fund window&lt;br /&gt;
|-&lt;br /&gt;
|39||Cargoes||Custom profit calculation&lt;br /&gt;
|-&lt;br /&gt;
|3A||Industries||Show additional text in industry window&lt;br /&gt;
|-&lt;br /&gt;
|3B||Industries||Control special effects&lt;br /&gt;
|-&lt;br /&gt;
|3C||Industry tiles||Disable autosloping&lt;br /&gt;
|-&lt;br /&gt;
|3D||Industries||Opt out of accepting cargo&lt;br /&gt;
|-&lt;br /&gt;
|40..13F|| ||--Reserved--&lt;br /&gt;
|-&lt;br /&gt;
|140||Stations/Roadstops||Animation control&lt;br /&gt;
|-&lt;br /&gt;
|141||Stations/Roadstops||Next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|142||Stations/Roadstops||Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|143||Houses||Protect building conditionally&lt;br /&gt;
|-&lt;br /&gt;
|144||Sounds &amp;lt;ref name=&amp;quot;generic&amp;quot;/&amp;gt;||{{ottdp|1.2|2.6|ottdrev=r23144|ttdprev=r821}} Ambient sound effects&lt;br /&gt;
|-&lt;br /&gt;
|145||Cargoes||Custom station rating calculation&lt;br /&gt;
|-&lt;br /&gt;
|146||New Signals &amp;lt;ref name=&amp;quot;generic&amp;quot;/&amp;gt;||New signals sprite drawing&lt;br /&gt;
|-&lt;br /&gt;
|147||Canals||Add sprite offset&lt;br /&gt;
|-&lt;br /&gt;
|148||Houses||Watched cargo accepted&lt;br /&gt;
|-&lt;br /&gt;
|149||Stations||Land slope check&lt;br /&gt;
|-&lt;br /&gt;
|14A||Industries||Decide industry color&lt;br /&gt;
|-&lt;br /&gt;
|14B||Industries||Decide input cargo types&lt;br /&gt;
|-&lt;br /&gt;
|14C||Industries||Decide output cargo types&lt;br /&gt;
|-&lt;br /&gt;
|14D||Houses||Customized building name&lt;br /&gt;
|-&lt;br /&gt;
|14E||Houses||Decide drawing default foundations&lt;br /&gt;
|-&lt;br /&gt;
|14F||Houses||Disable autosloping&lt;br /&gt;
|-&lt;br /&gt;
|150||Airport tiles||{{ottdp|1.1|no|ottdrev=r19197}} Decide drawing default foundations&lt;br /&gt;
|-&lt;br /&gt;
|152||Airport tiles||{{ottdp|1.1|no|ottdrev=r19197}} Animation control&lt;br /&gt;
|-&lt;br /&gt;
|153||Airport tiles||{{ottdp|1.1|no|ottdrev=r19197}} Next Animation frame&lt;br /&gt;
|-&lt;br /&gt;
|154||Airport tiles||{{ottdp|1.1|no|ottdrev=r19197}} Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|155||Airports||{{ottdp|1.1|no|ottdrev=r20373}} Extra information about airport layout in the build gui&lt;br /&gt;
|-&lt;br /&gt;
|156||Airports||{{ottdp|1.1|no|ottdrev=r20373}} Airport layout name&lt;br /&gt;
|-&lt;br /&gt;
|157||Objects||Land slope check&lt;br /&gt;
|-&lt;br /&gt;
|158||Objects||Next animation frame&lt;br /&gt;
|-&lt;br /&gt;
|159||Objects||Animation control&lt;br /&gt;
|-&lt;br /&gt;
|15A||Objects||Length of animation frame&lt;br /&gt;
|-&lt;br /&gt;
|15B||Objects||Decide colour of building&lt;br /&gt;
|-&lt;br /&gt;
|15C||Objects||Show additional text in building window&lt;br /&gt;
|-&lt;br /&gt;
|15D||Objects||Disable autosloping&lt;br /&gt;
|-&lt;br /&gt;
|15E||Vehicles||{{ottdp|1.2|no|ottdrev=r23124}} Refit cost factor&lt;br /&gt;
|-&lt;br /&gt;
|15F||Industries||{{ottdp|1.3|no|ottdrev=r24186}} Set initial production level on construction&lt;br /&gt;
|-&lt;br /&gt;
|160||Vehicles||{{ottdp|1.5|no|ottdrev=r26747}} Advanced effect creation&lt;br /&gt;
|-&lt;br /&gt;
|161||Vehicles||{{ottdp|14|no|ottdrev=g05ed9f56fd}} Engine name&lt;br /&gt;
|-&lt;br /&gt;
|162||Vehicles||{{ottdp|14|no|ottdrev=gddd609ce9b}} Probability of reversing rail vehicle on build&lt;br /&gt;
|-&lt;br /&gt;
|163||Vehicles||{{ottdp|15|no|ottdrev=gd2496b6ec4}} Custom refit&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{:Callback: Visual effect and wagon power}}&lt;br /&gt;
{{:Callback: Wagon length}}&lt;br /&gt;
{{:Callback: Load amount}}&lt;br /&gt;
{{:Callback: Station availability}}&lt;br /&gt;
{{:Callback: Station sprite layout}}&lt;br /&gt;
{{:Callback: Refitted capacity callback}}&lt;br /&gt;
{{:Callback: Articulated engine}}&lt;br /&gt;
{{:Callback: House construction check}}&lt;br /&gt;
{{:Callback: AI construction/purchase selection}}&lt;br /&gt;
{{:Callback: Cargo Subtype Display}}&lt;br /&gt;
{{:Callback: Next animation frame}}&lt;br /&gt;
{{:Callback: Animation control}}&lt;br /&gt;
{{:Callback: Construction stage changes}}&lt;br /&gt;
{{:Callback: Can wagon be attached}}&lt;br /&gt;
{{:Callback: Building colour}}&lt;br /&gt;
{{:Callback: Cargo acceptance}}&lt;br /&gt;
{{:Callback: Length of animation frame}}&lt;br /&gt;
{{:Callback: Trigger building destruction}}&lt;br /&gt;
{{:Callback: Industry availability}}&lt;br /&gt;
{{:Callback: Additional text in purchase screen}}&lt;br /&gt;
{{:Callback: Custom station layout}}&lt;br /&gt;
{{:Callback: Industry location permissibility}}&lt;br /&gt;
{{:Callback: Random production change}}&lt;br /&gt;
{{:Callback: Get accepted cargo types}}&lt;br /&gt;
{{:Callback: Decide cargo acceptance}}&lt;br /&gt;
{{:Callback: Select colour mapping for vehicle}}&lt;br /&gt;
{{:Callback: Custom cargo production}}&lt;br /&gt;
{{:Callback: Custom shape check}}&lt;br /&gt;
{{:Callback: Decide drawing default foundations}}&lt;br /&gt;
{{:Callback: Vehicle Start/stop check}}&lt;br /&gt;
{{:Callback: 32-day callback}}&lt;br /&gt;
{{:Callback: Sound effect}}&lt;br /&gt;
{{:Callback: Autoreplace vehicle selection}}&lt;br /&gt;
{{:Callback: Monthly random production change}}&lt;br /&gt;
{{:Callback: Change vehicle properties}}&lt;br /&gt;
{{:Callback: Cargo sub-type display for industries}}&lt;br /&gt;
{{:Callback: Show additional text in fund/building window}}&lt;br /&gt;
{{:Callback: Custom profit calculation for cargoes}}&lt;br /&gt;
{{:Callback: Show additional text in industry window}}&lt;br /&gt;
{{:Callback: Control special industry effects}}&lt;br /&gt;
{{:Callback: Disable autosloping}}&lt;br /&gt;
{{:Callback: Opt out of accepting cargo}}&lt;br /&gt;
{{:Callback: Protect building conditionally}}&lt;br /&gt;
{{:Callback: Ambient sound effects}}&lt;br /&gt;
{{:Callback: Custom station rating calculation}}&lt;br /&gt;
{{:Callback: New signals sprite drawing callback}}&lt;br /&gt;
{{:Callback: Add sprite offset callback}}&lt;br /&gt;
{{:Callback: Watched cargo accepted}}&lt;br /&gt;
{{:Callback: Station slope check}}&lt;br /&gt;
{{:Callback: Decide industry colour}}&lt;br /&gt;
{{:Callback: Decide input and output cargo types}}&lt;br /&gt;
{{:Callback: Customized building name}}&lt;br /&gt;
{{:Callback: Extra information about layout in the build gui}}&lt;br /&gt;
{{:Callback: Layout name}}&lt;br /&gt;
{{:Callback: Object slope check}}&lt;br /&gt;
{{:Callback: Decide object colour}}&lt;br /&gt;
{{:Callback: Refit cost factor}}&lt;br /&gt;
{{:Callback: Set initial production level on construction}}&lt;br /&gt;
{{:Callback: Advanced effect creation}}&lt;br /&gt;
{{:Callback: Engine name}}&lt;br /&gt;
{{:Callback: Build probability}}&lt;br /&gt;
{{:Callback: Custom refit}}&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=RandomAction2&amp;diff=4980</id>
		<title>RandomAction2</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=RandomAction2&amp;diff=4980"/>
		<updated>2025-04-15T11:26:03Z</updated>

		<summary type="html">&lt;p&gt;Frosch: roadstops&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Unlike [[VariationalAction2]], whose results are always determined by a predictable decision, RandomAction2 can use randomized results to pick one of several [[Action2]] entries.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The data looks as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Sprite-number&amp;gt; * &amp;lt;Length&amp;gt; 02 &amp;lt;feature&amp;gt; &amp;lt;set-id&amp;gt; &amp;lt;nowiki&amp;gt;[80|83]&amp;lt;/nowiki&amp;gt; &amp;lt;random-triggers&amp;gt; &amp;lt;randbit&amp;gt; &amp;lt;nrand&amp;gt; &amp;lt;set-ids&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From TTDPatch 2.6 r1850 and OpenTTD r12452, and &#039;&#039;&#039;for vehicles only&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Sprite-number&amp;gt; * &amp;lt;Length&amp;gt; 02 &amp;lt;feature&amp;gt; &amp;lt;set-id&amp;gt; 84 &amp;lt;count&amp;gt; &amp;lt;random-triggers&amp;gt; &amp;lt;randbit&amp;gt; &amp;lt;nrand&amp;gt; &amp;lt;set-ids&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!&#039;&#039;&#039;Element&#039;&#039;&#039;!![[GRFActionsDetailed|&#039;&#039;&#039;Size&#039;&#039;&#039;]]!!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Sprite-number&amp;gt;||dec||A sequential sprite number&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;length&amp;gt;||dec||The total number of bytes used in this action.&lt;br /&gt;
|-&lt;br /&gt;
|02||B||Defines action 02&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;feature&amp;gt;||B||For what type of vehicle/station/... should this definition be used?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set-id&amp;gt;||B||The ID of this action 2 (used like a cargo ID)&lt;br /&gt;
|-&lt;br /&gt;
|80, 83, 84||B||Type of random action, see below.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;count&amp;gt;||B||(when present) Location of controlling vehicle.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;random-triggers&amp;gt;||B||When to re-randomize&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;randbit&amp;gt;||B||What random bit to use for this action 2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;nrand&amp;gt;||B||Number of set-ids to choose from, must be a power of 2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set-ids&amp;gt;||W||Action 2 set-ids to choose from.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite-number ===&lt;br /&gt;
&lt;br /&gt;
This is just the number you are at.&lt;br /&gt;
&lt;br /&gt;
=== Length ===&lt;br /&gt;
&lt;br /&gt;
Count the number of bytes in this action.&lt;br /&gt;
&lt;br /&gt;
===Feature===&lt;br /&gt;
&lt;br /&gt;
This sets the type of [[Features|feature]] that you wish to change. Set it to:&lt;br /&gt;
&lt;br /&gt;
{|- |&lt;br /&gt;
!Value!![[Features|Feature]]&lt;br /&gt;
|-&lt;br /&gt;
|00||Trains&lt;br /&gt;
|-&lt;br /&gt;
|01||Road Vehicles&lt;br /&gt;
|-&lt;br /&gt;
|02||Ships&lt;br /&gt;
|-&lt;br /&gt;
|03||Aircraft&lt;br /&gt;
|-&lt;br /&gt;
|04||Stations&lt;br /&gt;
|-&lt;br /&gt;
|05||Canals/Rivers&lt;br /&gt;
|-&lt;br /&gt;
|07||Houses&lt;br /&gt;
|-&lt;br /&gt;
|09||Industry Tiles&lt;br /&gt;
|-&lt;br /&gt;
|0A||Industries&lt;br /&gt;
|-&lt;br /&gt;
|0D||Airports&lt;br /&gt;
|-&lt;br /&gt;
|0F||Objects&lt;br /&gt;
|-&lt;br /&gt;
|10||Railtypes&lt;br /&gt;
|-&lt;br /&gt;
|11||Airport Tiles&lt;br /&gt;
|-&lt;br /&gt;
|12||Roadtypes&lt;br /&gt;
|-&lt;br /&gt;
|13||Tramtypes&lt;br /&gt;
|-&lt;br /&gt;
|14||Road Stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== set-ID ===&lt;br /&gt;
&lt;br /&gt;
This defines the number of this action 2. &amp;amp;nbsp;The ID can then be used as target in an action 3 or another variational/random action 2.&lt;br /&gt;
&lt;br /&gt;
=== 80/83/84 ===&lt;br /&gt;
&lt;br /&gt;
Use 80 to randomize the object (vehicle, station, building, industry, object) based on its own triggers and bits.&lt;br /&gt;
&lt;br /&gt;
Use 83 to randomize the object based on its &amp;quot;related&amp;quot; object (s.b.).&lt;br /&gt;
&lt;br /&gt;
Use 84 to randomize the vehicle based on any vehicle in the consist.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Feature!!Related object&lt;br /&gt;
|-&lt;br /&gt;
|Vehicles (00-03)||First vehicle of consist&lt;br /&gt;
|-&lt;br /&gt;
|Stations (04)||N/A&lt;br /&gt;
|-&lt;br /&gt;
|Houses (07)||N/A&lt;br /&gt;
|-&lt;br /&gt;
|Industry tiles (09)||Industry containing tile&lt;br /&gt;
|-&lt;br /&gt;
|Industries (0A)||N/A&lt;br /&gt;
|-&lt;br /&gt;
|Objects (0F)||N/A&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== count ===&lt;br /&gt;
&lt;br /&gt;
For type 84, this specifies which vehicle&#039;s random bits this vehicle will be using and/or modifying.&lt;br /&gt;
&lt;br /&gt;
The low nibble (bits 0-3) specifies how far to count from the starting vehicle. If it is zero, the count will be read from GRF register 100h instead.&lt;br /&gt;
&lt;br /&gt;
The high nibble (bits 6-7, actually) specifies which vehicle is the starting vehicle, and which direction to count:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||count back (away from the engine), starting at this vehicle&lt;br /&gt;
|-&lt;br /&gt;
|4||count forward (toward the engine), starting at this vehicle.&lt;br /&gt;
|-&lt;br /&gt;
|8||count back, starting at the engine&lt;br /&gt;
|-&lt;br /&gt;
|C||count back, starting at the first vehicle in this chain of vehicles with the same ID, as for vehicle variable 41&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bits 4-5 are reserved and must be zero, so other values of the high nibble are not allowed.&lt;br /&gt;
&lt;br /&gt;
=== random-triggers ===&lt;br /&gt;
&lt;br /&gt;
This is a bit mask of triggers which cause re-randomizing. Normally, any matching trigger causes the graphics to be randomized again, but if you add 80 to the bitmask, the re-randomizing only happens if &#039;&#039;&#039;all&#039;&#039;&#039; triggers have occurred.&lt;br /&gt;
&lt;br /&gt;
Trigger bits are feature-specific, see below.&lt;br /&gt;
&lt;br /&gt;
Note, that rerandomisation only occurs in the graphics chain, not for callbacks. So, if you use a random action only inside a callback and want to rerandomise the bits, you have to add a &amp;quot;dummy&amp;quot; rerandomisation RA2 into the graphics chain.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
 -1 * -1   02 04 02&lt;br /&gt;
           80                         // random in callback&lt;br /&gt;
           00                         // no triggers&lt;br /&gt;
           00                         // first random bit to use&lt;br /&gt;
           \b 16                      // number of cases&lt;br /&gt;
           \w 10 \w 11 \w 12 \w 13    // random cases&lt;br /&gt;
           \w 14 \w 15 \w 16 \w 17&lt;br /&gt;
           \w 18 \w 19 \w 20 \w 21&lt;br /&gt;
           \w 22 \w 23 \w 24 \w 25&lt;br /&gt;
 &lt;br /&gt;
 -1 * -1   02 04 01&lt;br /&gt;
           85 0C 00 \wx FFFF&lt;br /&gt;
           01&lt;br /&gt;
           \w 2 \w 14 \w 14           // callback 14&lt;br /&gt;
           \w 3                       // graphics chain&lt;br /&gt;
 &lt;br /&gt;
 -1 * -1   02 04 00&lt;br /&gt;
           80                         // dummy random outside callback&lt;br /&gt;
           04                         // train arrival&lt;br /&gt;
           00                         // first bit to rerandomise&lt;br /&gt;
           \b 16                      // number of cases&lt;br /&gt;
           \w 1 \w1 \w 1 \w1          // all cases the same, only for triggering rerandomisation&lt;br /&gt;
           \w 1 \w1 \w 1 \w1&lt;br /&gt;
           \w 1 \w1 \w 1 \w1&lt;br /&gt;
           \w 1 \w1 \w 1 \w1&lt;br /&gt;
 &lt;br /&gt;
 -1 * -1   03 04 01 00 00 \w 0        // action 3&lt;br /&gt;
&lt;br /&gt;
=== randbit ===&lt;br /&gt;
&lt;br /&gt;
{{ottdp|no|&amp;amp;lt;2.5|ttdprev=alpha30}} For versions before TTDPatch 2.0.1 alpha 30, leave this at 00. It doesn&#039;t quite work the way intended (it was supposed to allow independent random chains, but currently everything is re-randomized at the same time, thereby defeating this mechanism).&lt;br /&gt;
&lt;br /&gt;
{{ottdp| |2.5|ttdprev=alpha 30}} Since TTDPatch 2.0.1 alpha 30, only those bits that actually get triggered will be re-randomized. Prior versions always re-randomized all bits. This will make it possible to have independent sets of bits for independent triggers (or untriggered bits, set only at the time of purchase). Setting randbit determines the first bit to be re-randomized, as well as basing the random graphics on. The total number of bits used is the 2-logarithm of nrand below (e.g., for nrand=16, 4 bits are used).&lt;br /&gt;
&lt;br /&gt;
=== nrand ===&lt;br /&gt;
&lt;br /&gt;
Number of different sets to choose from. &amp;amp;nbsp;This must be a power of 2, i.e. 2, 4, 8, 16 etc.&lt;br /&gt;
&lt;br /&gt;
=== set-ids ===&lt;br /&gt;
&lt;br /&gt;
Action 2 IDs to randomly choose from&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|Feature&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|Random bits&lt;br /&gt;
!rowspan=&amp;quot;2&amp;quot;|Triggers&lt;br /&gt;
|-&lt;br /&gt;
!Self!!Related&lt;br /&gt;
|-&lt;br /&gt;
|Vehicles&lt;br /&gt;
|8&lt;br /&gt;
{{ottdp|14.0|no}} 16&lt;br /&gt;
|8 read-only&lt;br /&gt;
{{ottdp|14.0|no}} 16 read-only&lt;br /&gt;
|yes&lt;br /&gt;
|-&lt;br /&gt;
|Stations||16 + 4 &amp;lt;ref name=&amp;quot;stationshared&amp;quot;&amp;gt;16 Bits shared for the whole station/airport (airport and station share the same bits). 4 bits per tile.&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;TTDPatch actually only implements 8 shared random bits (plus 4 per tile). Bits 8-15 are always zero.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|no||yes&lt;br /&gt;
|-&lt;br /&gt;
|Canals||8||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Houses||8||no||yes&lt;br /&gt;
|-&lt;br /&gt;
|Industry tiles||8||16||yes&lt;br /&gt;
|-&lt;br /&gt;
|Industries||16||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Airports||16 &amp;lt;ref name=&amp;quot;stationshared&amp;quot;/&amp;gt;||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Objects||8||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Railtypes||2||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Roadtypes||2||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Tramtypes||2||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Airport tiles||16 + 4 &amp;lt;ref name=&amp;quot;stationshared&amp;quot;/&amp;gt;||no||no&lt;br /&gt;
|-&lt;br /&gt;
|Road stops||16 + 8 &amp;lt;ref name=&amp;quot;stationshared&amp;quot;/&amp;gt;||no||yes&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vehicles ===&lt;br /&gt;
&lt;br /&gt;
Vehicles have 8 random bits, increased to 16 since {{ottdp|14.0|no}}, and the following triggers:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|0.6|2.0}}||Vehicle gets new load of cargo (only after it was empty)&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|0.6|2.0}}||Vehicle enters a depot and is serviced&lt;br /&gt;
|-&lt;br /&gt;
|2||04||{{ottdp|0.6|2.5}}||The consist has unloaded all cargo&lt;br /&gt;
|-&lt;br /&gt;
|3||08||{{ottdp|0.6|2.5}}||Any vehicle of the consist receives cargo&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|0.6|2.5}}||[[Callbacks#32-day callback (32) |Callback 32]] returned 1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The consist trigger bits 2 and 3 allow re-randomizing whenever the consist receives cargo after fully unloading. They should be used with action 2 type 80, not 83, and the random-triggers variable should have 80 added to it, to make the re-randomizing happen only if the consist was empty and &#039;&#039;&#039;then&#039;&#039;&#039; received new cargo.&lt;br /&gt;
&lt;br /&gt;
Vehicles can read the random bits of other vehicles (using random action type 83 or 84), but they can only trigger&lt;br /&gt;
rerandomisation of their own bits. Do not specify any triggers for rerandomisation when accessing random bits of other vehicles (via type 83 or 84), it will not do what you think.&lt;br /&gt;
&lt;br /&gt;
=== Stations ===&lt;br /&gt;
&lt;br /&gt;
Stations have 16+4 random bits. Bits 0 to 15 are a property of the station as a whole, and bits 16 to 19 are different for each tile. &amp;amp;nbsp;To get tile-based randomness, therefore use randbit=10 and nrand of no more than 16 (since only 4 random bits are available per tile).&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|1.3|2.5}}||new cargo waiting&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|1.3|2.5}}||no more cargo&lt;br /&gt;
|-&lt;br /&gt;
|2||04||{{ottdp|1.3|2.5}}||train arrives (starts unloading/loading)&lt;br /&gt;
|-&lt;br /&gt;
|3||08||{{ottdp|1.3|2.5}}||train leaves (done unloading &amp;amp; loading)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.3|2.5}}||train loads or unloads cargo&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.3|2.5}}||train reserves platform (using PBS)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Also note that none of the above triggers will actually trigger unless prop. 12 has at least one bit set. &amp;amp;nbsp;Triggers 01 will be triggered for any of the cargo types set in prop. 12, but trigger 02 will only be triggered if all of those cargo types have no more cargo waiting. Triggers 04, 08 and 20 are triggered no matter what cargo types the train transports, as long as prop. 12 is not zero.&lt;br /&gt;
&lt;br /&gt;
Triggers 04, 08, 10 and 20 only affect the platform on which they occur, as well as the random bits of the station, but not other platforms.&lt;br /&gt;
&lt;br /&gt;
Because the &#039;occured triggers&#039; are only stored once per station (not distinguishing tiles or cargo types), adding 80 to &lt;br /&gt;
random-triggers does not make a lot of sense.&lt;br /&gt;
&lt;br /&gt;
=== Town building triggers ===&lt;br /&gt;
&lt;br /&gt;
Town buildings have 8 random bits.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|0.6|2.5}}||the building tile is processed in the periodic tile processing loop&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|0.6|2.5}}||the top tile of the building is processed in the periodic tile processing loop&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The periodic tile processing loop constantly processes the tiles of the map, processing any given tile in every 256 ticks (approx. 3.5 TTD days). Since no &amp;quot;real&amp;quot; event happens to town buildings, you have only this opportunity to re-randomize the look of your building.&lt;br /&gt;
&lt;br /&gt;
If every 3.5 days is too fast for you, you can multiply the time-out by setting property 16 for the given tile. The time-out is 256 ticks*(prop. 16+1), so 0 means every 3.5 days, 1 means every 7 days, 2 means every 10.5 days and so on.&lt;br /&gt;
&lt;br /&gt;
If trigger 02 is activated, all parts of the building that has this trigger set will get the same random bits, allowing you to randomize a multi-tile building as one unit. On the other hand, if the tiles of a multi-tile building have trigger 1 set, all tiles will be randomized individually. Note that all tiles of a multi-tile building get the same value when building the building.&lt;br /&gt;
&lt;br /&gt;
=== Industry tile triggers ===&lt;br /&gt;
&lt;br /&gt;
Industry tiles have 8+16 random bits. Accessed through random action 2 type 80, you get 8 tile-specific bits, and accessed through random action 2 type 83, you get 16 industry-specific bits. The triggers are the same for both. Triggers 02 and 04 are triggered for all tiles of the industry at once. Every tile can rerandomise both its own random bits and those of the industry. That is every tile can specify some bits of the industry to rerandomize, and the union of all those bits will be rerandomsied at the end.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|0.6|2.5}}||the building tile is processed in the periodic tile processing loop&amp;lt;ref&amp;gt;{{ottdp|no| |}} Rerandomisation of the shared bits of the industry does not happen properly in current TTDPatch.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|0.6|2.5}}||triggers simultaneously for all tiles of the industry every 256 ticks. If the industry is a primary one, output cargo is generated at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|2||04||{{ottdp|0.6|2.5}}||cargo is delivered to the industry. If the industry is a processing one, output cargo is generated at the same time.&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Trigger 1 works similarly to trigger 1 for houses except that you cannot multiply the timeout: it&#039;s always 256 ticks.&lt;br /&gt;
&lt;br /&gt;
Industry tiles can rerandomise both their own random bits as well as the random bits of the industry (via random action type 83).&lt;br /&gt;
The remembered triggers for rerandomisation with 80 added to the triggers are in both cases the same per tile.&lt;br /&gt;
&lt;br /&gt;
Industries have random bits. However, they can only be rerandomised by their tiles.&lt;br /&gt;
&lt;br /&gt;
=== Canals ===&lt;br /&gt;
&lt;br /&gt;
Canals / Rivers have 8 random bits.&lt;br /&gt;
&lt;br /&gt;
There is currently no way to influence the random byte creation via triggers, internally the bits are feed from VarAction2Canals var 83 that is set when building a canal. Feature ids not supported by VarAction2Canals are undefined and should never be used.&lt;br /&gt;
&lt;br /&gt;
=== Objects ===&lt;br /&gt;
&lt;br /&gt;
Objects have 8 random bits per tile of the object.&lt;br /&gt;
&lt;br /&gt;
There are no triggers for objects however.&lt;br /&gt;
&lt;br /&gt;
Also note that the random bits are unique to each tile in the object, and are not shared across the whole object.&lt;br /&gt;
&lt;br /&gt;
=== Railtypes ===&lt;br /&gt;
&lt;br /&gt;
Rail tiles have 2 pseudo random bits, based on tile location.&lt;br /&gt;
&lt;br /&gt;
There are no triggers.&lt;br /&gt;
&lt;br /&gt;
=== Roadtypes ===&lt;br /&gt;
&lt;br /&gt;
Road tiles have 2 pseudo random bits, based on tile location.&lt;br /&gt;
&lt;br /&gt;
There are no triggers.&lt;br /&gt;
&lt;br /&gt;
=== Tramtypes ===&lt;br /&gt;
&lt;br /&gt;
Tram tiles have 2 pseudo random bits, based on tile location.&lt;br /&gt;
&lt;br /&gt;
There are no triggers.&lt;br /&gt;
&lt;br /&gt;
=== Road stops ===&lt;br /&gt;
&lt;br /&gt;
Road stops have 16+8 random bits. Bits 0 to 15 are a property of the station as a whole, and bits 16 to 23 are different for each tile. &amp;amp;nbsp;To get tile-based randomness, therefore use randbit=10 and nrand of no more than 256 (since only 8 random bits are available per tile).&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Version!!Trigger&lt;br /&gt;
|-&lt;br /&gt;
|0||01||{{ottdp|14}}||new cargo waiting&lt;br /&gt;
|-&lt;br /&gt;
|1||02||{{ottdp|14}}||no more cargo&lt;br /&gt;
|-&lt;br /&gt;
|2||04||{{ottdp|14}}||road vehicle arrives (starts unloading/loading)&lt;br /&gt;
|-&lt;br /&gt;
|3||08||{{ottdp|14}}||road vehicle leaves (done unloading &amp;amp; loading)&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|14}}||road vehicle loads or unloads cargo&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Also note that none of the above triggers will actually trigger unless prop. 0D has at least one bit set. &amp;amp;nbsp;Triggers 01 will be triggered for any of the cargo types set in prop. 0D, but trigger 02 will only be triggered if all of those cargo types have no more cargo waiting. Triggers 04 and 08 are triggered no matter what cargo types the road vehicle transports, as long as prop. 0D is not zero.&lt;br /&gt;
&lt;br /&gt;
Triggers 04, 08, and 10 only affect the tile on which they occur, as well as the random bits of the station, but not other tiles.&lt;br /&gt;
&lt;br /&gt;
Because the &#039;occured triggers&#039; are only stored once per station (not distinguishing tiles or cargo types), adding 80 to &lt;br /&gt;
random-triggers does not make a lot of sense.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Other features ===&lt;br /&gt;
&lt;br /&gt;
All features not mentioned in the list above have neither random bits nor triggers, including towns (which would be accessed using random action 2 type 83 for stations and industries).&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Switch&amp;diff=4978</id>
		<title>NML:Switch</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Switch&amp;diff=4978"/>
		<updated>2025-04-14T14:55:14Z</updated>

		<summary type="html">&lt;p&gt;Frosch: update parent scopes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavBlocksyntax}}&lt;br /&gt;
&lt;br /&gt;
 switch (&amp;amp;lt;feature&amp;amp;gt;, (SELF|PARENT), &amp;amp;lt;ID&amp;amp;gt;, &amp;amp;lt;expression&amp;amp;gt;) {&lt;br /&gt;
 	(&amp;amp;lt;range&amp;amp;gt;: &amp;amp;lt;return_value&amp;amp;gt;;)*&lt;br /&gt;
 	&amp;amp;lt;return_value&amp;amp;gt;;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The four parameters have the following meaning:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;&amp;amp;lt;feature&amp;amp;gt;&amp;lt;/code&amp;gt;: The feature for which this switch is used (see [[NML:Features|Features]]).&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;(SELF|PARENT)&amp;lt;/code&amp;gt;: Which variables to use. SELF uses the variables of the item itself, while PARENT uses the variables of a related object. This related object differs per feature, refer to the table below.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;&amp;amp;lt;ID&amp;amp;gt;&amp;lt;/code&amp;gt;: Name of this switch block. This (unique) name can be used to refer to the block from other switch- or graphics-blocks.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;&amp;amp;lt;expression&amp;amp;gt;&amp;lt;/code&amp;gt;: The expression that will be evaluated to make a decision. This expression may contain variables. Instead of a single expression this may also be an array of expressions. In that case all of the array elements are evaluated in order and the last one is used to make a decision.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
! Feature&lt;br /&gt;
! SELF&lt;br /&gt;
! PARENT&lt;br /&gt;
! permanent&amp;lt;br /&amp;gt;storage&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_TRAINS&lt;br /&gt;
| Engine / wagon / articulated part itself&lt;br /&gt;
| Front engine&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_ROADVEHS&lt;br /&gt;
| Road vehicle part&lt;br /&gt;
| First road vehicle part&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_SHIPS&lt;br /&gt;
| Ship&lt;br /&gt;
| Ship&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_AIRCRAFT&lt;br /&gt;
| Aircraft (a)&lt;br /&gt;
| Aircraft&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_STATIONS&lt;br /&gt;
| Station tile&lt;br /&gt;
| Town&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_CANALS&lt;br /&gt;
| Canal tile&lt;br /&gt;
| N/A&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_BRIDGES&lt;br /&gt;
| Bridge&lt;br /&gt;
| Town&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_HOUSES&lt;br /&gt;
| House tile&lt;br /&gt;
| Town&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_GLOBALVARS&lt;br /&gt;
| N/A&lt;br /&gt;
| N/A&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_INDUSTRYTILES&lt;br /&gt;
| Industry tile&lt;br /&gt;
| Industry to which the tile belongs&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_INDUSTRIES&lt;br /&gt;
| Industry&lt;br /&gt;
| Town&lt;br /&gt;
| yes&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_CARGOS&lt;br /&gt;
| Cargo type&lt;br /&gt;
| N/A&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_SOUNDEFFECTS&lt;br /&gt;
| N/A&lt;br /&gt;
| N/A&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_AIRPORTS&lt;br /&gt;
| Airport&lt;br /&gt;
| Town&lt;br /&gt;
| yes&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_SIGNALS&lt;br /&gt;
| N/A&lt;br /&gt;
| N/A&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_OBJECTS&lt;br /&gt;
| Object tile&lt;br /&gt;
| Town&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_RAILTYPES&lt;br /&gt;
| Rail tile&lt;br /&gt;
| N/A&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_AIRPORTTILES&lt;br /&gt;
| Airport tile&lt;br /&gt;
| Airport&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_ROADTYPES&lt;br /&gt;
| Roadtype on tile&lt;br /&gt;
| N/A&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_TRAMTYPES&lt;br /&gt;
| Tramtype on tile&lt;br /&gt;
| N/A&lt;br /&gt;
| no&lt;br /&gt;
|-&lt;br /&gt;
| FEAT_ROADSTOPS&lt;br /&gt;
| Road stop&lt;br /&gt;
| Town&lt;br /&gt;
| no&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
(a) Except for mail capacity callbacks, where it refers to the mail compartment. To refer to the aircraft itself, use PARENT scope there.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;&amp;amp;lt;range&amp;amp;gt;&amp;lt;/code&amp;gt; can either be a single number or two numbers separated by two dots. In the first case, the range matches if the result of the computation is equal to the supplied value. If a range (&amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;a .. b&amp;lt;/code&amp;gt;) is supplied, it matches if the computed result is within that range. If several lines of the switch block match the expression being tested the first applicable result will be returned.&lt;br /&gt;
&lt;br /&gt;
Possible values for &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;&amp;amp;lt;return_value&amp;amp;gt;&amp;lt;/code&amp;gt; are the following:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;&amp;amp;lt;ID&amp;amp;gt;;&amp;lt;/code&amp;gt; chains to the (random-)switch or spritegroup with the given ID.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;return (&amp;amp;lt;expression&amp;amp;gt;|&amp;amp;lt;string&amp;amp;gt;);&amp;lt;/code&amp;gt; returns the given expression or string as a result of the callback. A returned expression may contain variables (with the same scope as the switch block itself), parameter accesses and everything else that a normal switch-expression may contain.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;return;&amp;lt;/code&amp;gt; returns the computed value directly as a callback result. Note that the maximum value for callback results is 32511 (0x7EFF).&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;CB_FAILED;&amp;lt;/code&amp;gt; stops processing and returns an explicit failure code.&lt;br /&gt;
&lt;br /&gt;
Some example code is given below. Note that the code does not have an actual meaning, it is merely meant to demonstrate all the various options available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 switch (FEAT_TRAINS, PARENT, some_vehicle_switch, (position_in_consist + param[1]) % 4) {&lt;br /&gt;
 	0..2: return string(STRING_FOO_BAR); //return a text message&lt;br /&gt;
 	3: return; //return the computed value&lt;br /&gt;
 	5..300: return 42; //42 is always a good answer&lt;br /&gt;
 	400: other_switch; //chain to some other switch block&lt;br /&gt;
 	401: return num_vehs_in_consist + 1; //return a value with a variable access&lt;br /&gt;
 	CB_FAILED; //return a failure result as default&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also use temporary variables and with some features also pemanent variables to store and retrieve some values by means of &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;STORE_TEMP(value, register)&amp;lt;/code&amp;gt;, &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;LOAD_TEMP(register)&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;STORE_PERM(value, register)&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;LOAD_PERM(register[, grfid])&amp;lt;/code&amp;gt; respectively. Using temporary storage is useful when you want to use the result of an expensive calculation in various decisions (switches) within the chain (like for example the number of a certain wagon type within a train). Permanent storage might be useful to control the long-term behaviour of an object. Note that it is only available for industries, airports and towns. For towns, you can optionally specify a grfid to load registers belonging to a different grf. Note that accessing (both reading and writing) permanent town registers thrashes the contents of temporary register 0x100.&lt;br /&gt;
&lt;br /&gt;
{{nml|0.3}} As of NML 0.3 it is possible to specify the default value using &amp;lt;code&amp;gt;default: &amp;amp;lt;value&amp;amp;gt;;&amp;lt;/code&amp;gt; as one of the &#039;ranges&#039;. Specifying multiple default values (either this way or by the classical method) is of course not possible, but omitting a default value is allowed. In that case, if none of the ranges matches, the callback fails.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2/Roadtypes&amp;diff=4977</id>
		<title>VariationalAction2/Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2/Roadtypes&amp;diff=4977"/>
		<updated>2025-04-13T11:29:55Z</updated>

		<summary type="html">&lt;p&gt;Frosch: variable 45&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Variable !![[GRFActionsDetailed|Size]]!!Version  !! Description&lt;br /&gt;
|-&lt;br /&gt;
|40||B||{{ottdp|1.10}}||Terrain type: 0 normal, 1 desert, 2 rainforest, 4 on or above snowline.&lt;br /&gt;
|-&lt;br /&gt;
|41||B||{{ottdp|1.10}}||Enhanced tunnels; entrance has track above. Always 0 in OpenTTD.&lt;br /&gt;
|-&lt;br /&gt;
|42||B||{{ottdp|1.10}}||Level crossing status: 0 if open (or not a crossing), 1 if closed.&lt;br /&gt;
|-&lt;br /&gt;
|43||D||{{ottdp|1.10}}||Depot construction date (long format, 0 based); other: current date&lt;br /&gt;
|-&lt;br /&gt;
|44||B||{{ottdp|1.10}}||[[TownZones|Town zone]] of the tile.&lt;br /&gt;
|-&lt;br /&gt;
|45||D||{{ottdp|15}}||Track types&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
=== Terrain type (40) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Format:&#039;&#039;&#039; byte&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||normal tile&lt;br /&gt;
|-&lt;br /&gt;
|1||desert tile&lt;br /&gt;
|-&lt;br /&gt;
|2||rain forest tile&lt;br /&gt;
|-&lt;br /&gt;
|4||tile on or above snow line&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Enhanced tunnels (41) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Format:&#039;&#039;&#039; byte&lt;br /&gt;
&lt;br /&gt;
This variable will always return 0 and is reserved for future use with enhanced tunnels.&lt;br /&gt;
&lt;br /&gt;
=== Level crossing status (42) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Format:&#039;&#039;&#039; byte&lt;br /&gt;
&lt;br /&gt;
This variable returns 1, if a crossing is closed. If the crossing is open or the tile is no level crossing, the return value is 0.&lt;br /&gt;
&lt;br /&gt;
=== Track types (45) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Format:&#039;&#039;&#039; __RRttrr&lt;br /&gt;
* rr: Translated roadtype.&lt;br /&gt;
* tt: Translated tramtype.&lt;br /&gt;
* RR: Translated railtype.&lt;br /&gt;
* __: reserved for future use&lt;br /&gt;
&lt;br /&gt;
Special values for rr, tt, RR:&lt;br /&gt;
* 0xFF: Track not present on tile.&lt;br /&gt;
* 0xFE: Track present, but no matching entry in translation table.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2/Railtypes&amp;diff=4976</id>
		<title>VariationalAction2/Railtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2/Railtypes&amp;diff=4976"/>
		<updated>2025-04-13T11:29:12Z</updated>

		<summary type="html">&lt;p&gt;Frosch: variable 45&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Variable !![[GRFActionsDetailed|Size]]!!Version  !! Description&lt;br /&gt;
|-&lt;br /&gt;
|10||D||{{ottdp|1.3|ottdrev=r24367}}||Additional information for sprite selection - See [[Action3/Railtypes#Signal_sprites_.280B.29|Action3 Signals]]&lt;br /&gt;
|-&lt;br /&gt;
|18||D||{{ottdp|1.3|ottdrev=r24367}}||Additional information for sprite selection - See [[Action3/Railtypes#Signal_sprites_.280B.29|Action3 Signals]]&lt;br /&gt;
|-&lt;br /&gt;
|40||B||{{ottdp|1.0|ottdrev=r19056}}||Terrain type: 0 normal, 1 desert, 2 rainforest, 4 on or above snowline.&lt;br /&gt;
|-&lt;br /&gt;
|41||B||{{ottdp|1.0|ottdrev=r19056}}||Enhanced tunnels; entrance has track above. Always 0 in OpenTTD.&lt;br /&gt;
|-&lt;br /&gt;
|42||B||{{ottdp|1.0|ottdrev=r19056}}||Level crossing status: 0 if open (or not a crossing), 1 if closed.&lt;br /&gt;
|-&lt;br /&gt;
|43||D||{{ottdp|1.0|ottdrev=r19056}}||Depot construction date (long format, 0 based); other: current date&lt;br /&gt;
|-&lt;br /&gt;
|44||B||{{ottdp|1.2|ottdrev=r23866}}||[[TownZones|Town zone]] of the tile. (Only available for level crossings and depots.)&lt;br /&gt;
|-&lt;br /&gt;
|45||D||{{ottdp|15}}||Track types&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
=== Terrain type (40) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Format:&#039;&#039;&#039; byte&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||normal tile&lt;br /&gt;
|-&lt;br /&gt;
|1||desert tile&lt;br /&gt;
|-&lt;br /&gt;
|2||rain forest tile&lt;br /&gt;
|-&lt;br /&gt;
|4||tile on or above snow line&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Enhanced tunnels (41) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Format:&#039;&#039;&#039; byte&lt;br /&gt;
&lt;br /&gt;
This variable will always return 0 and is reserved for future use with enhanced tunnels.&lt;br /&gt;
&lt;br /&gt;
=== Level crossing status (42) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Format:&#039;&#039;&#039; byte&lt;br /&gt;
&lt;br /&gt;
This variable returns 1, if a crossing is closed. If the crossing is open or the tile is no level crossing, the return value is 0.&lt;br /&gt;
&lt;br /&gt;
=== Track types (45) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Format:&#039;&#039;&#039; __RRttrr&lt;br /&gt;
* rr: Translated roadtype.&lt;br /&gt;
* tt: Translated tramtype.&lt;br /&gt;
* RR: Translated railtype.&lt;br /&gt;
* __: reserved for future use&lt;br /&gt;
&lt;br /&gt;
Special values for rr, tt, RR:&lt;br /&gt;
* 0xFF: Track not present on tile.&lt;br /&gt;
* 0xFE: Track present, but no matching entry in translation table.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Max_tile_sprite_size.png&amp;diff=4975</id>
		<title>File:Max tile sprite size.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Max_tile_sprite_size.png&amp;diff=4975"/>
		<updated>2025-04-04T14:02:33Z</updated>

		<summary type="html">&lt;p&gt;Frosch: Frosch uploaded a new version of File:Max tile sprite size.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Maximum visible size of sprites on tiles.&lt;br /&gt;
Applies since OpenTTD 1.5.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Spritelayout&amp;diff=4974</id>
		<title>NML:Spritelayout</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Spritelayout&amp;diff=4974"/>
		<updated>2025-04-04T13:57:03Z</updated>

		<summary type="html">&lt;p&gt;Frosch: Undo revision 4973 by Frosch (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavBlocksyntax}}&lt;br /&gt;
&lt;br /&gt;
Stations, houses, industry tiles, objects, and airport tiles use spritelayouts to define layouts how sprites are supposed to be arranged on a tile. A &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;spritelayout&amp;lt;/code&amp;gt; can combine multiple sprites into one entity, which represents everything that is to be drawn on a particular tile. A simple example to illustrate how it works:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 spritelayout airport_building1 {&lt;br /&gt;
 	ground { sprite: GROUNDSPRITE_NORMAL; }&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		sprite: spr_small_dirt_ne; // custom spriteset&lt;br /&gt;
 		always_draw: 1; // also draw in transparent mode&lt;br /&gt;
 	}&lt;br /&gt;
 	building {&lt;br /&gt;
 		sprite: 0xA67; // reuse this existing base set sprite&lt;br /&gt;
 		xoffset: 0x0F;&lt;br /&gt;
 		xextent: 1;&lt;br /&gt;
 		zextent: 6;&lt;br /&gt;
 		recolour_mode: RECOLOUR_REMAP;&lt;br /&gt;
 		palette: PALETTE_USE_DEFAULT;&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sprite layout is composed of one or more sprites. Each sprite is defined by a &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt;, &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt; or &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt; block. What block to use depends on how the sprite is to be placed on the tile.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt; sprites are drawn at the base of the tile, like grass and concrete, rails etc. in normal TTD. With a few exceptions (e.g. when using custom foundations), you should always provide a ground sprite, even when the building above fully covers it. This because in transparent mode, the building becomes invisible. A tile can only have one ground sprite.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt; sprites are drawn on top of the ground sprite. To determine their location and drawing order (what goes in front of what), they have a 3D bounding box.&lt;br /&gt;
* With &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt;(s), you can effectively compose sprites from multiple parts. When placing these after a building sprite, they will use the same bounding box as the previous building sprite. When placing them before the first building sprite, they will have no bounding box, as if they would use the &#039;bounding box&#039; of the ground tile. Multiple childsprites may be used per ground / building sprite.&lt;br /&gt;
&lt;br /&gt;
The sprite order is genrally determined by the sprite sorter, that evaluates the bounding box (see below) of each sprite. Child sprites are always part of the building (or ground) sprite that precedes them. In the GUI, sprites are always drawn in the order specified in the layout, so be sure to get this correct for spritelayouts that are to be displayed there.&lt;br /&gt;
&lt;br /&gt;
Per sprite, a number of parameters may be set. These are listed below. Unless otherwise indicated, each may have a value that is dependant on &#039;&#039;&#039;variables, parameters or registers&#039;&#039;&#039;. Accessed variables are always in the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;SELF&amp;lt;/code&amp;gt; scope. Accessing variables inside the purchase list is &#039;&#039;&#039;not&#039;&#039;&#039; supported, make sure that layouts accessed from there do not use them. Using variables and parameters, it&#039;s possible to create wildly differing looks with few spritelayouts.&lt;br /&gt;
&lt;br /&gt;
===Sprite===&lt;br /&gt;
&lt;br /&gt;
The most important parameter is &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt;, this determines the actual sprite to be drawn. If you set this to a number, a TTD sprite will be drawn, usually from the base set. Pre-defined constants for some base set sprites are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_NORMAL&amp;lt;ref name=&amp;quot;spritenames&amp;quot;&amp;gt;These constants can be used for sprites on flat ground. There are also equivalent sprites for sloped ground, however. These sprites follow the initial ground sprite, the [[NML:Builtin functions|builtin function]] &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;slope_to_sprite_offset(&#039;&#039;slope&#039;&#039;)&amp;lt;/code&amp;gt; may be used to compute the required offset. Refer to the reference on [[NML:List of tile slopes|slopes]] or the [[#Example_.28advanced.29_Spritelayout|example]] below.&amp;lt;/ref&amp;gt;&amp;lt;/code&amp;gt; default terrain type for that climate (temperate, toyland: normal, arctic: without snow, tropical: rainforest).&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_DESERT &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; desert tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_DESERT_1_2 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; transition tile between desert and grass&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_1_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; 1/4 snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_2_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; half-snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_3_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; 3/4 snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_4_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_CONCRETE&amp;lt;/code&amp;gt; concrete ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_WATER&amp;lt;/code&amp;gt; flat water tile, automatically choosen from sea, river and canal sprites, including river and canal borders.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_CLEARED &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile that has just been bulldozed (with brown colour)&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_RAIL_X &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile with rail and terrain appropriate ground, NE-SW orientation (provided by railtype)&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_RAIL_Y &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile with rail and terrain appropriate ground, NW-SE orientation (provided by railtype)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can set the value to (the name of) a [[NML:Spriteset|spriteset]], to provide a custom sprite. When the value is just a spriteset identifier, a sprite from that set will be selected depending on the construction stage, see below. All spritesets used in a layout &#039;&#039;&#039;must&#039;&#039;&#039; have the same number of sprites, due to a restriction in the NFO format. If you supply an argument (e.g. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite: some_sprite_set(2);&amp;lt;/code&amp;gt;), the corresponding sprite from the sprite set will be used, with an argument of 0 corresponding to the first sprite. Note that the argument may also be variable, so you could e.g. use &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite: some_set(construction_state);&amp;lt;/code&amp;gt; to use the construction state to select the sprite (as is the default). If the spriteset has labels defined, you can use these labels in the argument expression.&lt;br /&gt;
&lt;br /&gt;
* For stations, objects and airport tiles, there are no construction stages, so the first sprite from the set is used always.&lt;br /&gt;
* For houses and industry tiles, sprite chosen depends on the construction stage and the number of sprites available.&lt;br /&gt;
** If there is only one sprite in the set, it is used always.&lt;br /&gt;
** If there are two sprites, one is used during construction (stages 0-2) and one for the finished building (stage 3)&lt;br /&gt;
** If there are three sprites, one is used for the beginning of construction (stage 0), one for the other construction stages (stages 1-2) and one for the finished building (stage 3).&lt;br /&gt;
** If there are four sprites, one is used for each construction stage.&lt;br /&gt;
** Sprites after the first four are always ignored.&lt;br /&gt;
* For road stops the usage of the ground sprite depends on the [[NML:Roadstops#List of draw mode flags|&#039;&#039;draw_mode&#039;&#039; property]].&lt;br /&gt;
* For objects the usage of the ground sprite may be skipped depending on the [[NML:Objects#List of object flags|&#039;&#039;OBJ_FLAG_DRAW_WATER&#039;&#039; flag]], which has the same effect as &#039;&#039;GROUNDSPRITE_WATER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Recolouring===&lt;br /&gt;
&lt;br /&gt;
Next, you have the option to apply recolouring, i.e. to change the colours of the sprite. This is done via the following attributes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;recolour_mode&amp;lt;/code&amp;gt;: This must be compile-time constant. Available recolour modes are:&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_NONE&amp;lt;/code&amp;gt;: Use no colour translation (default)&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_REMAP&amp;lt;/code&amp;gt;: Use a colour translation table as defined by &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;. This tables maps all colours of the sprite to a new colour.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_TRANSPARENT&amp;lt;/code&amp;gt;: Draw the sprite in transparant mode, using a colour translation table as defined by &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;. Normally the palette will be set to PALETTE_TO_TRANSPARANT to draw all underlying colours somewhat darker. Note that the selected palette is applied to the colours of the underlying sprite, whatever that happens to be. The supplied sprite is only used to determine what pixels to recolour.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;: This defines the palette which is used for the colour translation. It may only (and must!) be set when &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;recolour_mode&amp;lt;/code&amp;gt; is set to &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_REMAP&amp;lt;/code&amp;gt; or &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_TRANSPARENT&amp;lt;/code&amp;gt;. The available values are the same as for &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt;, i.e. you can use either a default sprite or a sprite from a sprite set. In this case, however, the referenced sprite must not be a real sprite, but a [[NML:Recolour sprites|recolour sprite]]. For available default recolour sprites, see the appendix on [[NML:List of default colour translation palettes|available palettes]].&lt;br /&gt;
&lt;br /&gt;
===Display yes/no===&lt;br /&gt;
&lt;br /&gt;
The following attributes allow configuring whether the sprite will be displayed or not.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;hide_sprite&amp;lt;/code&amp;gt;: If set to 1, this sprite will not be drawn at all. Default is 0. If a building sprite is not drawn, all child sprites that share its bounding box are not drawn either. Setting this to a constant value makes little sense, but you can use this to enable/disable drawing certain sprites at runtime depending on certain conditions.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;always_draw&amp;lt;/code&amp;gt;: This must be a compile-time-constant. If set to 1, this sprite will also be drawn when the user has enabled transparant mode. The default value is 0. This is not available for ground sprites (those are drawn always), but it is for child sprites that share their bounding box with the ground sprite.&lt;br /&gt;
&lt;br /&gt;
===Positioning===&lt;br /&gt;
&lt;br /&gt;
How to position the sprite depends on the type of sprite:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt;: Ground sprites cannot be positioned.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt;: A three-dimensional bounding box may be defined. The X-axis runs from top-right to bottom-left and the Y-axis from top-left to bottom-right. Both X and Y are measured in 1/16 length of the the tile border. The Z axis is vertical and measured in pixels.&amp;lt;br/&amp;gt;Extending the bounding box over the edges of a tile is possible, but not recommended as it may lead to glitches. &#039;&#039;&#039;Unless you know exactly what you are doing, please follow the recommendations below. They are most likely exactly what you need&#039;&#039;&#039;.&amp;lt;br/&amp;gt;In NewGRF developer mode in OpenTTD, it&#039;s possible to view the bounding boxes of all sprites by pressing Ctrl+B. In order to use and define a custom bounding box, the following attributes can be used:&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xoffset&amp;lt;/code&amp;gt;: Offset from the northwestern edge to the start of the bounding box (X). Unit is 1/16 of the tile border. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yoffset&amp;lt;/code&amp;gt;: Offset from the northeastern edge to the start of the bounding box (Y). Unit is 1/16 of the tile border. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;zoffset&amp;lt;/code&amp;gt;: Offset from the lowest tile corner (with foundation added) to the start of the bounding box (Z). Unit is pixels. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the X-direction. Must be a compile-time constant. Unit is 1/16 of the tile border. Default value is 16.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the Y-direction. Must be a compile-time constant. Unit is 1/16 of the tile border. Default value is 16.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;zextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the Z-direction. Must be a compile-time constant. Unit is pixels. Default value is 16.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt;: Child sprites may be positioned relative to their &#039;parent&#039; sprite that defines the bounding box. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xoffset&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yoffset&amp;lt;/code&amp;gt; may be set to specify an offset in pixels between the origin of the parent and child sprite. When the parent sprite is the ground sprite, TTDPatch does not support offsets other than 0,0. Note that all child sprites should fit inside the bounding box of the parent sprite to avoid visual glitches.&lt;br /&gt;
&lt;br /&gt;
===Strong recommendations for bounding boxes===&lt;br /&gt;
&lt;br /&gt;
For industries, houses, objects, and non-track station tiles:&lt;br /&gt;
* Use at most one building sprite; and child sprites for everything else.&lt;br /&gt;
** Do not set &#039;&#039;xoffset&#039;&#039;, &#039;&#039;yoffset&#039;&#039; or &#039;&#039;zoffset&#039;&#039;. The default value 0 applies.&lt;br /&gt;
** Do not set &#039;&#039;xextent&#039;&#039; or &#039;&#039;yextent&#039;&#039;. The default value 16 applies.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. The number of occupied height levels is important for objects allowed under bridges. Otherwise this only needs to be a rough estimate.&lt;br /&gt;
* If no sprite visually extends over the ground sprite, you do not need any building sprite: Child sprites can be used for further sprites.&lt;br /&gt;
&lt;br /&gt;
For rail station track tiles:&lt;br /&gt;
* Use child sprites of the ground sprite for things &amp;quot;below the train&amp;quot;.&lt;br /&gt;
* Use exactly two building sprites, possibly with child sprites.&lt;br /&gt;
* The first building sprite is used for things &amp;quot;behind the train&amp;quot;.&lt;br /&gt;
** Set &#039;&#039;xoffset&#039;&#039;, &#039;&#039;yoffset&#039;&#039;, &#039;&#039;zoffset&#039;&#039; to 0.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xextent&#039;&#039; to 16, &#039;&#039;yextent&#039;&#039; to 5.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xextent&#039;&#039; to 5, &#039;&#039;yextent&#039;&#039; to 16.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. A rough estimate is good enough.&lt;br /&gt;
* The second building sprite is used for things &amp;quot;in-front or above the train&amp;quot;.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xoffset&#039;&#039; to 0, &#039;&#039;yoffset&#039;&#039; to 11.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xoffset&#039;&#039; to 11, &#039;&#039;yoffset&#039;&#039; to 0.&lt;br /&gt;
** Set &#039;&#039;zoffset&#039;&#039; to 0.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xextent&#039;&#039; to 16, &#039;&#039;yextent&#039;&#039; to 5.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xextent&#039;&#039; to 5, &#039;&#039;yextent&#039;&#039; to 16.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. A rough estimate is good enough.&lt;br /&gt;
&lt;br /&gt;
===Maximum sprite size===&lt;br /&gt;
&lt;br /&gt;
Ground sprites and their child sprites must not extend over the edges of a regular ground sprite of the slope.&lt;br /&gt;
&lt;br /&gt;
Building sprites and their child sprites:&lt;br /&gt;
* must not extend below the south tile edges,&lt;br /&gt;
* must not extend left/right of the west/east tile corners,&lt;br /&gt;
* must not extend above the north corner by more than 200 pixels including the (default) foundation. If foundations are present, this is reduced by up to 16 pixels (steep slope S) to 184 pixels.&lt;br /&gt;
&lt;br /&gt;
The following image shows the limitations for flat tiles, and the extreme cases of steep slopes:&lt;br /&gt;
&lt;br /&gt;
[[File:Max_tile_sprite_size.png]]&lt;br /&gt;
&lt;br /&gt;
These values apply since {{ottd|1.5}}.&lt;br /&gt;
&lt;br /&gt;
===Example (advanced) Spritelayout===&lt;br /&gt;
&lt;br /&gt;
OpenTTD 1.2 (r22723) allows for nice shorthands in defining multiple views, e.g. for different slopes: Spritelayout can have parameters and may use variables and temporary storage inside of a layout. A common usage for such parametrized spritelayout is taking care of the tile slope and ground type as illustrated in this example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 spritelayout company_land_layout {&lt;br /&gt;
 	ground {&lt;br /&gt;
 		// normal ground sprite - always draw&lt;br /&gt;
 		sprite: LOAD_TEMP(0) + LOAD_TEMP(1);&lt;br /&gt;
 	}&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		// company-coloured border - always draw&lt;br /&gt;
 		sprite:        cc_frame(LOAD_TEMP(0));&lt;br /&gt;
 		always_draw:   1;&lt;br /&gt;
 		recolour_mode: RECOLOUR_REMAP;&lt;br /&gt;
 		palette:       PALETTE_USE_DEFAULT;&lt;br /&gt;
 	}&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		// again the normal ground sprite. Thus in non-transparent view&lt;br /&gt;
 		// only the normal ground sprite is shown. In transparent view&lt;br /&gt;
 		// this acts as sprite which darkens the other two sprites via&lt;br /&gt;
 		// a translation to transparency.&lt;br /&gt;
 		sprite: LOAD_TEMP(0) + LOAD_TEMP(1);&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 // A pseudo-switch which sets the temporary parameters for the sprite layout, storing the sprite number&lt;br /&gt;
 // which belongs to the terrain type and the corresponding offset due to the tile slope&lt;br /&gt;
 switch (FEAT_OBJECTS, SELF, company_land_terrain_switch, [&lt;br /&gt;
 			// We store the offset into the spriteset due to the tile slope into the 1st temporary variable&lt;br /&gt;
 			STORE_TEMP(slope_to_sprite_offset(tile_slope), 0),&lt;br /&gt;
 &lt;br /&gt;
 			// We store the offset to the flat groundsprite we use into the 2nd temporary variable&lt;br /&gt;
 			STORE_TEMP(GROUNDSPRITE_NORMAL, 1),&lt;br /&gt;
 			STORE_TEMP(terrain_type == TILETYPE_DESERT      ? GROUNDSPRITE_DESERT : LOAD_TEMP(1), 1),&lt;br /&gt;
 			STORE_TEMP(terrain_type == TILETYPE_SNOW        ? GROUNDSPRITE_SNOW   : LOAD_TEMP(1), 1),&lt;br /&gt;
 &lt;br /&gt;
 			1&lt;br /&gt;
 			]) {&lt;br /&gt;
 	company_land_layout;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Spritelayout&amp;diff=4973</id>
		<title>NML:Spritelayout</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Spritelayout&amp;diff=4973"/>
		<updated>2025-04-04T13:47:45Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Maximum sprite size */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavBlocksyntax}}&lt;br /&gt;
&lt;br /&gt;
Stations, houses, industry tiles, objects, and airport tiles use spritelayouts to define layouts how sprites are supposed to be arranged on a tile. A &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;spritelayout&amp;lt;/code&amp;gt; can combine multiple sprites into one entity, which represents everything that is to be drawn on a particular tile. A simple example to illustrate how it works:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 spritelayout airport_building1 {&lt;br /&gt;
 	ground { sprite: GROUNDSPRITE_NORMAL; }&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		sprite: spr_small_dirt_ne; // custom spriteset&lt;br /&gt;
 		always_draw: 1; // also draw in transparent mode&lt;br /&gt;
 	}&lt;br /&gt;
 	building {&lt;br /&gt;
 		sprite: 0xA67; // reuse this existing base set sprite&lt;br /&gt;
 		xoffset: 0x0F;&lt;br /&gt;
 		xextent: 1;&lt;br /&gt;
 		zextent: 6;&lt;br /&gt;
 		recolour_mode: RECOLOUR_REMAP;&lt;br /&gt;
 		palette: PALETTE_USE_DEFAULT;&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sprite layout is composed of one or more sprites. Each sprite is defined by a &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt;, &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt; or &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt; block. What block to use depends on how the sprite is to be placed on the tile.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt; sprites are drawn at the base of the tile, like grass and concrete, rails etc. in normal TTD. With a few exceptions (e.g. when using custom foundations), you should always provide a ground sprite, even when the building above fully covers it. This because in transparent mode, the building becomes invisible. A tile can only have one ground sprite.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt; sprites are drawn on top of the ground sprite. To determine their location and drawing order (what goes in front of what), they have a 3D bounding box.&lt;br /&gt;
* With &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt;(s), you can effectively compose sprites from multiple parts. When placing these after a building sprite, they will use the same bounding box as the previous building sprite. When placing them before the first building sprite, they will have no bounding box, as if they would use the &#039;bounding box&#039; of the ground tile. Multiple childsprites may be used per ground / building sprite.&lt;br /&gt;
&lt;br /&gt;
The sprite order is genrally determined by the sprite sorter, that evaluates the bounding box (see below) of each sprite. Child sprites are always part of the building (or ground) sprite that precedes them. In the GUI, sprites are always drawn in the order specified in the layout, so be sure to get this correct for spritelayouts that are to be displayed there.&lt;br /&gt;
&lt;br /&gt;
Per sprite, a number of parameters may be set. These are listed below. Unless otherwise indicated, each may have a value that is dependant on &#039;&#039;&#039;variables, parameters or registers&#039;&#039;&#039;. Accessed variables are always in the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;SELF&amp;lt;/code&amp;gt; scope. Accessing variables inside the purchase list is &#039;&#039;&#039;not&#039;&#039;&#039; supported, make sure that layouts accessed from there do not use them. Using variables and parameters, it&#039;s possible to create wildly differing looks with few spritelayouts.&lt;br /&gt;
&lt;br /&gt;
===Sprite===&lt;br /&gt;
&lt;br /&gt;
The most important parameter is &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt;, this determines the actual sprite to be drawn. If you set this to a number, a TTD sprite will be drawn, usually from the base set. Pre-defined constants for some base set sprites are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_NORMAL&amp;lt;ref name=&amp;quot;spritenames&amp;quot;&amp;gt;These constants can be used for sprites on flat ground. There are also equivalent sprites for sloped ground, however. These sprites follow the initial ground sprite, the [[NML:Builtin functions|builtin function]] &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;slope_to_sprite_offset(&#039;&#039;slope&#039;&#039;)&amp;lt;/code&amp;gt; may be used to compute the required offset. Refer to the reference on [[NML:List of tile slopes|slopes]] or the [[#Example_.28advanced.29_Spritelayout|example]] below.&amp;lt;/ref&amp;gt;&amp;lt;/code&amp;gt; default terrain type for that climate (temperate, toyland: normal, arctic: without snow, tropical: rainforest).&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_DESERT &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; desert tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_DESERT_1_2 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; transition tile between desert and grass&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_1_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; 1/4 snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_2_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; half-snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_3_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; 3/4 snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_4_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_CONCRETE&amp;lt;/code&amp;gt; concrete ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_WATER&amp;lt;/code&amp;gt; flat water tile, automatically choosen from sea, river and canal sprites, including river and canal borders.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_CLEARED &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile that has just been bulldozed (with brown colour)&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_RAIL_X &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile with rail and terrain appropriate ground, NE-SW orientation (provided by railtype)&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_RAIL_Y &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile with rail and terrain appropriate ground, NW-SE orientation (provided by railtype)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can set the value to (the name of) a [[NML:Spriteset|spriteset]], to provide a custom sprite. When the value is just a spriteset identifier, a sprite from that set will be selected depending on the construction stage, see below. All spritesets used in a layout &#039;&#039;&#039;must&#039;&#039;&#039; have the same number of sprites, due to a restriction in the NFO format. If you supply an argument (e.g. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite: some_sprite_set(2);&amp;lt;/code&amp;gt;), the corresponding sprite from the sprite set will be used, with an argument of 0 corresponding to the first sprite. Note that the argument may also be variable, so you could e.g. use &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite: some_set(construction_state);&amp;lt;/code&amp;gt; to use the construction state to select the sprite (as is the default). If the spriteset has labels defined, you can use these labels in the argument expression.&lt;br /&gt;
&lt;br /&gt;
* For stations, objects and airport tiles, there are no construction stages, so the first sprite from the set is used always.&lt;br /&gt;
* For houses and industry tiles, sprite chosen depends on the construction stage and the number of sprites available.&lt;br /&gt;
** If there is only one sprite in the set, it is used always.&lt;br /&gt;
** If there are two sprites, one is used during construction (stages 0-2) and one for the finished building (stage 3)&lt;br /&gt;
** If there are three sprites, one is used for the beginning of construction (stage 0), one for the other construction stages (stages 1-2) and one for the finished building (stage 3).&lt;br /&gt;
** If there are four sprites, one is used for each construction stage.&lt;br /&gt;
** Sprites after the first four are always ignored.&lt;br /&gt;
* For road stops the usage of the ground sprite depends on the [[NML:Roadstops#List of draw mode flags|&#039;&#039;draw_mode&#039;&#039; property]].&lt;br /&gt;
* For objects the usage of the ground sprite may be skipped depending on the [[NML:Objects#List of object flags|&#039;&#039;OBJ_FLAG_DRAW_WATER&#039;&#039; flag]], which has the same effect as &#039;&#039;GROUNDSPRITE_WATER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Recolouring===&lt;br /&gt;
&lt;br /&gt;
Next, you have the option to apply recolouring, i.e. to change the colours of the sprite. This is done via the following attributes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;recolour_mode&amp;lt;/code&amp;gt;: This must be compile-time constant. Available recolour modes are:&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_NONE&amp;lt;/code&amp;gt;: Use no colour translation (default)&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_REMAP&amp;lt;/code&amp;gt;: Use a colour translation table as defined by &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;. This tables maps all colours of the sprite to a new colour.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_TRANSPARENT&amp;lt;/code&amp;gt;: Draw the sprite in transparant mode, using a colour translation table as defined by &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;. Normally the palette will be set to PALETTE_TO_TRANSPARANT to draw all underlying colours somewhat darker. Note that the selected palette is applied to the colours of the underlying sprite, whatever that happens to be. The supplied sprite is only used to determine what pixels to recolour.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;: This defines the palette which is used for the colour translation. It may only (and must!) be set when &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;recolour_mode&amp;lt;/code&amp;gt; is set to &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_REMAP&amp;lt;/code&amp;gt; or &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_TRANSPARENT&amp;lt;/code&amp;gt;. The available values are the same as for &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt;, i.e. you can use either a default sprite or a sprite from a sprite set. In this case, however, the referenced sprite must not be a real sprite, but a [[NML:Recolour sprites|recolour sprite]]. For available default recolour sprites, see the appendix on [[NML:List of default colour translation palettes|available palettes]].&lt;br /&gt;
&lt;br /&gt;
===Display yes/no===&lt;br /&gt;
&lt;br /&gt;
The following attributes allow configuring whether the sprite will be displayed or not.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;hide_sprite&amp;lt;/code&amp;gt;: If set to 1, this sprite will not be drawn at all. Default is 0. If a building sprite is not drawn, all child sprites that share its bounding box are not drawn either. Setting this to a constant value makes little sense, but you can use this to enable/disable drawing certain sprites at runtime depending on certain conditions.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;always_draw&amp;lt;/code&amp;gt;: This must be a compile-time-constant. If set to 1, this sprite will also be drawn when the user has enabled transparant mode. The default value is 0. This is not available for ground sprites (those are drawn always), but it is for child sprites that share their bounding box with the ground sprite.&lt;br /&gt;
&lt;br /&gt;
===Positioning===&lt;br /&gt;
&lt;br /&gt;
How to position the sprite depends on the type of sprite:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt;: Ground sprites cannot be positioned.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt;: A three-dimensional bounding box may be defined. The X-axis runs from top-right to bottom-left and the Y-axis from top-left to bottom-right. Both X and Y are measured in 1/16 length of the the tile border. The Z axis is vertical and measured in pixels.&amp;lt;br/&amp;gt;Extending the bounding box over the edges of a tile is possible, but not recommended as it may lead to glitches. &#039;&#039;&#039;Unless you know exactly what you are doing, please follow the recommendations below. They are most likely exactly what you need&#039;&#039;&#039;.&amp;lt;br/&amp;gt;In NewGRF developer mode in OpenTTD, it&#039;s possible to view the bounding boxes of all sprites by pressing Ctrl+B. In order to use and define a custom bounding box, the following attributes can be used:&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xoffset&amp;lt;/code&amp;gt;: Offset from the northwestern edge to the start of the bounding box (X). Unit is 1/16 of the tile border. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yoffset&amp;lt;/code&amp;gt;: Offset from the northeastern edge to the start of the bounding box (Y). Unit is 1/16 of the tile border. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;zoffset&amp;lt;/code&amp;gt;: Offset from the lowest tile corner (with foundation added) to the start of the bounding box (Z). Unit is pixels. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the X-direction. Must be a compile-time constant. Unit is 1/16 of the tile border. Default value is 16.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the Y-direction. Must be a compile-time constant. Unit is 1/16 of the tile border. Default value is 16.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;zextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the Z-direction. Must be a compile-time constant. Unit is pixels. Default value is 16.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt;: Child sprites may be positioned relative to their &#039;parent&#039; sprite that defines the bounding box. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xoffset&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yoffset&amp;lt;/code&amp;gt; may be set to specify an offset in pixels between the origin of the parent and child sprite. When the parent sprite is the ground sprite, TTDPatch does not support offsets other than 0,0. Note that all child sprites should fit inside the bounding box of the parent sprite to avoid visual glitches.&lt;br /&gt;
&lt;br /&gt;
===Strong recommendations for bounding boxes===&lt;br /&gt;
&lt;br /&gt;
For industries, houses, objects, and non-track station tiles:&lt;br /&gt;
* Use at most one building sprite; and child sprites for everything else.&lt;br /&gt;
** Do not set &#039;&#039;xoffset&#039;&#039;, &#039;&#039;yoffset&#039;&#039; or &#039;&#039;zoffset&#039;&#039;. The default value 0 applies.&lt;br /&gt;
** Do not set &#039;&#039;xextent&#039;&#039; or &#039;&#039;yextent&#039;&#039;. The default value 16 applies.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. The number of occupied height levels is important for objects allowed under bridges. Otherwise this only needs to be a rough estimate.&lt;br /&gt;
* If no sprite visually extends over the ground sprite, you do not need any building sprite: Child sprites can be used for further sprites.&lt;br /&gt;
&lt;br /&gt;
For rail station track tiles:&lt;br /&gt;
* Use child sprites of the ground sprite for things &amp;quot;below the train&amp;quot;.&lt;br /&gt;
* Use exactly two building sprites, possibly with child sprites.&lt;br /&gt;
* The first building sprite is used for things &amp;quot;behind the train&amp;quot;.&lt;br /&gt;
** Set &#039;&#039;xoffset&#039;&#039;, &#039;&#039;yoffset&#039;&#039;, &#039;&#039;zoffset&#039;&#039; to 0.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xextent&#039;&#039; to 16, &#039;&#039;yextent&#039;&#039; to 5.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xextent&#039;&#039; to 5, &#039;&#039;yextent&#039;&#039; to 16.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. A rough estimate is good enough.&lt;br /&gt;
* The second building sprite is used for things &amp;quot;in-front or above the train&amp;quot;.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xoffset&#039;&#039; to 0, &#039;&#039;yoffset&#039;&#039; to 11.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xoffset&#039;&#039; to 11, &#039;&#039;yoffset&#039;&#039; to 0.&lt;br /&gt;
** Set &#039;&#039;zoffset&#039;&#039; to 0.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xextent&#039;&#039; to 16, &#039;&#039;yextent&#039;&#039; to 5.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xextent&#039;&#039; to 5, &#039;&#039;yextent&#039;&#039; to 16.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. A rough estimate is good enough.&lt;br /&gt;
&lt;br /&gt;
===Maximum sprite size===&lt;br /&gt;
&lt;br /&gt;
Ground sprites and their child sprites must not extend over the edges of a regular ground sprite of the slope.&lt;br /&gt;
&lt;br /&gt;
Building sprites and their child sprites:&lt;br /&gt;
* must not extend below the south tile edges,&lt;br /&gt;
* must not extend left/right of the west/east tile corners,&lt;br /&gt;
* must not extend above the north corner by more than 200 pixels including the (default) foundation. If foundations are present, this is reduced by up to 16 pixels (steep slope N) to 184 pixels.&lt;br /&gt;
&lt;br /&gt;
The following image shows the limitations for flat tiles, and the extreme cases of steep slopes:&lt;br /&gt;
&lt;br /&gt;
[[File:Max_tile_sprite_size.png]]&lt;br /&gt;
&lt;br /&gt;
These values apply since {{ottd|1.5}}.&lt;br /&gt;
&lt;br /&gt;
===Example (advanced) Spritelayout===&lt;br /&gt;
&lt;br /&gt;
OpenTTD 1.2 (r22723) allows for nice shorthands in defining multiple views, e.g. for different slopes: Spritelayout can have parameters and may use variables and temporary storage inside of a layout. A common usage for such parametrized spritelayout is taking care of the tile slope and ground type as illustrated in this example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 spritelayout company_land_layout {&lt;br /&gt;
 	ground {&lt;br /&gt;
 		// normal ground sprite - always draw&lt;br /&gt;
 		sprite: LOAD_TEMP(0) + LOAD_TEMP(1);&lt;br /&gt;
 	}&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		// company-coloured border - always draw&lt;br /&gt;
 		sprite:        cc_frame(LOAD_TEMP(0));&lt;br /&gt;
 		always_draw:   1;&lt;br /&gt;
 		recolour_mode: RECOLOUR_REMAP;&lt;br /&gt;
 		palette:       PALETTE_USE_DEFAULT;&lt;br /&gt;
 	}&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		// again the normal ground sprite. Thus in non-transparent view&lt;br /&gt;
 		// only the normal ground sprite is shown. In transparent view&lt;br /&gt;
 		// this acts as sprite which darkens the other two sprites via&lt;br /&gt;
 		// a translation to transparency.&lt;br /&gt;
 		sprite: LOAD_TEMP(0) + LOAD_TEMP(1);&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 // A pseudo-switch which sets the temporary parameters for the sprite layout, storing the sprite number&lt;br /&gt;
 // which belongs to the terrain type and the corresponding offset due to the tile slope&lt;br /&gt;
 switch (FEAT_OBJECTS, SELF, company_land_terrain_switch, [&lt;br /&gt;
 			// We store the offset into the spriteset due to the tile slope into the 1st temporary variable&lt;br /&gt;
 			STORE_TEMP(slope_to_sprite_offset(tile_slope), 0),&lt;br /&gt;
 &lt;br /&gt;
 			// We store the offset to the flat groundsprite we use into the 2nd temporary variable&lt;br /&gt;
 			STORE_TEMP(GROUNDSPRITE_NORMAL, 1),&lt;br /&gt;
 			STORE_TEMP(terrain_type == TILETYPE_DESERT      ? GROUNDSPRITE_DESERT : LOAD_TEMP(1), 1),&lt;br /&gt;
 			STORE_TEMP(terrain_type == TILETYPE_SNOW        ? GROUNDSPRITE_SNOW   : LOAD_TEMP(1), 1),&lt;br /&gt;
 &lt;br /&gt;
 			1&lt;br /&gt;
 			]) {&lt;br /&gt;
 	company_land_layout;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Spritelayout&amp;diff=4972</id>
		<title>NML:Spritelayout</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Spritelayout&amp;diff=4972"/>
		<updated>2025-04-04T13:38:50Z</updated>

		<summary type="html">&lt;p&gt;Frosch: /* Maximum sprite size */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavBlocksyntax}}&lt;br /&gt;
&lt;br /&gt;
Stations, houses, industry tiles, objects, and airport tiles use spritelayouts to define layouts how sprites are supposed to be arranged on a tile. A &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;spritelayout&amp;lt;/code&amp;gt; can combine multiple sprites into one entity, which represents everything that is to be drawn on a particular tile. A simple example to illustrate how it works:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 spritelayout airport_building1 {&lt;br /&gt;
 	ground { sprite: GROUNDSPRITE_NORMAL; }&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		sprite: spr_small_dirt_ne; // custom spriteset&lt;br /&gt;
 		always_draw: 1; // also draw in transparent mode&lt;br /&gt;
 	}&lt;br /&gt;
 	building {&lt;br /&gt;
 		sprite: 0xA67; // reuse this existing base set sprite&lt;br /&gt;
 		xoffset: 0x0F;&lt;br /&gt;
 		xextent: 1;&lt;br /&gt;
 		zextent: 6;&lt;br /&gt;
 		recolour_mode: RECOLOUR_REMAP;&lt;br /&gt;
 		palette: PALETTE_USE_DEFAULT;&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sprite layout is composed of one or more sprites. Each sprite is defined by a &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt;, &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt; or &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt; block. What block to use depends on how the sprite is to be placed on the tile.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt; sprites are drawn at the base of the tile, like grass and concrete, rails etc. in normal TTD. With a few exceptions (e.g. when using custom foundations), you should always provide a ground sprite, even when the building above fully covers it. This because in transparent mode, the building becomes invisible. A tile can only have one ground sprite.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt; sprites are drawn on top of the ground sprite. To determine their location and drawing order (what goes in front of what), they have a 3D bounding box.&lt;br /&gt;
* With &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt;(s), you can effectively compose sprites from multiple parts. When placing these after a building sprite, they will use the same bounding box as the previous building sprite. When placing them before the first building sprite, they will have no bounding box, as if they would use the &#039;bounding box&#039; of the ground tile. Multiple childsprites may be used per ground / building sprite.&lt;br /&gt;
&lt;br /&gt;
The sprite order is genrally determined by the sprite sorter, that evaluates the bounding box (see below) of each sprite. Child sprites are always part of the building (or ground) sprite that precedes them. In the GUI, sprites are always drawn in the order specified in the layout, so be sure to get this correct for spritelayouts that are to be displayed there.&lt;br /&gt;
&lt;br /&gt;
Per sprite, a number of parameters may be set. These are listed below. Unless otherwise indicated, each may have a value that is dependant on &#039;&#039;&#039;variables, parameters or registers&#039;&#039;&#039;. Accessed variables are always in the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;SELF&amp;lt;/code&amp;gt; scope. Accessing variables inside the purchase list is &#039;&#039;&#039;not&#039;&#039;&#039; supported, make sure that layouts accessed from there do not use them. Using variables and parameters, it&#039;s possible to create wildly differing looks with few spritelayouts.&lt;br /&gt;
&lt;br /&gt;
===Sprite===&lt;br /&gt;
&lt;br /&gt;
The most important parameter is &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt;, this determines the actual sprite to be drawn. If you set this to a number, a TTD sprite will be drawn, usually from the base set. Pre-defined constants for some base set sprites are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_NORMAL&amp;lt;ref name=&amp;quot;spritenames&amp;quot;&amp;gt;These constants can be used for sprites on flat ground. There are also equivalent sprites for sloped ground, however. These sprites follow the initial ground sprite, the [[NML:Builtin functions|builtin function]] &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;slope_to_sprite_offset(&#039;&#039;slope&#039;&#039;)&amp;lt;/code&amp;gt; may be used to compute the required offset. Refer to the reference on [[NML:List of tile slopes|slopes]] or the [[#Example_.28advanced.29_Spritelayout|example]] below.&amp;lt;/ref&amp;gt;&amp;lt;/code&amp;gt; default terrain type for that climate (temperate, toyland: normal, arctic: without snow, tropical: rainforest).&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_DESERT &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; desert tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_DESERT_1_2 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; transition tile between desert and grass&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_1_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; 1/4 snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_2_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; half-snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_3_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; 3/4 snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_4_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_CONCRETE&amp;lt;/code&amp;gt; concrete ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_WATER&amp;lt;/code&amp;gt; flat water tile, automatically choosen from sea, river and canal sprites, including river and canal borders.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_CLEARED &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile that has just been bulldozed (with brown colour)&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_RAIL_X &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile with rail and terrain appropriate ground, NE-SW orientation (provided by railtype)&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_RAIL_Y &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile with rail and terrain appropriate ground, NW-SE orientation (provided by railtype)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can set the value to (the name of) a [[NML:Spriteset|spriteset]], to provide a custom sprite. When the value is just a spriteset identifier, a sprite from that set will be selected depending on the construction stage, see below. All spritesets used in a layout &#039;&#039;&#039;must&#039;&#039;&#039; have the same number of sprites, due to a restriction in the NFO format. If you supply an argument (e.g. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite: some_sprite_set(2);&amp;lt;/code&amp;gt;), the corresponding sprite from the sprite set will be used, with an argument of 0 corresponding to the first sprite. Note that the argument may also be variable, so you could e.g. use &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite: some_set(construction_state);&amp;lt;/code&amp;gt; to use the construction state to select the sprite (as is the default). If the spriteset has labels defined, you can use these labels in the argument expression.&lt;br /&gt;
&lt;br /&gt;
* For stations, objects and airport tiles, there are no construction stages, so the first sprite from the set is used always.&lt;br /&gt;
* For houses and industry tiles, sprite chosen depends on the construction stage and the number of sprites available.&lt;br /&gt;
** If there is only one sprite in the set, it is used always.&lt;br /&gt;
** If there are two sprites, one is used during construction (stages 0-2) and one for the finished building (stage 3)&lt;br /&gt;
** If there are three sprites, one is used for the beginning of construction (stage 0), one for the other construction stages (stages 1-2) and one for the finished building (stage 3).&lt;br /&gt;
** If there are four sprites, one is used for each construction stage.&lt;br /&gt;
** Sprites after the first four are always ignored.&lt;br /&gt;
* For road stops the usage of the ground sprite depends on the [[NML:Roadstops#List of draw mode flags|&#039;&#039;draw_mode&#039;&#039; property]].&lt;br /&gt;
* For objects the usage of the ground sprite may be skipped depending on the [[NML:Objects#List of object flags|&#039;&#039;OBJ_FLAG_DRAW_WATER&#039;&#039; flag]], which has the same effect as &#039;&#039;GROUNDSPRITE_WATER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Recolouring===&lt;br /&gt;
&lt;br /&gt;
Next, you have the option to apply recolouring, i.e. to change the colours of the sprite. This is done via the following attributes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;recolour_mode&amp;lt;/code&amp;gt;: This must be compile-time constant. Available recolour modes are:&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_NONE&amp;lt;/code&amp;gt;: Use no colour translation (default)&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_REMAP&amp;lt;/code&amp;gt;: Use a colour translation table as defined by &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;. This tables maps all colours of the sprite to a new colour.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_TRANSPARENT&amp;lt;/code&amp;gt;: Draw the sprite in transparant mode, using a colour translation table as defined by &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;. Normally the palette will be set to PALETTE_TO_TRANSPARANT to draw all underlying colours somewhat darker. Note that the selected palette is applied to the colours of the underlying sprite, whatever that happens to be. The supplied sprite is only used to determine what pixels to recolour.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;: This defines the palette which is used for the colour translation. It may only (and must!) be set when &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;recolour_mode&amp;lt;/code&amp;gt; is set to &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_REMAP&amp;lt;/code&amp;gt; or &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_TRANSPARENT&amp;lt;/code&amp;gt;. The available values are the same as for &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt;, i.e. you can use either a default sprite or a sprite from a sprite set. In this case, however, the referenced sprite must not be a real sprite, but a [[NML:Recolour sprites|recolour sprite]]. For available default recolour sprites, see the appendix on [[NML:List of default colour translation palettes|available palettes]].&lt;br /&gt;
&lt;br /&gt;
===Display yes/no===&lt;br /&gt;
&lt;br /&gt;
The following attributes allow configuring whether the sprite will be displayed or not.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;hide_sprite&amp;lt;/code&amp;gt;: If set to 1, this sprite will not be drawn at all. Default is 0. If a building sprite is not drawn, all child sprites that share its bounding box are not drawn either. Setting this to a constant value makes little sense, but you can use this to enable/disable drawing certain sprites at runtime depending on certain conditions.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;always_draw&amp;lt;/code&amp;gt;: This must be a compile-time-constant. If set to 1, this sprite will also be drawn when the user has enabled transparant mode. The default value is 0. This is not available for ground sprites (those are drawn always), but it is for child sprites that share their bounding box with the ground sprite.&lt;br /&gt;
&lt;br /&gt;
===Positioning===&lt;br /&gt;
&lt;br /&gt;
How to position the sprite depends on the type of sprite:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt;: Ground sprites cannot be positioned.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt;: A three-dimensional bounding box may be defined. The X-axis runs from top-right to bottom-left and the Y-axis from top-left to bottom-right. Both X and Y are measured in 1/16 length of the the tile border. The Z axis is vertical and measured in pixels.&amp;lt;br/&amp;gt;Extending the bounding box over the edges of a tile is possible, but not recommended as it may lead to glitches. &#039;&#039;&#039;Unless you know exactly what you are doing, please follow the recommendations below. They are most likely exactly what you need&#039;&#039;&#039;.&amp;lt;br/&amp;gt;In NewGRF developer mode in OpenTTD, it&#039;s possible to view the bounding boxes of all sprites by pressing Ctrl+B. In order to use and define a custom bounding box, the following attributes can be used:&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xoffset&amp;lt;/code&amp;gt;: Offset from the northwestern edge to the start of the bounding box (X). Unit is 1/16 of the tile border. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yoffset&amp;lt;/code&amp;gt;: Offset from the northeastern edge to the start of the bounding box (Y). Unit is 1/16 of the tile border. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;zoffset&amp;lt;/code&amp;gt;: Offset from the lowest tile corner (with foundation added) to the start of the bounding box (Z). Unit is pixels. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the X-direction. Must be a compile-time constant. Unit is 1/16 of the tile border. Default value is 16.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the Y-direction. Must be a compile-time constant. Unit is 1/16 of the tile border. Default value is 16.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;zextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the Z-direction. Must be a compile-time constant. Unit is pixels. Default value is 16.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt;: Child sprites may be positioned relative to their &#039;parent&#039; sprite that defines the bounding box. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xoffset&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yoffset&amp;lt;/code&amp;gt; may be set to specify an offset in pixels between the origin of the parent and child sprite. When the parent sprite is the ground sprite, TTDPatch does not support offsets other than 0,0. Note that all child sprites should fit inside the bounding box of the parent sprite to avoid visual glitches.&lt;br /&gt;
&lt;br /&gt;
===Strong recommendations for bounding boxes===&lt;br /&gt;
&lt;br /&gt;
For industries, houses, objects, and non-track station tiles:&lt;br /&gt;
* Use at most one building sprite; and child sprites for everything else.&lt;br /&gt;
** Do not set &#039;&#039;xoffset&#039;&#039;, &#039;&#039;yoffset&#039;&#039; or &#039;&#039;zoffset&#039;&#039;. The default value 0 applies.&lt;br /&gt;
** Do not set &#039;&#039;xextent&#039;&#039; or &#039;&#039;yextent&#039;&#039;. The default value 16 applies.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. The number of occupied height levels is important for objects allowed under bridges. Otherwise this only needs to be a rough estimate.&lt;br /&gt;
* If no sprite visually extends over the ground sprite, you do not need any building sprite: Child sprites can be used for further sprites.&lt;br /&gt;
&lt;br /&gt;
For rail station track tiles:&lt;br /&gt;
* Use child sprites of the ground sprite for things &amp;quot;below the train&amp;quot;.&lt;br /&gt;
* Use exactly two building sprites, possibly with child sprites.&lt;br /&gt;
* The first building sprite is used for things &amp;quot;behind the train&amp;quot;.&lt;br /&gt;
** Set &#039;&#039;xoffset&#039;&#039;, &#039;&#039;yoffset&#039;&#039;, &#039;&#039;zoffset&#039;&#039; to 0.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xextent&#039;&#039; to 16, &#039;&#039;yextent&#039;&#039; to 5.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xextent&#039;&#039; to 5, &#039;&#039;yextent&#039;&#039; to 16.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. A rough estimate is good enough.&lt;br /&gt;
* The second building sprite is used for things &amp;quot;in-front or above the train&amp;quot;.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xoffset&#039;&#039; to 0, &#039;&#039;yoffset&#039;&#039; to 11.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xoffset&#039;&#039; to 11, &#039;&#039;yoffset&#039;&#039; to 0.&lt;br /&gt;
** Set &#039;&#039;zoffset&#039;&#039; to 0.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xextent&#039;&#039; to 16, &#039;&#039;yextent&#039;&#039; to 5.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xextent&#039;&#039; to 5, &#039;&#039;yextent&#039;&#039; to 16.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. A rough estimate is good enough.&lt;br /&gt;
&lt;br /&gt;
===Maximum sprite size===&lt;br /&gt;
&lt;br /&gt;
Ground sprites and their child sprites must not extend over the edges of a regular ground sprite of the slope.&lt;br /&gt;
&lt;br /&gt;
Building sprites and their child sprites:&lt;br /&gt;
* must not extend below the south tile edges,&lt;br /&gt;
* must not extend left/right of the west/east tile corners,&lt;br /&gt;
* must not extend above the north corner by more than 200 pixels including the (default) foundation. If foundations are present, this is reduced by up to 16 pixels (steep slope S) to 184 pixels.&lt;br /&gt;
&lt;br /&gt;
The following image shows the limitations for flat tiles, and the extreme cases of steep slopes:&lt;br /&gt;
&lt;br /&gt;
[[File:Max_tile_sprite_size.png]]&lt;br /&gt;
&lt;br /&gt;
These values apply since {{ottd|1.5}}.&lt;br /&gt;
&lt;br /&gt;
===Example (advanced) Spritelayout===&lt;br /&gt;
&lt;br /&gt;
OpenTTD 1.2 (r22723) allows for nice shorthands in defining multiple views, e.g. for different slopes: Spritelayout can have parameters and may use variables and temporary storage inside of a layout. A common usage for such parametrized spritelayout is taking care of the tile slope and ground type as illustrated in this example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 spritelayout company_land_layout {&lt;br /&gt;
 	ground {&lt;br /&gt;
 		// normal ground sprite - always draw&lt;br /&gt;
 		sprite: LOAD_TEMP(0) + LOAD_TEMP(1);&lt;br /&gt;
 	}&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		// company-coloured border - always draw&lt;br /&gt;
 		sprite:        cc_frame(LOAD_TEMP(0));&lt;br /&gt;
 		always_draw:   1;&lt;br /&gt;
 		recolour_mode: RECOLOUR_REMAP;&lt;br /&gt;
 		palette:       PALETTE_USE_DEFAULT;&lt;br /&gt;
 	}&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		// again the normal ground sprite. Thus in non-transparent view&lt;br /&gt;
 		// only the normal ground sprite is shown. In transparent view&lt;br /&gt;
 		// this acts as sprite which darkens the other two sprites via&lt;br /&gt;
 		// a translation to transparency.&lt;br /&gt;
 		sprite: LOAD_TEMP(0) + LOAD_TEMP(1);&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 // A pseudo-switch which sets the temporary parameters for the sprite layout, storing the sprite number&lt;br /&gt;
 // which belongs to the terrain type and the corresponding offset due to the tile slope&lt;br /&gt;
 switch (FEAT_OBJECTS, SELF, company_land_terrain_switch, [&lt;br /&gt;
 			// We store the offset into the spriteset due to the tile slope into the 1st temporary variable&lt;br /&gt;
 			STORE_TEMP(slope_to_sprite_offset(tile_slope), 0),&lt;br /&gt;
 &lt;br /&gt;
 			// We store the offset to the flat groundsprite we use into the 2nd temporary variable&lt;br /&gt;
 			STORE_TEMP(GROUNDSPRITE_NORMAL, 1),&lt;br /&gt;
 			STORE_TEMP(terrain_type == TILETYPE_DESERT      ? GROUNDSPRITE_DESERT : LOAD_TEMP(1), 1),&lt;br /&gt;
 			STORE_TEMP(terrain_type == TILETYPE_SNOW        ? GROUNDSPRITE_SNOW   : LOAD_TEMP(1), 1),&lt;br /&gt;
 &lt;br /&gt;
 			1&lt;br /&gt;
 			]) {&lt;br /&gt;
 	company_land_layout;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Spritelayout&amp;diff=4971</id>
		<title>NML:Spritelayout</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Spritelayout&amp;diff=4971"/>
		<updated>2025-04-04T13:07:51Z</updated>

		<summary type="html">&lt;p&gt;Frosch: expand on the maximum sprite size&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavBlocksyntax}}&lt;br /&gt;
&lt;br /&gt;
Stations, houses, industry tiles, objects, and airport tiles use spritelayouts to define layouts how sprites are supposed to be arranged on a tile. A &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;spritelayout&amp;lt;/code&amp;gt; can combine multiple sprites into one entity, which represents everything that is to be drawn on a particular tile. A simple example to illustrate how it works:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 spritelayout airport_building1 {&lt;br /&gt;
 	ground { sprite: GROUNDSPRITE_NORMAL; }&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		sprite: spr_small_dirt_ne; // custom spriteset&lt;br /&gt;
 		always_draw: 1; // also draw in transparent mode&lt;br /&gt;
 	}&lt;br /&gt;
 	building {&lt;br /&gt;
 		sprite: 0xA67; // reuse this existing base set sprite&lt;br /&gt;
 		xoffset: 0x0F;&lt;br /&gt;
 		xextent: 1;&lt;br /&gt;
 		zextent: 6;&lt;br /&gt;
 		recolour_mode: RECOLOUR_REMAP;&lt;br /&gt;
 		palette: PALETTE_USE_DEFAULT;&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The sprite layout is composed of one or more sprites. Each sprite is defined by a &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt;, &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt; or &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt; block. What block to use depends on how the sprite is to be placed on the tile.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt; sprites are drawn at the base of the tile, like grass and concrete, rails etc. in normal TTD. With a few exceptions (e.g. when using custom foundations), you should always provide a ground sprite, even when the building above fully covers it. This because in transparent mode, the building becomes invisible. A tile can only have one ground sprite.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt; sprites are drawn on top of the ground sprite. To determine their location and drawing order (what goes in front of what), they have a 3D bounding box.&lt;br /&gt;
* With &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt;(s), you can effectively compose sprites from multiple parts. When placing these after a building sprite, they will use the same bounding box as the previous building sprite. When placing them before the first building sprite, they will have no bounding box, as if they would use the &#039;bounding box&#039; of the ground tile. Multiple childsprites may be used per ground / building sprite.&lt;br /&gt;
&lt;br /&gt;
The sprite order is genrally determined by the sprite sorter, that evaluates the bounding box (see below) of each sprite. Child sprites are always part of the building (or ground) sprite that precedes them. In the GUI, sprites are always drawn in the order specified in the layout, so be sure to get this correct for spritelayouts that are to be displayed there.&lt;br /&gt;
&lt;br /&gt;
Per sprite, a number of parameters may be set. These are listed below. Unless otherwise indicated, each may have a value that is dependant on &#039;&#039;&#039;variables, parameters or registers&#039;&#039;&#039;. Accessed variables are always in the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;SELF&amp;lt;/code&amp;gt; scope. Accessing variables inside the purchase list is &#039;&#039;&#039;not&#039;&#039;&#039; supported, make sure that layouts accessed from there do not use them. Using variables and parameters, it&#039;s possible to create wildly differing looks with few spritelayouts.&lt;br /&gt;
&lt;br /&gt;
===Sprite===&lt;br /&gt;
&lt;br /&gt;
The most important parameter is &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt;, this determines the actual sprite to be drawn. If you set this to a number, a TTD sprite will be drawn, usually from the base set. Pre-defined constants for some base set sprites are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_NORMAL&amp;lt;ref name=&amp;quot;spritenames&amp;quot;&amp;gt;These constants can be used for sprites on flat ground. There are also equivalent sprites for sloped ground, however. These sprites follow the initial ground sprite, the [[NML:Builtin functions|builtin function]] &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;slope_to_sprite_offset(&#039;&#039;slope&#039;&#039;)&amp;lt;/code&amp;gt; may be used to compute the required offset. Refer to the reference on [[NML:List of tile slopes|slopes]] or the [[#Example_.28advanced.29_Spritelayout|example]] below.&amp;lt;/ref&amp;gt;&amp;lt;/code&amp;gt; default terrain type for that climate (temperate, toyland: normal, arctic: without snow, tropical: rainforest).&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_DESERT &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; desert tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_DESERT_1_2 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; transition tile between desert and grass&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_1_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; 1/4 snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_2_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; half-snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_3_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; 3/4 snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_SNOW_4_4 &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; snowy ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_CONCRETE&amp;lt;/code&amp;gt; concrete ground tile&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_WATER&amp;lt;/code&amp;gt; flat water tile, automatically choosen from sea, river and canal sprites, including river and canal borders.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_CLEARED &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile that has just been bulldozed (with brown colour)&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_RAIL_X &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile with rail and terrain appropriate ground, NE-SW orientation (provided by railtype)&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;GROUNDSPRITE_RAIL_Y &amp;lt;ref name=&amp;quot;spritenames&amp;quot; /&amp;gt;&amp;lt;/code&amp;gt; ground tile with rail and terrain appropriate ground, NW-SE orientation (provided by railtype)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can set the value to (the name of) a [[NML:Spriteset|spriteset]], to provide a custom sprite. When the value is just a spriteset identifier, a sprite from that set will be selected depending on the construction stage, see below. All spritesets used in a layout &#039;&#039;&#039;must&#039;&#039;&#039; have the same number of sprites, due to a restriction in the NFO format. If you supply an argument (e.g. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite: some_sprite_set(2);&amp;lt;/code&amp;gt;), the corresponding sprite from the sprite set will be used, with an argument of 0 corresponding to the first sprite. Note that the argument may also be variable, so you could e.g. use &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite: some_set(construction_state);&amp;lt;/code&amp;gt; to use the construction state to select the sprite (as is the default). If the spriteset has labels defined, you can use these labels in the argument expression.&lt;br /&gt;
&lt;br /&gt;
* For stations, objects and airport tiles, there are no construction stages, so the first sprite from the set is used always.&lt;br /&gt;
* For houses and industry tiles, sprite chosen depends on the construction stage and the number of sprites available.&lt;br /&gt;
** If there is only one sprite in the set, it is used always.&lt;br /&gt;
** If there are two sprites, one is used during construction (stages 0-2) and one for the finished building (stage 3)&lt;br /&gt;
** If there are three sprites, one is used for the beginning of construction (stage 0), one for the other construction stages (stages 1-2) and one for the finished building (stage 3).&lt;br /&gt;
** If there are four sprites, one is used for each construction stage.&lt;br /&gt;
** Sprites after the first four are always ignored.&lt;br /&gt;
* For road stops the usage of the ground sprite depends on the [[NML:Roadstops#List of draw mode flags|&#039;&#039;draw_mode&#039;&#039; property]].&lt;br /&gt;
* For objects the usage of the ground sprite may be skipped depending on the [[NML:Objects#List of object flags|&#039;&#039;OBJ_FLAG_DRAW_WATER&#039;&#039; flag]], which has the same effect as &#039;&#039;GROUNDSPRITE_WATER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Recolouring===&lt;br /&gt;
&lt;br /&gt;
Next, you have the option to apply recolouring, i.e. to change the colours of the sprite. This is done via the following attributes:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;recolour_mode&amp;lt;/code&amp;gt;: This must be compile-time constant. Available recolour modes are:&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_NONE&amp;lt;/code&amp;gt;: Use no colour translation (default)&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_REMAP&amp;lt;/code&amp;gt;: Use a colour translation table as defined by &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;. This tables maps all colours of the sprite to a new colour.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_TRANSPARENT&amp;lt;/code&amp;gt;: Draw the sprite in transparant mode, using a colour translation table as defined by &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;. Normally the palette will be set to PALETTE_TO_TRANSPARANT to draw all underlying colours somewhat darker. Note that the selected palette is applied to the colours of the underlying sprite, whatever that happens to be. The supplied sprite is only used to determine what pixels to recolour.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;palette&amp;lt;/code&amp;gt;: This defines the palette which is used for the colour translation. It may only (and must!) be set when &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;recolour_mode&amp;lt;/code&amp;gt; is set to &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_REMAP&amp;lt;/code&amp;gt; or &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;RECOLOUR_TRANSPARENT&amp;lt;/code&amp;gt;. The available values are the same as for &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt;, i.e. you can use either a default sprite or a sprite from a sprite set. In this case, however, the referenced sprite must not be a real sprite, but a [[NML:Recolour sprites|recolour sprite]]. For available default recolour sprites, see the appendix on [[NML:List of default colour translation palettes|available palettes]].&lt;br /&gt;
&lt;br /&gt;
===Display yes/no===&lt;br /&gt;
&lt;br /&gt;
The following attributes allow configuring whether the sprite will be displayed or not.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;hide_sprite&amp;lt;/code&amp;gt;: If set to 1, this sprite will not be drawn at all. Default is 0. If a building sprite is not drawn, all child sprites that share its bounding box are not drawn either. Setting this to a constant value makes little sense, but you can use this to enable/disable drawing certain sprites at runtime depending on certain conditions.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;always_draw&amp;lt;/code&amp;gt;: This must be a compile-time-constant. If set to 1, this sprite will also be drawn when the user has enabled transparant mode. The default value is 0. This is not available for ground sprites (those are drawn always), but it is for child sprites that share their bounding box with the ground sprite.&lt;br /&gt;
&lt;br /&gt;
===Positioning===&lt;br /&gt;
&lt;br /&gt;
How to position the sprite depends on the type of sprite:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ground&amp;lt;/code&amp;gt;: Ground sprites cannot be positioned.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;building&amp;lt;/code&amp;gt;: A three-dimensional bounding box may be defined. The X-axis runs from top-right to bottom-left and the Y-axis from top-left to bottom-right. Both X and Y are measured in 1/16 length of the the tile border. The Z axis is vertical and measured in pixels.&amp;lt;br/&amp;gt;Extending the bounding box over the edges of a tile is possible, but not recommended as it may lead to glitches. &#039;&#039;&#039;Unless you know exactly what you are doing, please follow the recommendations below. They are most likely exactly what you need&#039;&#039;&#039;.&amp;lt;br/&amp;gt;In NewGRF developer mode in OpenTTD, it&#039;s possible to view the bounding boxes of all sprites by pressing Ctrl+B. In order to use and define a custom bounding box, the following attributes can be used:&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xoffset&amp;lt;/code&amp;gt;: Offset from the northwestern edge to the start of the bounding box (X). Unit is 1/16 of the tile border. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yoffset&amp;lt;/code&amp;gt;: Offset from the northeastern edge to the start of the bounding box (Y). Unit is 1/16 of the tile border. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;zoffset&amp;lt;/code&amp;gt;: Offset from the lowest tile corner (with foundation added) to the start of the bounding box (Z). Unit is pixels. Default value is 0.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the X-direction. Must be a compile-time constant. Unit is 1/16 of the tile border. Default value is 16.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the Y-direction. Must be a compile-time constant. Unit is 1/16 of the tile border. Default value is 16.&lt;br /&gt;
** &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;zextent&amp;lt;/code&amp;gt;: Size of the bounding box, in the Z-direction. Must be a compile-time constant. Unit is pixels. Default value is 16.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;childsprite&amp;lt;/code&amp;gt;: Child sprites may be positioned relative to their &#039;parent&#039; sprite that defines the bounding box. &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;xoffset&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;yoffset&amp;lt;/code&amp;gt; may be set to specify an offset in pixels between the origin of the parent and child sprite. When the parent sprite is the ground sprite, TTDPatch does not support offsets other than 0,0. Note that all child sprites should fit inside the bounding box of the parent sprite to avoid visual glitches.&lt;br /&gt;
&lt;br /&gt;
===Strong recommendations for bounding boxes===&lt;br /&gt;
&lt;br /&gt;
For industries, houses, objects, and non-track station tiles:&lt;br /&gt;
* Use at most one building sprite; and child sprites for everything else.&lt;br /&gt;
** Do not set &#039;&#039;xoffset&#039;&#039;, &#039;&#039;yoffset&#039;&#039; or &#039;&#039;zoffset&#039;&#039;. The default value 0 applies.&lt;br /&gt;
** Do not set &#039;&#039;xextent&#039;&#039; or &#039;&#039;yextent&#039;&#039;. The default value 16 applies.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. The number of occupied height levels is important for objects allowed under bridges. Otherwise this only needs to be a rough estimate.&lt;br /&gt;
* If no sprite visually extends over the ground sprite, you do not need any building sprite: Child sprites can be used for further sprites.&lt;br /&gt;
&lt;br /&gt;
For rail station track tiles:&lt;br /&gt;
* Use child sprites of the ground sprite for things &amp;quot;below the train&amp;quot;.&lt;br /&gt;
* Use exactly two building sprites, possibly with child sprites.&lt;br /&gt;
* The first building sprite is used for things &amp;quot;behind the train&amp;quot;.&lt;br /&gt;
** Set &#039;&#039;xoffset&#039;&#039;, &#039;&#039;yoffset&#039;&#039;, &#039;&#039;zoffset&#039;&#039; to 0.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xextent&#039;&#039; to 16, &#039;&#039;yextent&#039;&#039; to 5.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xextent&#039;&#039; to 5, &#039;&#039;yextent&#039;&#039; to 16.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. A rough estimate is good enough.&lt;br /&gt;
* The second building sprite is used for things &amp;quot;in-front or above the train&amp;quot;.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xoffset&#039;&#039; to 0, &#039;&#039;yoffset&#039;&#039; to 11.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xoffset&#039;&#039; to 11, &#039;&#039;yoffset&#039;&#039; to 0.&lt;br /&gt;
** Set &#039;&#039;zoffset&#039;&#039; to 0.&lt;br /&gt;
** For track in X direction: Set &#039;&#039;xextent&#039;&#039; to 16, &#039;&#039;yextent&#039;&#039; to 5.&lt;br /&gt;
** For track in Y direction: Set &#039;&#039;xextent&#039;&#039; to 5, &#039;&#039;yextent&#039;&#039; to 16.&lt;br /&gt;
** Set &#039;&#039;zextent&#039;&#039; to &amp;quot;&amp;lt;number of occupied height levels&amp;gt; * 8 - 2&amp;quot;. A rough estimate is good enough.&lt;br /&gt;
&lt;br /&gt;
===Maximum sprite size===&lt;br /&gt;
&lt;br /&gt;
Ground sprites and their child sprites must not extend over the edges of a regular ground sprite of the slope.&lt;br /&gt;
&lt;br /&gt;
Building sprites and their child sprites:&lt;br /&gt;
* must not extend below the south tile edges,&lt;br /&gt;
* must not extend left/right of the west/east tile corners,&lt;br /&gt;
* must not extend above the north corner by more than 200 pixels including the (default) foundation. If foundations are present, this is reduced by up to 16 pixels (steep slope S) to 184 pixels.&lt;br /&gt;
&lt;br /&gt;
The following image shows the limitations for flat tiles, and the extreme cases of steep slopes:&lt;br /&gt;
&lt;br /&gt;
[[File:Max_tile_sprite_size.png]]&lt;br /&gt;
&lt;br /&gt;
===Example (advanced) Spritelayout===&lt;br /&gt;
&lt;br /&gt;
OpenTTD 1.2 (r22723) allows for nice shorthands in defining multiple views, e.g. for different slopes: Spritelayout can have parameters and may use variables and temporary storage inside of a layout. A common usage for such parametrized spritelayout is taking care of the tile slope and ground type as illustrated in this example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 spritelayout company_land_layout {&lt;br /&gt;
 	ground {&lt;br /&gt;
 		// normal ground sprite - always draw&lt;br /&gt;
 		sprite: LOAD_TEMP(0) + LOAD_TEMP(1);&lt;br /&gt;
 	}&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		// company-coloured border - always draw&lt;br /&gt;
 		sprite:        cc_frame(LOAD_TEMP(0));&lt;br /&gt;
 		always_draw:   1;&lt;br /&gt;
 		recolour_mode: RECOLOUR_REMAP;&lt;br /&gt;
 		palette:       PALETTE_USE_DEFAULT;&lt;br /&gt;
 	}&lt;br /&gt;
 	childsprite {&lt;br /&gt;
 		// again the normal ground sprite. Thus in non-transparent view&lt;br /&gt;
 		// only the normal ground sprite is shown. In transparent view&lt;br /&gt;
 		// this acts as sprite which darkens the other two sprites via&lt;br /&gt;
 		// a translation to transparency.&lt;br /&gt;
 		sprite: LOAD_TEMP(0) + LOAD_TEMP(1);&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 // A pseudo-switch which sets the temporary parameters for the sprite layout, storing the sprite number&lt;br /&gt;
 // which belongs to the terrain type and the corresponding offset due to the tile slope&lt;br /&gt;
 switch (FEAT_OBJECTS, SELF, company_land_terrain_switch, [&lt;br /&gt;
 			// We store the offset into the spriteset due to the tile slope into the 1st temporary variable&lt;br /&gt;
 			STORE_TEMP(slope_to_sprite_offset(tile_slope), 0),&lt;br /&gt;
 &lt;br /&gt;
 			// We store the offset to the flat groundsprite we use into the 2nd temporary variable&lt;br /&gt;
 			STORE_TEMP(GROUNDSPRITE_NORMAL, 1),&lt;br /&gt;
 			STORE_TEMP(terrain_type == TILETYPE_DESERT      ? GROUNDSPRITE_DESERT : LOAD_TEMP(1), 1),&lt;br /&gt;
 			STORE_TEMP(terrain_type == TILETYPE_SNOW        ? GROUNDSPRITE_SNOW   : LOAD_TEMP(1), 1),&lt;br /&gt;
 &lt;br /&gt;
 			1&lt;br /&gt;
 			]) {&lt;br /&gt;
 	company_land_layout;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Max_tile_sprite_size.png&amp;diff=4970</id>
		<title>File:Max tile sprite size.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Max_tile_sprite_size.png&amp;diff=4970"/>
		<updated>2025-04-04T13:00:14Z</updated>

		<summary type="html">&lt;p&gt;Frosch: Maximum visible size of sprites on tiles.
Applies since OpenTTD 1.5.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Summary ==&lt;br /&gt;
Maximum visible size of sprites on tiles.&lt;br /&gt;
Applies since OpenTTD 1.5.&lt;/div&gt;</summary>
		<author><name>Frosch</name></author>
	</entry>
</feed>