<?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=Andrew350</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=Andrew350"/>
	<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/wiki/Special:Contributions/Andrew350"/>
	<updated>2026-04-16T23:26:58Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Railtypetable-Roadtypetable-Tramtypetable&amp;diff=3959</id>
		<title>NML:Railtypetable-Roadtypetable-Tramtypetable</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Railtypetable-Roadtypetable-Tramtypetable&amp;diff=3959"/>
		<updated>2019-12-28T13:22:14Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: added note about road and tramtypes, also label usage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavBlocksyntax}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; The syntax for &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;roadtypetable&amp;lt;/code&amp;gt; and &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;tramtypetable&amp;lt;/code&amp;gt; are identical to that of &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;railtypetable&amp;lt;/code&amp;gt; as described below&lt;br /&gt;
&lt;br /&gt;
 railtypetable {&lt;br /&gt;
 	ITEM [, ITEM]*&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Each &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ITEM&amp;lt;/code&amp;gt; can be either a 4-byte long Identifier or string or it can have this format:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 ID : [ ID[, ID]* ]&lt;br /&gt;
&lt;br /&gt;
The first ID is the name (doesn&#039;t have to be 4-bytes long), the other IDs are a list of labels that are assigned to the given name if they are available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 railtypetable {&lt;br /&gt;
 	RAIL,&lt;br /&gt;
 	ELRL,&lt;br /&gt;
 	&amp;quot;3RDR&amp;quot;,&lt;br /&gt;
 	RT_SHINY_RAIL: [SHNY, RAIL]&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The label 3RDR is written as a string because an identifier can&#039;t start with a numeric value. To reference it later you can write &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;railtype(&amp;quot;3RDR&amp;quot;)&amp;lt;/code&amp;gt;. If another grf defines a railtype with label SHNY then RT_SHINY_RAIL will refer to that track type. If the railtype SHNY is not available then trains using RT_SHINY_RAIL as track type will fallback to RAIL.&lt;br /&gt;
&lt;br /&gt;
The default railtype labels are &amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;, &amp;quot;MONO&amp;quot;, &amp;quot;MGLV&amp;quot;. See the [[RailtypeLabels|List of railtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
Similarly, the default roadtype labels are &amp;quot;ROAD&amp;quot; and &amp;quot;ELRD&amp;quot;, and the default tramtype labels are &amp;quot;RAIL&amp;quot; and &amp;quot;ELRL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label &amp;quot;RAIL&amp;quot; can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action4&amp;diff=3958</id>
		<title>Action4</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action4&amp;diff=3958"/>
		<updated>2019-12-28T12:37:20Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Feature */ added roadtypes / tramtypes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Define strings, e.g vehicle, house or industry names&lt;br /&gt;
&lt;br /&gt;
When making new vehicle graphics, you also need to name the new vehicles, or they&#039;ll show up with their original name from TTD.&lt;br /&gt;
However, custom vehicle names assigned by the player in-game (or for TTDPatch also via TTD&#039;s vehicle.dat) will always take precendence.&lt;br /&gt;
&lt;br /&gt;
In TTDPatch you can also use this action to change most of TTD&#039;s text strings.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
The data looks as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;Sprite-number&amp;amp;gt; * &amp;amp;lt;Length&amp;amp;gt; &#039;&#039;&#039;04&#039;&#039;&#039; &amp;amp;lt;feature&amp;amp;gt; &amp;amp;lt;language-id&amp;amp;gt; &amp;amp;lt;num-ent&amp;amp;gt; &amp;amp;lt;offset&amp;amp;gt; &amp;amp;lt;text&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Element!![[GRFActionsDetailed|Size]]!!Description&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;Sprite-number&amp;amp;gt;||dec||A sequential sprite number&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;length&amp;amp;gt;||dec||The total number of bytes used in this action.&lt;br /&gt;
|-&lt;br /&gt;
|04||B||Defines action 04&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;feature&amp;amp;gt;||B||For what type of vehicle/station should this definition be used?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;language-id&amp;amp;gt;||B||Which of TTD&#039;s languages this name is for&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;num-ent&amp;amp;gt;||B||Number of consecutive strings to change&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;offset&amp;amp;gt;||B/W||First ID to change&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;text&amp;amp;gt;||S||New text strings&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Whether &amp;amp;lt;offset&amp;amp;gt; is a &#039;&#039;&#039;BYTE&#039;&#039;&#039; (extended byte in openttd for vehicles) or a &#039;&#039;&#039;WORD&#039;&#039;&#039; is decided by bit 7 of &amp;amp;lt;language-id&amp;amp;gt;, see below.&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&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;
|07||Houses&lt;br /&gt;
|-&lt;br /&gt;
|0A||Industries&lt;br /&gt;
|-&lt;br /&gt;
|0B||Cargos&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;
|12||Roadtypes&lt;br /&gt;
|-&lt;br /&gt;
|13||Tramtypes&lt;br /&gt;
|-&lt;br /&gt;
|48||Original strings; see [[TextIDs]] for a list of TTD&#039;s text IDs.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== language IDs ===&lt;br /&gt;
The meaning of this byte depends on the GRF version of the .grf file as set in [[Action8#version|action 8]].&lt;br /&gt;
&lt;br /&gt;
{{grfTill|6}} Up to version 6, this is a bit mask of the following bits:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Bit!!Value!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||01||American or &amp;quot;other&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|1||02||English&lt;br /&gt;
|-&lt;br /&gt;
|2||04||German&lt;br /&gt;
|-&lt;br /&gt;
|3||08||French&lt;br /&gt;
|-&lt;br /&gt;
|4||10||Spanish&lt;br /&gt;
|-&lt;br /&gt;
|7||80||Flag for 16 bit string IDs&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Add the bits of all languages for which the following strings apply. Bit 7 controls, whether the following string ID consists of 16 or 8 bit. Unknown languages will use the American strings as fallback. Otherwise the string would remain undefined for these languages. To actually define strings for any new language, you must use grf version 7.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|7}} For version 7 and higher, it is a simple language ID from the list below. (This has changed with TTDPatch 2.5 beta 4). Bit 7 has the same meaning as in the earlier versions above.&lt;br /&gt;
&lt;br /&gt;
In either scheme, you can use the value 7F or FF, respectively, to define strings shown for languages that you do not provide translation for. First set all strings to a default value using this, and later override the language specific ones if they exist. &lt;br /&gt;
&lt;br /&gt;
Set bit7 (add 0x80 to the languageID as in the table below) in order to use 16 bit string IDs.&lt;br /&gt;
&lt;br /&gt;
For a list of plural forms see [[StringCodes]]. As the assignment of plural forms to languages is in fact not as fixed as one might expect, the used plural form is defined by each GRF separately for its strings using [[Action0/Global Settings]] property 15.&lt;br /&gt;
&lt;br /&gt;
{{:language_IDs}}&lt;br /&gt;
&lt;br /&gt;
When translating for a new language, please simply edit the [[language_IDs|language list]] and add the new definition here.&lt;br /&gt;
&lt;br /&gt;
=== num-ent ===&lt;br /&gt;
&lt;br /&gt;
How many consecutive entries to change.&lt;br /&gt;
&lt;br /&gt;
=== offset ===&lt;br /&gt;
&lt;br /&gt;
The ID of the first string to change.&lt;br /&gt;
&lt;br /&gt;
When language-id bit 7 is clear, this is a byte value; For OpenTTD since r13482, where it is an extended byte value for vehicles.&lt;br /&gt;
&lt;br /&gt;
When language-id bit 7 is set, this is a word value in little endian notation, e.g. 8134 becomes 34 81.&lt;br /&gt;
&lt;br /&gt;
The 8 bit version is only allowed for vehicles to set their name, in which case the text ID is just the vehicle ID.&lt;br /&gt;
To replace original texts, or to define texts for usage in callbacks or properties of vehicles, stations, houses or industries you have to use the 16 bit version. However, town names are changed with [[ActionF|Action F]].&lt;br /&gt;
&lt;br /&gt;
For the usable 16 bit text IDs see the table below, resp. for feature 48 see [[TextIDs]].&lt;br /&gt;
&lt;br /&gt;
Though these ranges are shared across all features, you should still set the proper feature you are using them for.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!ID!!Content&lt;br /&gt;
|-&lt;br /&gt;
|C4xx||Set name of station class associated with station ID xx; this is the text above the preview (where otherwise TTD shows &amp;quot;Orientation&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
|C5xx||New station names, this changes the text &amp;quot;number of platforms&amp;quot; into the given text when the station with this ID from the current set is selected (i.e. xx=station-id from action 3 and 0)&lt;br /&gt;
|-&lt;br /&gt;
|C9xx||Name of the house type of this ID. If both property 12 and this is set, the latest definition is used always. You should prefer setting [[Action0/Houses#Building name ID (12)|property 12]] instead of this, so executables translated with TTD Translator will show the name in the current language. However, if you can&#039;t find any suitable old TTD texts, this can be used to specify your custom name. Don&#039;t forget to set the same text for all parts of a multi-tile building.&lt;br /&gt;
|-&lt;br /&gt;
|D0xx||Miscellaneous graphics texts, unique to each .grf file. Used for several callbacks. Some callbacks support IDs up to D3FF.&lt;br /&gt;
|-&lt;br /&gt;
|D4xx||&#039;&#039;&#039;Never use in Action4&#039;&#039;&#039;, only for displaying textids in range D000-D3FF (grf specific), see [[TextIDs]]&lt;br /&gt;
|-&lt;br /&gt;
|D8xx&lt;br /&gt;
|{{ottd|1.7|rev=r27769}} Useable like DCxx in Action 0 and for inclusion via string codes 0x80 and 0x81.&lt;br /&gt;
{{ttdp|}}&#039;&#039;&#039;Never use in Action4&#039;&#039;&#039;, only usable in Action0 features, see [[TextIDs]]&lt;br /&gt;
|-&lt;br /&gt;
|DCxx||Set miscellaneous persistent GRF texts. Useable in Action 0 and for inclusion via string codes 0x80 and 0x81.&lt;br /&gt;
{{ttdp|}} Unlike the D0xx GRF texts, these IDs can be used to set properties. The text ID must be set before any [[Action0/Houses|action 0]] references it.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{ttdp|}} The DCxx IDs are allocated internally when defined, and are persistent in the savegame data. Each .grf file gets its own separate map of these internal IDs and thus may set all 256 of them. &amp;amp;nbsp;However, only 1024 IDs are available in total, to be shared by all .grf files ever activated in the savegame. This means these IDs should be used as sparingly as possible. But use them when they are useful!&lt;br /&gt;
&lt;br /&gt;
=== text ===&lt;br /&gt;
&lt;br /&gt;
This is a list of zero-terminated strings, there must be as many strings as num-ent specifies.&lt;br /&gt;
&lt;br /&gt;
Grfcodec version 0.9.6 or later accepts literal strings in the .nfo. These are encoded exactly as written, in whatever encoding your text editor uses; if you need a 00, put it immediately after the literal string.&lt;br /&gt;
For the supported encodings, format, and restrictions on what characters you may use, please see [[GRFActionsDetailed#Strings|GRFActionsDetailed]] and StringCodes.&lt;br /&gt;
&lt;br /&gt;
A large number of original TTD strings require a colour code in front of the actual string. You can also use these colour codes in most of your custom strings. Use them wisely! In case a string requires a colour code, the string will have the code displayed in front of the default text as listed in [[TextIDs]].Typically, a colour coded string starts with the escape character (backslash), followed by hex byte and then the actual text string itself. I.e. string 0001 (&amp;quot;\94Off edge of map&amp;quot;) has colour code 0x94 in front of the text string, which will colour it white. You can also put the plain hex byte outside the quoted string without having to escape it. &#039;&#039;94 &amp;quot;Off edge of map&amp;quot;&#039;&#039; would be the same as &#039;&#039;&amp;quot;\94Off edge of map&amp;quot;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The following colour codes are available for use:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!&#039;&#039;&#039;Code&#039;&#039;&#039;!!&#039;&#039;&#039;Colour&#039;&#039;&#039;!!&#039;&#039;&#039;Pallete Colour&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|88||Blue|| &amp;lt;div style=&amp;quot;background:#3890E8;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|89||Silver|| &amp;lt;div style=&amp;quot;background:#C8C8C8;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|8A||Golden|| &amp;lt;div style=&amp;quot;background:#FCC000;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|8B||Red|| &amp;lt;div style=&amp;quot;background:#FC0000;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|8C||Purple|| &amp;lt;div style=&amp;quot;background:#A888E0;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|8D||Light Brown|| &amp;lt;div style=&amp;quot;background:#B0B084;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|8E||Orange|| &amp;lt;div style=&amp;quot;background:#FCB030;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|8F||Green|| &amp;lt;div style=&amp;quot;background:#90E05C;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|90||Yellow|| &amp;lt;div style=&amp;quot;background:#FCF880;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|91||Dark Green|| &amp;lt;div style=&amp;quot;background:#B4CC7C;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|92||Cream|| &amp;lt;div style=&amp;quot;background:#D49480;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|93||Brown|| &amp;lt;div style=&amp;quot;background:#A46040;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|94||White|| &amp;lt;div style=&amp;quot;background:#FCFCFC;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|95||Light Blue|| &amp;lt;div style=&amp;quot;background:#80C4FC;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|96||Grey|| &amp;lt;div style=&amp;quot;background:#626562;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|97||Dark Blue|| &amp;lt;div style=&amp;quot;background:#8484A4;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|98||Black|| &amp;lt;div style=&amp;quot;background:#101010;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action1&amp;diff=3957</id>
		<title>Action1</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action1&amp;diff=3957"/>
		<updated>2019-12-28T12:33:27Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Feature */ added roadtypes / tramtypes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Defining a set of real sprites.&lt;br /&gt;
Action 01 is used to define sets of real sprites (as opposed to pseudo-sprites). It can be put anywhere in the .nfo file after [[Action8|Action 8]].&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
=== Basic format ===&lt;br /&gt;
{{ottdp|0.6|2.0}}&lt;br /&gt;
 &amp;lt;sprite-number&amp;gt; * &amp;lt;length&amp;gt; &#039;&#039;&#039;01&#039;&#039;&#039; &amp;lt;feature&amp;gt; &amp;lt;num-sets&amp;gt; &amp;lt;num-ent&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Element!![[GRFActionsDetailed|Size]]!!Description&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;
|01||B||Defines action 01&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;feature&amp;gt;||B||The feature that following sprites should be used for (s.b.)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;num-sets&amp;gt;||B||The number of sprite sets you have (one sprite set is one vehicle/station/ship etc). Setting this to 00 makes it an extended format (see below).&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;num-ent&amp;gt;||B*||The number of views the sprite has&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The block of data that always follows after action 01 should consist of num-sets * num-ent RealSprites or RecolorSprites.&lt;br /&gt;
&lt;br /&gt;
=== Extended format ===&lt;br /&gt;
{{ottdp|1.2.2|no|ottdrev=r24361}} &lt;br /&gt;
 &amp;lt;sprite-number&amp;gt; * &amp;lt;length&amp;gt; &#039;&#039;&#039;01&#039;&#039;&#039; &amp;lt;feature&amp;gt; &#039;&#039;&#039;00&#039;&#039;&#039; &amp;lt;first-set&amp;gt; &amp;lt;num-sets&amp;gt; &amp;lt;num-ent&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Element!![[GRFActionsDetailed|Size]]!!Description&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;
|01||B||Defines action 01&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;feature&amp;gt;||B||The feature that following sprites should be used for (s.b.)&lt;br /&gt;
|-&lt;br /&gt;
|00||B||Identfies the extended format.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;first-set&amp;gt;||B*||The ID of the first spriteset to define&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;num-sets&amp;gt;||B*||The number of sprite sets you have (one sprite set is one vehicle/station/ship etc)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;num-ent&amp;gt;||B*||The number of views the sprite has&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The block of data that always follows after action 01 should consist of num-sets * num-ent RealSprites or RecolorSprites.&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;
|0B||Cargos&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;
&lt;br /&gt;
=== first-set ===&lt;br /&gt;
This specifies the first set ID to define.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.2|no|ottdrev=r22925}} Since OpenTTD r22925 spritesets stay valid across multiple Action1. That is, if one Action1 defines spritesets 0 to 4, and later a second Action1 redefines spriteset 0, spritesets 1 to 4 still refer to the first Action1. Spritesets are feature-specific, each feature maintains its own mapping of ids to Action1 spritesets. (Prior to OpenTTD r22925 and in TTDPatch only spritesets from a single Action1 are referencible from an Action2 at a time. Referencing an Action1 with a different feature than the Action2 is an error.)&lt;br /&gt;
&lt;br /&gt;
This behaviour of Action1 applies to both the basic as well as the extended format. &lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.2|no|ottdrev=r22926}} In addition the extended format allows to specify an ID for the first spriteset to define. That way individual spritesets and be redefined individually. &lt;br /&gt;
&lt;br /&gt;
There are no restriction on the order the spritesets are defined. If you define spritesets 23..25 in one Action 1, define spritesets 0..5 in another Action 1, then an Action 2 can access sets 0..5 and 23..25. Later another Action 1 can redefine spritesets 2..3, and following Action 2 could access spritesets 0..1, 2..3, 4, 23..25 from various Action 1.&lt;br /&gt;
&lt;br /&gt;
Note that all spriteset defined in a single Action1 have the same amount of sprites per spriteset. Using multiple Action1 you can define spriteset with different amounts of sprites per set. Action2 will individually use the size of each referenced spriteset. There is no requirement for consistent numbers of sprites in Action2 or spritelayouts.&lt;br /&gt;
&lt;br /&gt;
=== num-sets ===&lt;br /&gt;
The amount of stations, vehicles, ships, etc that the following sprites represent (be warned, one spriteset can be used for more as one vehicle, or truck; you will see this when you reach [[Action2|Action 2]] and [[Action3|Action 3]])&lt;br /&gt;
&lt;br /&gt;
=== num-ent ===&lt;br /&gt;
&lt;br /&gt;
This sets how many different views each entry has.&lt;br /&gt;
&lt;br /&gt;
For vehicles, this corresponds to the different directions it can be in. If your vehicle is symmetrical you need 4 views, and if it isn&#039;t symmetrical then use 8 views.&lt;br /&gt;
&lt;br /&gt;
A station should normally be 12 (hex) because a station is made out of 18 (decimal) sprites, although if you use a different sprite layout for your station this number may vary.&lt;br /&gt;
For canals, it depends on the canal feature, see [[Action3|Action 3]].&lt;br /&gt;
&lt;br /&gt;
For houses and industry tiles, this should be between 1 and 4 and specifies the number of different construction stages. Sprites after the first four are always ignored. See also action 2 and 3.&lt;br /&gt;
&lt;br /&gt;
For cargos, this should always be 1. The following sprites should be no larger than 10x10 pixels or they won&#039;t fit into the station window correctly.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6|2.5|ttdprev=2.0.1 alpha 49}} Since TTDPatch 2.0.1 alpha 49, this value is a so-called &amp;quot;extended byte&amp;quot; (see [[GRFActionsDetailed]]).&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6|2.5|ttdprev=2.0.1 alpha 63}} Since TTDPatch 2.0.1 alpha 63, it is possible to have &amp;lt;num-ent&amp;gt;=0. This is useful for defining an action 1/2 combination that only serves as invalid callback result. If the .grf file defines no graphics otherwise, this way callbacks can return an explicit failure code without needing any actual sprites to be allocated. This is also needed if the feature has [[Action2/Only_Callback_Failure | no graphics at all]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Below is an example of what a real Action 1 pseudo-sprite could look like with the sprite entries under it.&lt;br /&gt;
&lt;br /&gt;
 2 * 4 01 00 01 08&lt;br /&gt;
 3 C:\TTD\SPRITES\mytrain.pcx 66 8 01 18 8 -3 -10&lt;br /&gt;
 4 C:\TTD\SPRITES\mytrain.pcx 82 8 09 15 20 -14 -6&lt;br /&gt;
 5 C:\TTD\SPRITES\mytrain.pcx 114 8 01 12 28 -14 -6&lt;br /&gt;
 6 C:\TTD\SPRITES\mytrain.pcx 162 8 09 16 20 -4 -8&lt;br /&gt;
 7 C:\TTD\SPRITES\mytrain.pcx 194 8 01 18 8 -3 -10&lt;br /&gt;
 8 C:\TTD\SPRITES\mytrain.pcx 210 8 09 16 20 -14 -7&lt;br /&gt;
 9 C:\TTD\SPRITES\mytrain.pcx 242 8 01 12 28 -14 -6&lt;br /&gt;
 10 C:\TTD\SPRITES\mytrain.pcx 290 8 09 15 20 -4 -7&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!&#039;&#039;&#039;Byte&#039;&#039;&#039;!!&#039;&#039;&#039;Meaning&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|2||&amp;lt;sprite-number&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|4||&amp;lt;length&amp;gt; of the action in bytes; start counting at 01 (&amp;lt;action&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|01||&amp;lt;action&amp;gt;: sets this pseudo-sprite to function as action 1&lt;br /&gt;
|-&lt;br /&gt;
|00||&amp;lt;feature&amp;gt;: In this case Train&lt;br /&gt;
|-&lt;br /&gt;
|01||&amp;lt;num-sets&amp;gt;: 1 Set of views&lt;br /&gt;
|-&lt;br /&gt;
|08||&amp;lt;num-ent&amp;gt;: 8 views of this train&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action2/Single_Set&amp;diff=3956</id>
		<title>Action2/Single Set</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action2/Single_Set&amp;diff=3956"/>
		<updated>2019-12-28T12:31:51Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Introduction */ added roadtypes and tramtypes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
{| |-&lt;br /&gt;
!Feature !! Version !! Associated graphics&lt;br /&gt;
|-&lt;br /&gt;
|Canals || {{ottdp|0.6|2.5}} || Depends on [[Action3#ids | Action3 ID]]; see [[Action0/Canals | Action0]]&lt;br /&gt;
|-&lt;br /&gt;
|Cargos || {{ottdp|0.6|2.5}} || Single icon sprite&lt;br /&gt;
|-&lt;br /&gt;
|Airports || {{ottdp|1.1|no}} || Single preview image&lt;br /&gt;
|-&lt;br /&gt;
|Railtypes || {{ottdp|1.0|no|ottdrev=r19056}} || Depends on [[Action3/Railtypes#cargo-type| Action3 &#039;cargo&#039; type]]&lt;br /&gt;
|-&lt;br /&gt;
|Roadtypes || {{ottdp|1.10}} || Depends on [[Action3/Roadtypes#cargo-type| Action3 &#039;cargo&#039; type]]&lt;br /&gt;
|-&lt;br /&gt;
|Tramtypes || {{ottdp|1.10}} || Depends on [[Action3/Tramtypes#cargo-type| Action3 &#039;cargo&#039; type]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Action2 for these features defines only a single spriteset, therefore the action2 you need isn&#039;t too complicated.&lt;br /&gt;
&lt;br /&gt;
The only graphics associated to cargoes is their icon that is shown in the station window.&lt;br /&gt;
&lt;br /&gt;
The graphics associated with railtypes, roadtypes, and tramtypes are somewhat more complicated, but all their logic is in variational action2s and the action3; the standard action2 is again not complicated.&lt;br /&gt;
&lt;br /&gt;
The only graphics associated with airports is their preview sprite. The default size for the preview sprite is 230x140. The airport build GUI will automatically scale if you have a smaller or larger image, but it will probably look best if you make sure it is no larger than the default size.&lt;br /&gt;
&lt;br /&gt;
Do not skip an Action2 using [[Action9]] (unless it skips the whole file). Action2 must not be skipped by Action9 or TTDPatch will most likely crash. Skip or modify [[Action3]] instead. Skipping an Action2 with an [[Action7]] has no effect.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&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; 01 00 &amp;lt;set&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Element!![[GRFActionsDetailed|Size]]!!Description&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 action2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;feature&amp;gt;||B||[[Features | Feature]] being defined&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set-id&amp;gt;||B||What set-ID this action2 defines&lt;br /&gt;
|-&lt;br /&gt;
|01||B||A literal 01 byte&lt;br /&gt;
|-&lt;br /&gt;
|00||B||A literal 00 byte&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set&amp;gt;||W||Number of set to use from the last action 1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
You may note that this is the same as the action2 entry for vehicles, but with num_loadtypes=1 and num_loadingtypes=0, and only one set number.&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;
=== set-id ===&lt;br /&gt;
&lt;br /&gt;
This defines the ID of the current action 2. This ID will later be referred to by [[Action3|action 3]], or a variational/random action 2.&lt;br /&gt;
&lt;br /&gt;
You can reuse action 2 IDs, and there&#039;s no restriction on the order in which they are defined.&lt;br /&gt;
&lt;br /&gt;
=== set ===&lt;br /&gt;
&lt;br /&gt;
The sprite set to use for displaying. Entry is a WORD value in little endian format, and refers to the most recent action1 set. For example, action1 set 3 would be encoded as 03 00. Note the additional 00 which is needed because it must be a word value here.&lt;br /&gt;
(Don&#039;t forget that sprite set numbering starts from zero)&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action2&amp;diff=3955</id>
		<title>Action2</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action2&amp;diff=3955"/>
		<updated>2019-12-28T12:27:43Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Feature */ added roadtypes / tramtypes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Defining graphics set IDs.&lt;br /&gt;
&lt;br /&gt;
Action2 is used to group sets of sprites from the previous [[Action1]] together, and make them accessible by a [[VariationalAction2|variational]] or [[RandomAction2|random action 2]] (chain) or an [[Action3]].&lt;br /&gt;
&lt;br /&gt;
Do not skip an Action2 using [[Action9]] (unless it skips the whole file). Action2 must not be skipped by Action9 or TTDPatch will most likely crash. Skip or modify [[Action3]] instead. Skipping an Action2 with an [[Action7]] has no effect.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
In general, the data looks as follows. Some features use a different syntax though (see table below).&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;num-ent1&amp;gt; &amp;lt;num-ent2&amp;gt; &amp;lt;entries...&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Element!![[GRFActionsDetailed|Size]]!!Description&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 feature should the following sprites be used?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;set-id&amp;gt;||B||What set-ID this action 2 defines&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;num-ent1&amp;gt;||B||First number of entries, depends on feature&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;num-ent2&amp;gt;||B||Second number of entries, depends on feature&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;entries...&amp;gt;||W||Entry numbers, depends on the feature&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&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||[[Action2/Vehicles | Trains]]&lt;br /&gt;
|-&lt;br /&gt;
|01||[[Action2/Vehicles | Road Vehicles]]&lt;br /&gt;
|-&lt;br /&gt;
|02||[[Action2/Vehicles | Ships]]&lt;br /&gt;
|-&lt;br /&gt;
|03||[[Action2/Vehicles | Aircraft]]&lt;br /&gt;
|-&lt;br /&gt;
|04||[[Action2/Stations | Stations]]&lt;br /&gt;
|-&lt;br /&gt;
|05||[[Action2/Single_Set | Canals/Rivers]]&lt;br /&gt;
|-&lt;br /&gt;
|07||[[Action2/Sprite_Layout | Houses]] (special Sprite Layout format)&lt;br /&gt;
|-&lt;br /&gt;
|09||[[Action2/Sprite_Layout | Industry Tiles]] (special Sprite Layout format)&lt;br /&gt;
|-&lt;br /&gt;
|0A||[[Action2/Industries | Industries]] (special Production Callback format)&lt;br /&gt;
|-&lt;br /&gt;
|0B||[[Action2/Single_Set | Cargos]]&lt;br /&gt;
|-&lt;br /&gt;
|0C||[[Action2/Only_Callback_Failure | Sound Effects]] (callback failure only)&lt;br /&gt;
|-&lt;br /&gt;
|0D||[[Action2/Single_Set | Airports]]&lt;br /&gt;
|-&lt;br /&gt;
|0E||[[Action2/Only_Callback_Failure | Signals]] (callback failure only)&lt;br /&gt;
|-&lt;br /&gt;
|0F||[[Action2/Sprite_Layout | Objects]] (special Sprite Layout format)&lt;br /&gt;
|-&lt;br /&gt;
|10||[[Action2/Single_Set | Railtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|11||[[Action2/Sprite_Layout | Airport Tiles]] (special Sprite Layout format)&lt;br /&gt;
|-&lt;br /&gt;
|12||[[Action2/Single_Set | Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|13||[[Action2/Single_Set | Tramtypes]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== set-id ===&lt;br /&gt;
&lt;br /&gt;
This defines the ID of the current action 2. This ID will later be referred to by [[Action3|action 3]], or a variational/random action 2.&lt;br /&gt;
&lt;br /&gt;
You can reuse action 2 IDs, and there&#039;s no restriction on the order in which they are defined.&lt;br /&gt;
&lt;br /&gt;
=== num-ent1, num-ent2 ===&lt;br /&gt;
&lt;br /&gt;
Each feature has two different graphics ranges, but their exact meaning differs from feature to feature. For example, for vehicles, the first set is used while moving, and the second while loading/unloading in a station.&lt;br /&gt;
&lt;br /&gt;
=== entries ===&lt;br /&gt;
&lt;br /&gt;
This is the list of action 1 sets to use, first num-ent1 for the first range, then num-ent2 entries for the second range.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2&amp;diff=3954</id>
		<title>VariationalAction2</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2&amp;diff=3954"/>
		<updated>2019-12-28T12:25:50Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: added roadtypes / tramtypes&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;
&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]]||N/A&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]]||N/A&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 (i.e. with a 00 following, e.g. set-id 5 becomes 05 00, or - in case of a callback result - by setting the high bit, e.g. 05 80), followed by the low and high limits of this range. &amp;amp;nbsp;The first range that matches will be used.&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>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action3&amp;diff=3953</id>
		<title>Action3</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action3&amp;diff=3953"/>
		<updated>2019-12-28T12:21:51Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* cargo-type */ added note about road/tramtypes&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;
&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;
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;
&amp;lt;u&amp;gt;For vehicles (features 00 .. 03) and stations (feature 04)&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The cargo-type for which the set-ID applies. &amp;amp;nbsp;If the item is built to use this type of cargo, or if it is refitted for it, the given set-ID is used as its graphics. &amp;amp;nbsp;See column &amp;quot;type A&amp;quot; in the table at [[CargoTypes]] for a list of cargo-type values.&lt;br /&gt;
&lt;br /&gt;
If the grf file has installed a [[Action0/Global Settings#Cargo translation table 09|cargo translation table]], the cargo type here refers to the cargo with the label in the given slot of the translation table, e.g. if you use cargo-type=08, it refers to the cargo that has the label in the ninth slot (numbered 08) in the translation table.&lt;br /&gt;
&lt;br /&gt;
If defined, cargo-type FF is used for graphics shown in the purchase or construction window.&lt;br /&gt;
: Note that 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 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.&lt;br /&gt;
&lt;br /&gt;
For stations, you can additionally define a special cargo-type of FE which prevents the default from being used (which would show the sum of all cargo). &amp;amp;nbsp;Instead, the given set-ID is displayed with no cargo at all.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Railtypes are available only in OpenTTD &amp;amp;gt; r19056 and its action 3 re-uses the &#039;cargo&#039;-type definition.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For details see its [[Action3/Railtypes|own Action 3 page]]&lt;br /&gt;
&lt;br /&gt;
Since OpenTTD 1.10 this is also the case for [[Action3/Roadtypes|Roadtypes]] and [[Action3/Tramtypes|Tramtypes]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;For canals/rivers, houses, industry tiles, industries and cargoes (features 05, 07, 09, 0A and 0B)&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As &amp;amp;lt;num-cid&amp;amp;gt; is zero for features 05 (canals/rivers), 07 (houses), 09 (industry tiles), 0A (industries), and 0B (cargoes), &amp;amp;lt;cargo-type&amp;amp;gt; and &amp;amp;lt;set-ID&amp;amp;gt; need to be skipped and you only have to set &amp;amp;lt;default set-ID&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;For objects (feature 0F)&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Objects support a buy menu sprite similar to vehicles (cargo-type FF).&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>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action3&amp;diff=3952</id>
		<title>Action3</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action3&amp;diff=3952"/>
		<updated>2019-12-28T12:17:57Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Feature */ added roadtypes / tramtypes&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;
&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;
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;
&amp;lt;u&amp;gt;For vehicles (features 00 .. 03) and stations (feature 04)&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The cargo-type for which the set-ID applies. &amp;amp;nbsp;If the item is built to use this type of cargo, or if it is refitted for it, the given set-ID is used as its graphics. &amp;amp;nbsp;See column &amp;quot;type A&amp;quot; in the table at [[CargoTypes]] for a list of cargo-type values.&lt;br /&gt;
&lt;br /&gt;
If the grf file has installed a [[Action0/Global Settings#Cargo translation table 09|cargo translation table]], the cargo type here refers to the cargo with the label in the given slot of the translation table, e.g. if you use cargo-type=08, it refers to the cargo that has the label in the ninth slot (numbered 08) in the translation table.&lt;br /&gt;
&lt;br /&gt;
If defined, cargo-type FF is used for graphics shown in the purchase or construction window.&lt;br /&gt;
: Note that 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 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.&lt;br /&gt;
&lt;br /&gt;
For stations, you can additionally define a special cargo-type of FE which prevents the default from being used (which would show the sum of all cargo). &amp;amp;nbsp;Instead, the given set-ID is displayed with no cargo at all.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;Railtypes are available only in OpenTTD &amp;amp;gt; r19056 and its action 3 re-uses the &#039;cargo&#039;-type definition.&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For details see its [[Action3/Railtypes|own Action 3 page]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;For canals/rivers, houses, industry tiles, industries and cargoes (features 05, 07, 09, 0A and 0B)&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As &amp;amp;lt;num-cid&amp;amp;gt; is zero for features 05 (canals/rivers), 07 (houses), 09 (industry tiles), 0A (industries), and 0B (cargoes), &amp;amp;lt;cargo-type&amp;amp;gt; and &amp;amp;lt;set-ID&amp;amp;gt; need to be skipped and you only have to set &amp;amp;lt;default set-ID&amp;amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;For objects (feature 0F)&amp;lt;/u&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Objects support a buy menu sprite similar to vehicles (cargo-type FF).&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>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action3/Tramtypes&amp;diff=3951</id>
		<title>Action3/Tramtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action3/Tramtypes&amp;diff=3951"/>
		<updated>2019-12-28T12:15:45Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial creation&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.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.10}} Tramtypes are available only in OpenTTD &amp;amp;gt; 1.10&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format of the data is feature-dependent. For tramtypes it looks like&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 13 &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;
|13&lt;br /&gt;
|B&lt;br /&gt;
|The feature byte for tramtypes&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 &amp;quot;cargo&amp;quot; types to support&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;cargo-type&amp;amp;gt;&lt;br /&gt;
|B&lt;br /&gt;
|&amp;quot;Cargo&amp;quot; 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;
=== 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;
=== num-cid ===&lt;br /&gt;
&lt;br /&gt;
Number of &amp;quot;cargo&amp;quot; type definitions that follow.&lt;br /&gt;
&lt;br /&gt;
=== cargo-type ===&lt;br /&gt;
&lt;br /&gt;
Tramtypes re-uses in its Action3 the &#039;cargo&#039;-type definition in order to assign the type of graphics defined by the associated set-ID:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;Cargo&#039; Type&lt;br /&gt;
!Sprite Type&lt;br /&gt;
!#Sprites&lt;br /&gt;
!Useage&lt;br /&gt;
|-&lt;br /&gt;
|00&lt;br /&gt;
|Icons and cursors&lt;br /&gt;
|12&lt;br /&gt;
|4 rail directions, autorail, depot, tunnel and convert rail. First all icons, then all cursors.&lt;br /&gt;
|-&lt;br /&gt;
|01&lt;br /&gt;
|Track overlays&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|19&lt;br /&gt;
|11 trackbit combinations, 4 slopes, and 4 dead ends. These sprites are &#039;&#039;&#039;required&#039;&#039;&#039; for tramtypes.&lt;br /&gt;
|-&lt;br /&gt;
|02&lt;br /&gt;
|Underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|19&lt;br /&gt;
|11 trackbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
|03&lt;br /&gt;
|Tunnel&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|4&lt;br /&gt;
|1 sprite for each direction. Sprite is overlay for track in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a train and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE. {{ottd|1.2|r23952}} If type 0A is defined as well, this sprite is used slightly different, see [[#Tunnel portal overlay (0A)|Tunnel portal overlay (0A)]].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|04&lt;br /&gt;
|Catenary front&lt;br /&gt;
|29&lt;br /&gt;
|11 trackbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|05&lt;br /&gt;
|Catenary back&lt;br /&gt;
|29&lt;br /&gt;
|11 trackbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|06&lt;br /&gt;
|Bridge surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|6&lt;br /&gt;
|2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|08&lt;br /&gt;
|Depots&lt;br /&gt;
|6&lt;br /&gt;
|Follows the original layout for depot sprites. If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn. If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
|0A&lt;br /&gt;
|Tunnel portal overlay&amp;lt;ref name=tunneloverlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|4&lt;br /&gt;
|{{ottd|1.2|r23952}} 1 sprite for each direction, order is SW, NW, NE, SE.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== GUI sprites (00) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== Track overlay (01) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== Track underlay (02) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== Catenary front (04)====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== Catenary back (05) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== Depot sprites (08) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Bridge surfaces (06) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Tunnel portal overlay (0A) ====&lt;br /&gt;
&lt;br /&gt;
If this &#039;cargo&#039; type is defined, tunnels for this railtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the sprite returned from type 03. Next, train sprites if applicable and then a grass overlay and finally the sprite from this type (0A). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RailtypeTunnelExample.png]]&lt;br /&gt;
&lt;br /&gt;
Variable 10 can be used to distinguish between several requested tunnel variations:&lt;br /&gt;
{| |-&lt;br /&gt;
! Lowest byte of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 10]] !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || This is a plain portal without any extra features (like tracks above).&lt;br /&gt;
|-&lt;br /&gt;
| all other values || reserved for future extensions (e.g. basetunnels).&lt;br /&gt;
|}&lt;br /&gt;
The other bytes of variable 10 are reserved, and must be masked.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== default set-ID ===&lt;br /&gt;
&lt;br /&gt;
The default set-ID would be used for tramtype callbacks. However, since there are currently no callbacks for tramtypes it should always result in a [[Action2/Only_Callback_Failure|callback-failure]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action3/Roadtypes&amp;diff=3950</id>
		<title>Action3/Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action3/Roadtypes&amp;diff=3950"/>
		<updated>2019-12-28T12:03:55Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: corrected the feature byte&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.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.10}} Roadtypes are available only in OpenTTD &amp;amp;gt; 1.10&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format of the data is feature-dependent. For roadtypes it looks like&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 12 &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;
|12&lt;br /&gt;
|B&lt;br /&gt;
|The feature byte for roadtypes&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 &amp;quot;cargo&amp;quot; types to support&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;cargo-type&amp;amp;gt;&lt;br /&gt;
|B&lt;br /&gt;
|&amp;quot;Cargo&amp;quot; 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;
=== 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;
=== num-cid ===&lt;br /&gt;
&lt;br /&gt;
Number of &amp;quot;cargo&amp;quot; type definitions that follow.&lt;br /&gt;
&lt;br /&gt;
=== cargo-type ===&lt;br /&gt;
&lt;br /&gt;
Roadtypes re-uses in its Action3 the &#039;cargo&#039;-type definition in order to assign the type of graphics defined by the associated set-ID:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;Cargo&#039; Type&lt;br /&gt;
!Sprite Type&lt;br /&gt;
!#Sprites&lt;br /&gt;
!Useage&lt;br /&gt;
|-&lt;br /&gt;
|00&lt;br /&gt;
|Icons and cursors&lt;br /&gt;
|12&lt;br /&gt;
|4 road directions, autoroad, depot, tunnel and convert road. First all icons, then all cursors.&lt;br /&gt;
|-&lt;br /&gt;
|01&lt;br /&gt;
|Track overlays&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|19&lt;br /&gt;
|11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.&lt;br /&gt;
|-&lt;br /&gt;
|02&lt;br /&gt;
|Underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|19&lt;br /&gt;
|11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
|03&lt;br /&gt;
|Tunnel&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|4&lt;br /&gt;
|1 sprite for each direction. Sprite is overlay for track in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a train and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE. {{ottd|1.2|r23952}} If type 0A is defined as well, this sprite is used slightly different, see [[#Tunnel portal overlay (0A)|Tunnel portal overlay (0A)]].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|04&lt;br /&gt;
|Catenary front&lt;br /&gt;
|29&lt;br /&gt;
|11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|05&lt;br /&gt;
|Catenary back&lt;br /&gt;
|29&lt;br /&gt;
|11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|06&lt;br /&gt;
|Bridge surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|6&lt;br /&gt;
|2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|08&lt;br /&gt;
|Depots&lt;br /&gt;
|6&lt;br /&gt;
|Follows the original layout for depot sprites. If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn. If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
|0A&lt;br /&gt;
|Tunnel portal overlay&amp;lt;ref name=tunneloverlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|4&lt;br /&gt;
|{{ottd|1.2|r23952}} 1 sprite for each direction, order is SW, NW, NE, SE.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0A?&lt;br /&gt;
|Road stops&lt;br /&gt;
|4&lt;br /&gt;
|Overlays for drive-in road stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== GUI sprites (00) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== Road underlay (02) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== Catenary front (04)====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== Catenary back (05) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== Depot sprites (08) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Bridge surfaces (06) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&lt;br /&gt;
==== Road stops (0A?)====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_drivein.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Tunnel portal overlay (0A) ====&lt;br /&gt;
&lt;br /&gt;
If this &#039;cargo&#039; type is defined, tunnels for this railtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the sprite returned from type 03. Next, train sprites if applicable and then a grass overlay and finally the sprite from this type (0A). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RailtypeTunnelExample.png]]&lt;br /&gt;
&lt;br /&gt;
Variable 10 can be used to distinguish between several requested tunnel variations:&lt;br /&gt;
{| |-&lt;br /&gt;
! Lowest byte of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 10]] !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || This is a plain portal without any extra features (like tracks above).&lt;br /&gt;
|-&lt;br /&gt;
| all other values || reserved for future extensions (e.g. basetunnels).&lt;br /&gt;
|}&lt;br /&gt;
The other bytes of variable 10 are reserved, and must be masked.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== default set-ID ===&lt;br /&gt;
&lt;br /&gt;
The default set-ID would be used for roadtype callbacks. However, since there are currently no callbacks for roadtypes it should always result in a [[Action2/Only_Callback_Failure|callback-failure]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action3/Roadtypes&amp;diff=3949</id>
		<title>Action3/Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action3/Roadtypes&amp;diff=3949"/>
		<updated>2019-12-28T12:03:00Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial creation&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.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.10}} Roadtypes are available only in OpenTTD &amp;amp;gt; 1.10&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
The format of the data is feature-dependent. For roadtypes it looks like&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 10 &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;
|12&lt;br /&gt;
|B&lt;br /&gt;
|The feature byte for roadtypes&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 &amp;quot;cargo&amp;quot; types to support&lt;br /&gt;
|-&lt;br /&gt;
|&amp;amp;lt;cargo-type&amp;amp;gt;&lt;br /&gt;
|B&lt;br /&gt;
|&amp;quot;Cargo&amp;quot; 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;
=== 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;
=== num-cid ===&lt;br /&gt;
&lt;br /&gt;
Number of &amp;quot;cargo&amp;quot; type definitions that follow.&lt;br /&gt;
&lt;br /&gt;
=== cargo-type ===&lt;br /&gt;
&lt;br /&gt;
Roadtypes re-uses in its Action3 the &#039;cargo&#039;-type definition in order to assign the type of graphics defined by the associated set-ID:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;Cargo&#039; Type&lt;br /&gt;
!Sprite Type&lt;br /&gt;
!#Sprites&lt;br /&gt;
!Useage&lt;br /&gt;
|-&lt;br /&gt;
|00&lt;br /&gt;
|Icons and cursors&lt;br /&gt;
|12&lt;br /&gt;
|4 road directions, autoroad, depot, tunnel and convert road. First all icons, then all cursors.&lt;br /&gt;
|-&lt;br /&gt;
|01&lt;br /&gt;
|Track overlays&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|19&lt;br /&gt;
|11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.&lt;br /&gt;
|-&lt;br /&gt;
|02&lt;br /&gt;
|Underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|19&lt;br /&gt;
|11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
|03&lt;br /&gt;
|Tunnel&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|4&lt;br /&gt;
|1 sprite for each direction. Sprite is overlay for track in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a train and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE. {{ottd|1.2|r23952}} If type 0A is defined as well, this sprite is used slightly different, see [[#Tunnel portal overlay (0A)|Tunnel portal overlay (0A)]].&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|04&lt;br /&gt;
|Catenary front&lt;br /&gt;
|29&lt;br /&gt;
|11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|05&lt;br /&gt;
|Catenary back&lt;br /&gt;
|29&lt;br /&gt;
|11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|06&lt;br /&gt;
|Bridge surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
|6&lt;br /&gt;
|2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
|08&lt;br /&gt;
|Depots&lt;br /&gt;
|6&lt;br /&gt;
|Follows the original layout for depot sprites. If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn. If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
|0A&lt;br /&gt;
|Tunnel portal overlay&amp;lt;ref name=tunneloverlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|4&lt;br /&gt;
|{{ottd|1.2|r23952}} 1 sprite for each direction, order is SW, NW, NE, SE.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0A?&lt;br /&gt;
|Road stops&lt;br /&gt;
|4&lt;br /&gt;
|Overlays for drive-in road stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== GUI sprites (00) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== Road underlay (02) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== Catenary front (04)====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== Catenary back (05) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== Depot sprites (08) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Bridge surfaces (06) ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&lt;br /&gt;
==== Road stops (0A?)====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_drivein.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== Tunnel portal overlay (0A) ====&lt;br /&gt;
&lt;br /&gt;
If this &#039;cargo&#039; type is defined, tunnels for this railtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the sprite returned from type 03. Next, train sprites if applicable and then a grass overlay and finally the sprite from this type (0A). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RailtypeTunnelExample.png]]&lt;br /&gt;
&lt;br /&gt;
Variable 10 can be used to distinguish between several requested tunnel variations:&lt;br /&gt;
{| |-&lt;br /&gt;
! Lowest byte of [[GlobalVariables#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|variable 10]] !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || This is a plain portal without any extra features (like tracks above).&lt;br /&gt;
|-&lt;br /&gt;
| all other values || reserved for future extensions (e.g. basetunnels).&lt;br /&gt;
|}&lt;br /&gt;
The other bytes of variable 10 are reserved, and must be masked.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== default set-ID ===&lt;br /&gt;
&lt;br /&gt;
The default set-ID would be used for roadtype callbacks. However, since there are currently no callbacks for roadtypes it should always result in a [[Action2/Only_Callback_Failure|callback-failure]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2/Tramtypes&amp;diff=3948</id>
		<title>VariationalAction2/Tramtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2/Tramtypes&amp;diff=3948"/>
		<updated>2019-12-28T11:29:28Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial creation&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;
&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;
==Example==&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=VariationalAction2/Roadtypes&amp;diff=3947</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=3947"/>
		<updated>2019-12-28T11:27:59Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial creation&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;
&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;
==Example==&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0&amp;diff=3946</id>
		<title>Action0</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0&amp;diff=3946"/>
		<updated>2019-12-28T11:16:16Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Feature */ split tramtypes from roadtypes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Action 0 allows to change the feature properties of &#039;features&#039;, i.e. vehicles, stations, bridges, houses and more.&lt;br /&gt;
Each feature has its own very specific properties. These are explained in detail in their separate pages.&lt;br /&gt;
&lt;br /&gt;
You will also find the minimum version requirements for properites on the pages.&lt;br /&gt;
Note, that due to the nature of Action 0 unknown properties cannot be ignored. Only a whole Action 0 can be skipped.&lt;br /&gt;
OpenTTD and TTDPatch will disable GRFs once they encounter an unknown property. So, if you use some properties for optional features, which you want to disable for older versions of OpenTTD or TTDPatch, you have to skip the Action 0 using [[Action9|Action 9]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
The data for Action 0 looks as follows:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;Sprite-number&amp;gt; * &amp;lt;Length&amp;gt; 00 &amp;lt;Feature&amp;gt; &amp;lt;Num-props&amp;gt; &amp;lt;Num-info&amp;gt; &amp;lt;Id&amp;gt; (&amp;lt;Property &amp;lt;New-info&amp;gt;)...&lt;br /&gt;
&lt;br /&gt;
Here is a short overview of what every term means:&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!Element!![[GRFActionsDetailed|Size]]!!Description&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 in the action&lt;br /&gt;
|-&lt;br /&gt;
|00 ||B||Action type. In this case, 00&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Feature&amp;gt; ||B||Which type of feature you would like to change&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Num-props&amp;gt; ||B||How many properties you would like to change per vehicle or station&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Num-info&amp;gt; ||B||How many vehicles/stations you would like to change&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Id&amp;gt; ||B*||The ID of the first vehicle/station to change&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Property&amp;gt; ||B||What property to change for each vehicle/station&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;New-info&amp;gt; ||V||The new value of the property&lt;br /&gt;
|}&lt;br /&gt;
You can put an Action 0 anywhere after [[Action8|Action 8]] in the GRF file.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.6|2.5|ttdprev=2.0.1 alpha 61}} The &amp;lt;Id&amp;gt; is an extended byte since TTDPatch 2.0.1 alpha 61, to support the definition of &amp;gt;255 sound effects.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.7|ottdrev=r13482}} {{grf|7|&amp;lt;7}} In OpenTTD since r13482, extended IDs (up to 65535) can be used for vehicles as well. However there is currently a caveat that articulated parts must be below 128.&lt;br /&gt;
{{ottdp|1.2}} {{grf|8}} In OpenTTD 1.2, extended IDs (up to 65535) can be used for vehicles as well. The ID for articulated vehicles must be below 8192.&lt;br /&gt;
&lt;br /&gt;
== Descriptions ==&lt;br /&gt;
&lt;br /&gt;
=== Sprite-number ===&lt;br /&gt;
&lt;br /&gt;
Action 0 can appear anywhere in the GRF file, so set it to the sprite number you are currently at.&lt;br /&gt;
&lt;br /&gt;
=== Length ===&lt;br /&gt;
&lt;br /&gt;
The total number of bytes in Action 0. Start counting from &amp;lt;Action&amp;gt;, the bit that sets the pseudo-sprite to act as the specified action.&lt;br /&gt;
&lt;br /&gt;
=== Action ===&lt;br /&gt;
&lt;br /&gt;
The type of action this pseudo-sprites defines. It should be 00 here because we want this pseudo-sprite to act as Action 0.&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;
!Value&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|[[Features|Feature]]&lt;br /&gt;
|-&lt;br /&gt;
|00 || [[Action0/Vehicles/Trains|Trains]]&lt;br /&gt;
|rowspan=&amp;quot;4&amp;quot;|[[Action0/Vehicles|Common vehicle properties]]&lt;br /&gt;
|-&lt;br /&gt;
|01 || [[Action0/Vehicles/RoadVehicles|Road Vehicles]]&lt;br /&gt;
|-&lt;br /&gt;
|02 || [[Action0/Vehicles/Ships|Ships]]&lt;br /&gt;
|-&lt;br /&gt;
|03 || [[Action0/Vehicles/Planes|Aircraft]]&lt;br /&gt;
|-&lt;br /&gt;
|04&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Stations|Stations]]&lt;br /&gt;
|-&lt;br /&gt;
|05 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Canals|Canals]]&lt;br /&gt;
|-&lt;br /&gt;
|06 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Bridges|Bridges]]&lt;br /&gt;
|-&lt;br /&gt;
|07 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Houses|Houses]] (see [[DefaultHouseProps|defaults]])&lt;br /&gt;
|-&lt;br /&gt;
|08 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Global Settings|Global Settings]]&lt;br /&gt;
|-&lt;br /&gt;
|09 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Industry Tiles|Industry Tiles]] (see [[IndustryTileDefaultProps|defaults]])&lt;br /&gt;
|-&lt;br /&gt;
|0A &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Industries|Industries]] (see [[IndustryDefaultProps|defaults]])&lt;br /&gt;
|-&lt;br /&gt;
|0B &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Cargos|Cargos]] (see [[CargoDefaultProps|defaults]])&lt;br /&gt;
|-&lt;br /&gt;
|0C &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Sound Effects|Sound Effects]]&lt;br /&gt;
|-&lt;br /&gt;
|0D &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Airports|Airports]]&lt;br /&gt;
|-&lt;br /&gt;
|0F &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| [[Action0/Objects|Objects]]&lt;br /&gt;
|-&lt;br /&gt;
|10 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| {{ottdp|1.0|no|ottdrev=r18969}} [[Action0/Railtypes|Railtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|11 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| {{ottdp|1.1|no|ottdrev=r19204}} [[Action0/Airport Tiles|Airport Tiles]]&lt;br /&gt;
|-&lt;br /&gt;
|12 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| {{ottdp|1.10|no|ottdrev=gc02ef3e456}} [[Action0/Roadtypes|Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
|13 &lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;| {{ottdp|1.10|no|ottdrev=gc02ef3e456}} [[Action0/Tramtypes|Tramtypes]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Num-props ===&lt;br /&gt;
&lt;br /&gt;
This is the number of properties that you wish to change per vehicle or station. Note: even if you wish to set the same properties to the same value for different vehicles then you must still repeat the properties and their values for each vehicle.&lt;br /&gt;
&lt;br /&gt;
=== Num-info ===&lt;br /&gt;
&lt;br /&gt;
Simply the number of vehicles that you will change using this action 0.&lt;br /&gt;
&lt;br /&gt;
=== Id ===&lt;br /&gt;
The [[VehicleIDs|Vehicle ID]] of the first vehicle or station to change. If num-info is greater than one, this vehicle/station and the following vehicles/stations will be changed.&lt;br /&gt;
&lt;br /&gt;
=== Property ===&lt;br /&gt;
&lt;br /&gt;
The number of the property that will be changed. This and the New-info section are repeated as many times as there are properties to set; in total, there are &amp;lt;&lt;br /&gt;
num-props&amp;gt; property bytes.&lt;br /&gt;
&lt;br /&gt;
See relevant sub-section (links at the bottom) for more details.&lt;br /&gt;
&lt;br /&gt;
=== New-info ===&lt;br /&gt;
&lt;br /&gt;
The new information that will replace the previous information for the specified property. This is a variable size; dependent upon the property. Each property byte is followed by &amp;lt;num-info&amp;gt; new-info sections.&lt;br /&gt;
The appropriate \b, \w, and \d escape sequences can be quite useful for most &amp;lt;&lt;br /&gt;
new-info&amp;gt;s. See [[GRFActionsDetailed#Byte order|the discussion of escape sequences]] for further information.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Roadtypes&amp;diff=3945</id>
		<title>NML:Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Roadtypes&amp;diff=3945"/>
		<updated>2019-12-28T11:10:19Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Roadtype properties */ updated TOWN_BUILD&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Roadtypes can only be defined in OpenTTD {{ottd|1.10}} and {{nml|0.5}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Roadtype IDs==&lt;br /&gt;
Roadtypes and Tramtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other roadtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (roadtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing roadtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Roadtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and roadtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which roadtype it is, and the roadtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A roadtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another roadtype is introduced, that references the roadtype via the introduced roadtype list (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_roadtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required roadtypes (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_roadtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_roadtype_list&amp;lt;/code&amp;gt; multiple roadtypes can be defined, which shall be considered equivalent to a roadtype.&lt;br /&gt;
This affects the interpretation of road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt;. If road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt; references an undefined roadtype, then&lt;br /&gt;
roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_roadtype_list&amp;lt;/code&amp;gt; is checked for all defined roadtypes, whether the vehicle can be reassigned to some other roadtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Roadtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default road types: &amp;quot;ROAD&amp;quot; and &amp;quot;ELRD&amp;quot;. See the [[RoadtypeLabels|List of roadtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this roadtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build road toolbar&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;road type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| Provide a list of road types that road vehicles of this type are powered on, e.g. [&amp;quot;ROAD&amp;quot;, &amp;quot;ELRD&amp;quot;]. Note that there is no &amp;quot;compatible_roadtype_list&amp;quot; since there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| roadtype_flags&lt;br /&gt;
| bitmask(ROADTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
;HIDDEN&lt;br /&gt;
:Hides the roadtype from players, but remains available to towns&lt;br /&gt;
;TOWN_BUILD&lt;br /&gt;
:Enables the roadtype to be built by towns, picked by highest speed (defaults to ROAD if no speed limits?)&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of road as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that need to be available to the company of the player for this road type to be introduced at (or after) the introduction date. This limit does not apply when the road type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that get introduced when this road type is introduced. For example, to make sure that when a fast road type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among road types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th roadtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of road of this roadtype. Default cost factors are 16 and 24 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types which this road type will act as fallback for, if the corresponding road type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with road types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal road&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified road&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| roadtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the road type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Roadtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| enhanced_tunnels&lt;br /&gt;
| 0&lt;br /&gt;
| Reserved for future use, always returns 0 in OpenTTD. Should custom tunnel entrances be implemented, other values than 0 might be returned&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits, based on tile location&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Roadtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For road types a number of callbacks are used to define road type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example roadtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for road in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a road vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this roadtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| roadstops&lt;br /&gt;
| 4&lt;br /&gt;
| Overlays for drive-in road stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default&amp;quot; graphics callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&lt;br /&gt;
==== roadstops ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_drivein.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this roadtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RoadtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for roadtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_ROADTYPES, highway, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;HWY_&amp;quot;;&lt;br /&gt;
         name:                       string(STR_HWY);&lt;br /&gt;
         menu_text:                  string(STR_HWY);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_roadtype_list:      [&amp;quot;HWY_&amp;quot;,&amp;quot;ROAD&amp;quot;];                          // Highways are compatible with other roads&lt;br /&gt;
         roadtype_flags:             bitmask(ROADTYPE_FLAG_NO_LEVEL_CROSSING, ROADTYPE_FLAG_NO_HOUSES); // Highways should not have level crossings or houses&lt;br /&gt;
         construction_cost:          32;                                       // Highways are expensive&lt;br /&gt;
         speed_limit:                100 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual roads&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the roads drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
         roadstops:       roadstops_switch;          // defines the look of roadstop pavement&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Tramtypes&amp;diff=3944</id>
		<title>Action0/Tramtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Tramtypes&amp;diff=3944"/>
		<updated>2019-12-28T11:07:50Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial tramtype spec&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&#039;&#039;Action 0 properties for tram types&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Action 0 - Properties for tram types =&lt;br /&gt;
&lt;br /&gt;
Defining properties of tram types.&lt;br /&gt;
&lt;br /&gt;
Up to 64 tramtypes can be defined.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Number&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Version&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Size&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|08&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|4*B&lt;br /&gt;
|Tram type label&lt;br /&gt;
|-&lt;br /&gt;
|09&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Build tram toolbar caption&amp;lt;!--&amp;lt;ref&amp;gt;{{grfTill|7}} For GRF version 7 or earlier, setting property 09 sets property 1B as well.&amp;lt;/ref&amp;gt;--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0A&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Tram construction dropdown text&lt;br /&gt;
|-&lt;br /&gt;
|0B&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Build vehicle window caption&lt;br /&gt;
|-&lt;br /&gt;
|0C&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Autoreplace text&lt;br /&gt;
|-&lt;br /&gt;
|0D&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: New engine text&lt;br /&gt;
|-&lt;br /&gt;
|0F&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B n*D &lt;br /&gt;
|Powered tram type list&amp;lt;ref name=&amp;quot;alt_label&amp;quot;&amp;gt;Tram type labels in this list are &#039;&#039;not&#039;&#039; resolved using the alternate label list.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B&lt;br /&gt;
|Tram type flags&lt;br /&gt;
|-&lt;br /&gt;
|13&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|Construction costs&lt;br /&gt;
|-&lt;br /&gt;
|14&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|Speed limit&lt;br /&gt;
|-&lt;br /&gt;
|16&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B&lt;br /&gt;
|Minimap colour&lt;br /&gt;
|-&lt;br /&gt;
|17&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|D&lt;br /&gt;
|Introduction date&lt;br /&gt;
|-&lt;br /&gt;
|18&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B n*D &lt;br /&gt;
|Introduction required tram type list&amp;lt;ref name=&amp;quot;alt_label&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|19&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B n*D &lt;br /&gt;
|Introduced tram type list&amp;lt;ref name=&amp;quot;alt_label&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1A&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B&lt;br /&gt;
|Sort order&lt;br /&gt;
|-&lt;br /&gt;
|1B&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Tram type name&amp;lt;!--&amp;lt;ref&amp;gt;{{grfTill|7}} For GRF version 7 or earlier, set property 1B &#039;&#039;after&#039;&#039; setting property 09, as property 09 sets the rail type name as well for backwards compatibility.&amp;lt;/ref&amp;gt;--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1C&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|Infrastructure maintenance cost factor&lt;br /&gt;
|-&lt;br /&gt;
|1D&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B n*D&lt;br /&gt;
|Alternate tram type labels that shall be &amp;quot;redirected&amp;quot; to this tram type&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In NFO, tram type IDs will be GRF local, with an ID to label mapping. Therefore to modify an existing tram type, specify its label in property 08. To create a new tram type, again just specify its label in property 08. This way there is no need for complex GRM mechanisms to allocate IDs. If a label &#039;clashes&#039; with another GRF, then one GRF will end up modifying the properties instead of creating a new tram type.&lt;br /&gt;
&lt;br /&gt;
When a new tram type is created, it is populated with the information from the first tram type, except that the powered list contains only the tram type being created. However, no default values should be assumed, as the first tram type may have been modified.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Tramtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and tramtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which tramtype it is, and the tramtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its tramtype (road vehicle prop 05) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its tramtype (road vehicle prop 05).&lt;br /&gt;
* A tramtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the tramtype (road vehicle prop 05).&lt;br /&gt;
** Another tramtype is introduced, that references the tramtype via the introduced tramtype list (tramtype prop 19).&lt;br /&gt;
** The introduction date (tramtype prop 17) is passed and all required tramtypes (tramtype prop 18) are available.&lt;br /&gt;
&lt;br /&gt;
Via tramtype property 1D multiple tramtypes can be defined, which shall be considered equivalent to a tramtype.&lt;br /&gt;
This affects the interpretation of road vehicle property 05. If road vehicle property 05 references an undefined tramtype, then&lt;br /&gt;
tramtype property 1D is checked for all defined tramtypes, whether the vehicle can be reassigned to some other tramtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
== Tram type label (08) ==&lt;br /&gt;
&lt;br /&gt;
These are globally unique four-letter identifiers for specific tram types (analoguous to [[Action0Cargos#Cargo label 17|cargo labels]]), used to make various tram types accessible from road vehicle grfs. Reserved labels for default tram types are:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Label&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Tram Type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|RAIL &lt;br /&gt;
| Normal Tram&lt;br /&gt;
|-&lt;br /&gt;
|ELRL &lt;br /&gt;
| Electrified Tram&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Tram type sets may use up to 64 tramtypes and have to specify their own [[TramtypeLabels|labels]].&lt;br /&gt;
&lt;br /&gt;
See also [[Action0/Global Settings#Tram type translation table 12|Tram Type Translation Table]] for further info.&lt;br /&gt;
&lt;br /&gt;
== Build tram toolbar caption (09) ==&lt;br /&gt;
&lt;br /&gt;
String ID of the name of the tram type as shown in the toolbar caption.&lt;br /&gt;
&lt;br /&gt;
== Tram construction dropdown text (0A) ==&lt;br /&gt;
&lt;br /&gt;
String ID for text in the dropdown of all tram types.&lt;br /&gt;
&lt;br /&gt;
This string must never start with a colour control code.&lt;br /&gt;
&lt;br /&gt;
== Build vehicle window caption (0B) ==&lt;br /&gt;
&lt;br /&gt;
String ID for build vehicle window caption.&lt;br /&gt;
&lt;br /&gt;
== Autoreplace text (0C) ==&lt;br /&gt;
&lt;br /&gt;
String ID for tram type shown in autoreplace window.&lt;br /&gt;
&lt;br /&gt;
== New engines (0D) ==&lt;br /&gt;
&lt;br /&gt;
StringID to use for showing texts of the type &amp;quot;We have invented a new &amp;amp;lt;tram type&amp;amp;gt; engine&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Powered tram type list (0F) ==&lt;br /&gt;
&lt;br /&gt;
List of tram types on which road vehicles of this tram type are powered. E.g. vehicles of &amp;quot;normal tram&amp;quot;-type are powered on &amp;quot;electrified tram&amp;quot;- and &amp;quot;haul-tram&amp;quot;-type as well. Note that there is no &amp;quot;compatible tram type list&amp;quot; since there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for tramtypes&lt;br /&gt;
&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;0E &amp;amp;lt;nvar&amp;amp;gt; (&amp;amp;lt;tram type label&amp;amp;gt;){n}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is you give the number of compatible tram types in a single byte followed by a list of that length of tram type labels. A tram type is automatically powered with itself, so you don&#039;t need to list the current tram type.&lt;br /&gt;
&lt;br /&gt;
Note that these properties apply to road vehicles of this tram type, not the tram itself. If you want road vehicles of other tram types to be able to run on your tram types, you must set the powered tram types property for each tram type. Setting these properties behaves always incremental, so you only need to the set additional bits for each other tram type, you cannot remove poweredness once it is set (by some other grf).&lt;br /&gt;
&lt;br /&gt;
== Tram type flags (10) ==&lt;br /&gt;
&lt;br /&gt;
Flags to define properties related to the tram type:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Bit&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Value&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Meaning&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|Draw catenary for this tram type&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|2&lt;br /&gt;
|Disallow level crossings for this tram type&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|4&lt;br /&gt;
|Disallow construction of houses along tramtype&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|8&lt;br /&gt;
|Hide this tram type from construction menu&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|16&lt;br /&gt;
|Enables towns to build tramtype, but towns don&#039;t build trams...&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Speed limit (14) ==&lt;br /&gt;
&lt;br /&gt;
Speed limit in mph*1.6 (approx. km/h). Set to &amp;quot;0&amp;quot; for no limit at all.&lt;br /&gt;
&lt;br /&gt;
== Map colour (16) ==&lt;br /&gt;
&lt;br /&gt;
This property defines the colour this tram type is drawn in the minimap view. The byte value specifies the colour entry in the [[PalettesAndCoordinates|DOS palette]].&lt;br /&gt;
&lt;br /&gt;
== Introduction date (17) ==&lt;br /&gt;
&lt;br /&gt;
This property defines the long date formatted introduction date of this tram type. With this property set the tram type will be introduced at (or after) this date when all of the introduction required tram types are available to the company of the player, or whenever a vehicle using this tram type gets introduced whichever is first.&lt;br /&gt;
&lt;br /&gt;
== Introduction required tram type list (18) ==&lt;br /&gt;
&lt;br /&gt;
List of tram types on that need to be available to the company of the player for this tram type to be introduced at (or after) the introduction date. This limit does not apply when the tram type is introduced by the introduction of a vehicle.&lt;br /&gt;
&lt;br /&gt;
Same format as for property 0F above.&lt;br /&gt;
&lt;br /&gt;
This can, for example, be used to introduce a tram type with catenary when both normal tram and electrified tram types are available.&lt;br /&gt;
&lt;br /&gt;
== Introduced tram type list (19) ==&lt;br /&gt;
&lt;br /&gt;
List of tram types that get introduced when this tram type is introduced. For example, to make sure that when a fast tram type is introduced the slow variant exists.&lt;br /&gt;
&lt;br /&gt;
Same format as for property 0F above.&lt;br /&gt;
&lt;br /&gt;
== Sort order (1A) ==&lt;br /&gt;
&lt;br /&gt;
Property for influencing the sort order of the drop down lists with tram types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Value&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Meaning&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|07&lt;br /&gt;
|Normal Tram&lt;br /&gt;
|-&lt;br /&gt;
|17&lt;br /&gt;
|Electrified Tram&lt;br /&gt;
|-&lt;br /&gt;
|n7&lt;br /&gt;
|Tramtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the tram type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
== Tram type name (1B) ==&lt;br /&gt;
&lt;br /&gt;
String ID of the name of the tram type.&lt;br /&gt;
&lt;br /&gt;
== Alternate tram type labels (1D) ==&lt;br /&gt;
&lt;br /&gt;
A list of alternate labels that get &amp;quot;redirected&amp;quot; to this tram type when used e.g. as tram type of road vehicle or when testing if a label is defined. The redirection only happens if the alternate label isn&#039;t defined as a real tram type. Same format as for property 0F above.&lt;br /&gt;
&lt;br /&gt;
Alternate labels are not considered when evaluating properties 0F, 18, and 19.&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
&lt;br /&gt;
To be written&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Main_Page&amp;diff=3943</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Main_Page&amp;diff=3943"/>
		<updated>2019-12-28T10:52:34Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: split tramtypes from roadtypes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Sprite types ==&lt;br /&gt;
;[[Action0]] - Defines new properties for anything added or changed by the NewGRF&lt;br /&gt;
:{| |-&lt;br /&gt;
|rowspan=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:3em&amp;quot;|&#039;&#039;&#039;0&#039;&#039;&#039;&lt;br /&gt;
| [[Action0/Vehicles | Vehicles]]&lt;br /&gt;
| [[Action0/Vehicles/Trains | Trains]]&lt;br /&gt;
| [[Action0/Vehicles/RoadVehicles | RoadVehicles]]&lt;br /&gt;
| [[Action0/Vehicles/Ships | Ships]]&lt;br /&gt;
| [[Action0/Vehicles/Planes | Aircraft]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action0/Stations | Stations]]&lt;br /&gt;
| [[Action0/Canals | Canals &amp;amp; Rivers]]&lt;br /&gt;
| [[Action0/Bridges | Bridges]]&lt;br /&gt;
| [[Action0/Houses | Houses]]&lt;br /&gt;
| [[Action0/Global Settings | Global Settings]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action0/Industry Tiles | Industry Tiles]]&lt;br /&gt;
| [[Action0/Industries | Industries]]&lt;br /&gt;
| [[Action0/Cargos | Cargos]]&lt;br /&gt;
| [[Action0/Sound Effects | Sound Effects]]&lt;br /&gt;
| [[Action0/Airports | Airports]]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Signals&#039;&#039;&lt;br /&gt;
| [[Action0/Objects | Objects]]&lt;br /&gt;
| [[Action0/Railtypes | Railtypes]]&lt;br /&gt;
| [[Action0/Airport Tiles | Airport Tiles]]&lt;br /&gt;
| [[Action0/Roadtypes | Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action0/Tramtypes | Tramtypes]]&lt;br /&gt;
| &#039;&#039;Towns&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
;[[Action1]] - Defines one or more graphics sets&lt;br /&gt;
;[[Action2]] - Defines graphics set IDs&lt;br /&gt;
* Basic Action2&lt;br /&gt;
:{| |-&lt;br /&gt;
|rowspan=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:3em&amp;quot;|&#039;&#039;&#039;2&#039;&#039;&#039;&lt;br /&gt;
|colspan=5| [[Action2/Vehicles | Vehicles]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action2/Stations | Stations]]&lt;br /&gt;
| [[Action2/Single Set | Canals &amp;amp; Rivers]]&lt;br /&gt;
| &#039;&#039;Bridges&#039;&#039;&lt;br /&gt;
| [[Action2/Sprite Layout | Houses]]&lt;br /&gt;
| &#039;&#039;Global Settings&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[Action2/Sprite Layout | Industry Tiles]]&lt;br /&gt;
| [[Action2/Industries | Industries]]&lt;br /&gt;
| [[Action2/Single Set | Cargos]]&lt;br /&gt;
| [[Action2/Only Callback Failure | Sound Effects]]&lt;br /&gt;
| [[Action2/Single Set | Airports]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action2/Only Callback Failure | Signals]]&lt;br /&gt;
| [[Action2/Sprite Layout | Objects]]&lt;br /&gt;
| [[Action2/Single Set | Railtypes]]&lt;br /&gt;
| [[Action2/Sprite Layout | Airport Tiles]]&lt;br /&gt;
| [[Action2/Single Set | Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action2/Single Set | Tramtypes]]&lt;br /&gt;
| &#039;&#039;Towns&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
* [[VariationalAction2]] - A conditional switch that determines a [[Callbacks|callback]] result or chains to another Action 2&lt;br /&gt;
: [[VarAction2Advanced]] - Advanced features of Variational Action 2&lt;br /&gt;
: [[GlobalVariables | Global Variables]]&lt;br /&gt;
:{| |-&lt;br /&gt;
|rowspan=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:3em&amp;quot;|&#039;&#039;&#039;VA2&#039;&#039;&#039;&lt;br /&gt;
|colspan=5| [[VariationalAction2/Vehicles | Vehicles]]&lt;br /&gt;
|-&lt;br /&gt;
| [[VariationalAction2/Stations | Stations]]&lt;br /&gt;
| [[VariationalAction2/Canals | Canals &amp;amp; Rivers]]&lt;br /&gt;
| [[VariationalAction2/Bridges | Bridges]]&lt;br /&gt;
| [[VariationalAction2/Houses | Houses]]&lt;br /&gt;
| &#039;&#039;Global Settings&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[VariationalAction2/Industry Tiles | Industry Tiles]]&lt;br /&gt;
| [[VariationalAction2/Industries | Industries]]&lt;br /&gt;
| [[VariationalAction2/Cargos | Cargos]]&lt;br /&gt;
| &#039;&#039;Sound Effects&#039;&#039;&lt;br /&gt;
| [[VariationalAction2/Airports | Airports]]&lt;br /&gt;
|-&lt;br /&gt;
| [[VariationalAction2/Signals | Signals]]&lt;br /&gt;
| [[VariationalAction2/Objects | Objects]]&lt;br /&gt;
| [[VariationalAction2/Railtypes | Railtypes]]&lt;br /&gt;
| [[VariationalAction2/Airport Tiles | Airport Tiles]]&lt;br /&gt;
| [[VariationalAction2/Roadtypes | Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
| [[VariationalAction2/Tramtypes | Tramtypes]]&lt;br /&gt;
| [[VariationalAction2/Towns | Towns]]&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
* [[RandomAction2]] - A randomized Variational Action 2&lt;br /&gt;
:{| |-&lt;br /&gt;
|rowspan=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:3em&amp;quot;|&#039;&#039;&#039;R&#039;&#039;&#039;&lt;br /&gt;
|colspan=5| [[RandomAction2#Vehicles | Vehicles]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RandomAction2#Stations | Stations]]&lt;br /&gt;
| [[RandomAction2#Canals | Canals &amp;amp; Rivers]]&lt;br /&gt;
| &#039;&#039;Bridges&#039;&#039;&lt;br /&gt;
| [[RandomAction2#Town_building_triggers | Houses]]&lt;br /&gt;
| &#039;&#039;Global Settings&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[RandomAction2#Industry_tile_triggers | Industry Tiles]]&lt;br /&gt;
| [[RandomAction2#Industry_tile_triggers | Industries]]&lt;br /&gt;
| &#039;&#039;Cargos&#039;&#039;&lt;br /&gt;
| &#039;&#039;Sound Effects&#039;&#039;&lt;br /&gt;
| [[RandomAction2#Stations | Airports]]&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;Signals&#039;&#039;&lt;br /&gt;
| [[RandomAction2#Objects | Objects]]&lt;br /&gt;
| [[RandomAction2#Rail_types | Railtypes]]&lt;br /&gt;
| [[RandomAction2#Stations | Airport Tiles]]&lt;br /&gt;
| [[RandomAction2#Road_types | Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
| [[RandomAction2#Tram_types | Tramtypes]]&lt;br /&gt;
| &#039;&#039;Towns&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* [[Callbacks]] - List of available callbacks&lt;br /&gt;
&lt;br /&gt;
;[[Action3]] - Associates Action 2s with an Action 0&lt;br /&gt;
:{| |-&lt;br /&gt;
|rowspan=&amp;quot;5&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:3em&amp;quot;|&#039;&#039;&#039;3&#039;&#039;&#039;&lt;br /&gt;
|colspan=5| [[Action3 | Vehicles]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action3 | Stations]]&lt;br /&gt;
| [[Action3/Canals | Canals &amp;amp; Rivers]]&lt;br /&gt;
| &#039;&#039;Bridges&#039;&#039;&lt;br /&gt;
| [[Action3 | Houses]]&lt;br /&gt;
| &#039;&#039;Global Settings&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| [[Action3 | Industry Tiles]]&lt;br /&gt;
| [[Action3 | Industries]]&lt;br /&gt;
| [[Action3 | Cargos]]&lt;br /&gt;
| [[Action3 | Sound Effects]]&lt;br /&gt;
| [[Action3 | Airports]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action3 | Signals]]&lt;br /&gt;
| [[Action3 | Objects]]&lt;br /&gt;
| [[Action3/Railtypes | Railtypes]]&lt;br /&gt;
| [[Action3 | Airport Tiles]]&lt;br /&gt;
| [[Action3/Roadtypes | Roadtypes]]&lt;br /&gt;
|-&lt;br /&gt;
| [[Action3/Tramtypes | Tramtypes]]&lt;br /&gt;
| &#039;&#039;Towns&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
: [[Action3LiveryOverride]] - Change wagon livery to match the engine&lt;br /&gt;
;[[Action4]] - Defines text strings&lt;br /&gt;
;[[Action5]] - Replaces base set sprites not present in the original TTD.&lt;br /&gt;
;[[Action6]] - Modifies the contents of the following sprite&lt;br /&gt;
;[[Action7]] - Conditionally skips sprites or jumps to a label&lt;br /&gt;
: [[TTDPatchFlags| GameConfigFlags]] - Configuration flags for Action 7/9 Variable 85&lt;br /&gt;
;[[Action8]] - Defines GRFID, Name and Description&lt;br /&gt;
;[[Action9]] - (see action 7 above)&lt;br /&gt;
;[[ActionA]] - Replaces TTD base set sprites&lt;br /&gt;
;[[ActionB]] - Generates an error message&lt;br /&gt;
;[[ActionC]] - Does nothing (can be used to embed comments)&lt;br /&gt;
;[[ActionD]] - Assigns parameters and calculates results&lt;br /&gt;
* [[ReadingOtherGRFParameters]] - Reading another GRF file&#039;s parameters&lt;br /&gt;
* [[ReadingPatchVariables| ReadingGameSettings]] - Reading game configuration settings&lt;br /&gt;
* [[GRFResourceManagement]] - Preventing conflicts with limited resources&lt;br /&gt;
;[[ActionE]] - Deactivates a NewGRF file&lt;br /&gt;
;[[ActionF]] - Defines new town name styles&lt;br /&gt;
;[[Action10]] - Defines a label for action 7/9&lt;br /&gt;
;[[Action11]] - Defines new sounds&lt;br /&gt;
;[[Action12]] - Adds Unicode font glyphs&lt;br /&gt;
;[[Action13]] - Translates GRF-specific strings&lt;br /&gt;
;[[Action14]] - Static NewGRF information (OpenTTD only)&lt;br /&gt;
;[[RealSprites]] - Sprites that actually are drawn on the screen&lt;br /&gt;
;[[RecolorSprites]] - Changing other sprites&#039; colors&lt;br /&gt;
&lt;br /&gt;
== Graphics properties ==&lt;br /&gt;
* [[PalettesAndCoordinates#Palettes | Palettes]] - Palettes used by the game&lt;br /&gt;
* [[PalettesAndCoordinates#Coordinates | Coordinates]] - Coordinates used for sprite alignement&lt;br /&gt;
&lt;br /&gt;
== TTD defaults ==&lt;br /&gt;
* [[DefaultHouseProps]] - Default property values for TTD&#039;s houses&lt;br /&gt;
* [[IndustryTileDefaultProps]] - Default property values for TTD&#039;s industry tiles&lt;br /&gt;
* [[IndustryDefaultProps]] - Default properties values for TTD&#039;s industries&lt;br /&gt;
* [[CargoDefaultProps]] - Default property values for TTD&#039;s cargo types&lt;br /&gt;
* [[VehicleIDs]] - Default vehicle IDs&lt;br /&gt;
* [[NML:Default_Vehicle_Properties]] - Default Vehicle Properties (NML)&lt;br /&gt;
* [[AirportTypes]] - Default Airport IDs&lt;br /&gt;
* [[AirportTileDefaultProps]] - Default airport tile properties&lt;br /&gt;
&lt;br /&gt;
== NewGRF commons ==&lt;br /&gt;
* [[Action0Cargos#CargoClasses_.2816.29 | Cargo classes]] - Commonly used cargo classes&lt;br /&gt;
* [[CargoTypes | Cargo labels]] - Commonly used cargo labels&lt;br /&gt;
* [[ObjectLabels | Object classes]] - Commonly used object clases&lt;br /&gt;
* [[RailtypeLabels | Railtype labels]] - Commonly used railtype labels&lt;br /&gt;
&lt;br /&gt;
== Misc ==&lt;br /&gt;
* [[Features]] - List of all features and feature-specific actions.&lt;br /&gt;
* [[BaseCosts | Base Costs]]&lt;br /&gt;
* [[VehicleRefitting | Vehicle Refitting]]&lt;br /&gt;
* [[GrfLoadingStages | GRF loading stages]]&lt;br /&gt;
* [[GlobalVariables | Global variables]]&lt;br /&gt;
* [[Storages | Storages]]&lt;br /&gt;
* [[StringCodes | String control codes]]&lt;br /&gt;
* [[TextIDs | Text IDs (TTD + TTDPatch + NewGRF defined)]]&lt;br /&gt;
* [[GRFActionsDetailed | Syntax details]]&lt;br /&gt;
* [[Version numbers | Types of version numbers used throughout the specs]]&lt;br /&gt;
* [[DebuggingGRFCode | Debugging NewGRFs]]&lt;br /&gt;
* [[SpriteErrors | TTDPatch error codes on loading NewGRFs]]&lt;br /&gt;
&lt;br /&gt;
== Game mechanics ==&lt;br /&gt;
* [[TownZones | Town zones]]&lt;br /&gt;
* [[NMLMain | NML]]&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Features&amp;diff=3942</id>
		<title>Features</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Features&amp;diff=3942"/>
		<updated>2019-12-28T10:48:02Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* List of features and feature-specific Actions */ split tram types from road types&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==List of features and feature-specific Actions==&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|Feature || [[Action0]] || [[Action1]] || [[Action2]] || [[VariationalAction2 | VarAction2]] || [[RandomAction2]] || [[Callbacks]] || [[Action3]] || [[Action4]]&lt;br /&gt;
|-&lt;br /&gt;
|00 || Trains || [[Action0/Vehicles/Trains | yes]] || [[Action1 | yes]] || [[Action2/Vehicles | yes]] || [[VariationalAction2/Vehicles | yes]] || [[RandomAction2#Vehicles | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|01 || Road Vehicles || [[Action0/Vehicles/RoadVehicles | yes]] || [[Action1 | yes]] || [[Action2/Vehicles | yes]] || [[VariationalAction2/Vehicles | yes]] || [[RandomAction2#Vehicles | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|02 || Ships || [[Action0/Vehicles/Ships | yes]] || [[Action1 | yes]] || [[Action2/Vehicles | yes]] || [[VariationalAction2/Vehicles | yes]] || [[RandomAction2#Vehicles | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|03 || Aircraft || [[Action0/Vehicles/Planes | yes]] || [[Action1 | yes]] || [[Action2/Vehicles | yes]] || [[VariationalAction2/Vehicles | yes]] || [[RandomAction2#Vehicles | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|04 || Stations || [[Action0/Stations | yes]] || [[Action1 | yes]] || [[Action2/Stations | yes]] || [[VariationalAction2/Stations | yes]] || [[RandomAction2#Stations | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|05 || Canals || [[Action0/Canals | yes]] || [[Action1 | yes]] || [[Action2/Single Set | yes]] || [[VariationalAction2/Canals | yes]] || [[RandomAction2#Canals | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || &#039;&#039;no&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|06 || Bridges || [[Action0/Bridges | yes]] || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || [[VariationalAction2/Bridges | no-ish]] || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || [[Action0/Bridges#Purchase_text_.2810.29 | yes-ish]]&lt;br /&gt;
|-&lt;br /&gt;
|07 || Houses || [[Action0/Houses | yes]] || [[Action1 | yes]] || [[Action2/Sprite Layout | yes]] || [[VariationalAction2/Houses | yes]] || [[RandomAction2#Town_building_triggers | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|08 || Global Settings || [[Action0/Global Settings | yes]] || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|09 || Industry Tiles || [[Action0/Industry Tiles | yes]] || [[Action1 | yes]] || [[Action2/Sprite Layout | yes]] || [[VariationalAction2/Industry Tiles | yes]] || [[RandomAction2#Industry_tile_triggers | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || &#039;&#039;no&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|0A || Industries || [[Action0/Industries | yes]] || [[Action1 | yes]] || [[Action2/Industries | yes]] || [[VariationalAction2/Industries | yes]] || [[RandomAction2#Industry_tile_triggers | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|0B || Cargos || [[Action0/Cargos | yes]] || [[Action1 | yes]] || [[Action2/Single Set | yes]] || [[VariationalAction2 | yes-ish]] &amp;lt;ref name=&amp;quot;novars&amp;quot;&amp;gt;No feature specific variables though&amp;lt;/ref&amp;gt; || &#039;&#039;no&#039;&#039; || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|0C || Sound Effects || [[Action0/Sound Effects | yes]] || &#039;&#039;no&#039;&#039; || [[Action2/Only Callback Failure | yes-ish]] &amp;lt;ref name=&amp;quot;failonly&amp;quot;&amp;gt;Callback failure only&amp;lt;/ref&amp;gt; || [[VariationalAction2 | yes-ish]] &amp;lt;ref name=&amp;quot;novars&amp;quot;/&amp;gt; || &#039;&#039;no&#039;&#039; || [[Callbacks | yes]] || [[Action3 | yes]] || &#039;&#039;no&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|0D || Airports || [[Action0/Airports | yes]] || [[Action1 | yes]] || [[Action2/Single Set | yes]] || [[VariationalAction2/Airports | yes]] || [[RandomAction2#Stations | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|0E || Signals || &#039;&#039;no&#039;&#039; || [[Action5#0E_New_Signals | Action5]] || [[Action2/Only Callback Failure | yes-ish]] &amp;lt;ref name=&amp;quot;failonly&amp;quot;/&amp;gt; || [[VariationalAction2/Signals | yes]] || &#039;&#039;no&#039;&#039; || [[Callbacks | yes]] || [[Action3 | yes]] || &#039;&#039;no&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|0F || Objects || [[Action0/Objects | yes]] || [[Action1 | yes]] || [[Action2/Sprite Layout | yes]] || [[VariationalAction2/Objects | yes]] || [[RandomAction2#Objects | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|10 || Railtypes || [[Action0/Railtypes | yes]] || [[Action1 | yes]] || [[Action2/Single Set | yes]] || [[VariationalAction2/Railtypes | yes]] || [[RandomAction2#Rail_types | yes]] || &#039;&#039;no&#039;&#039; || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|11 || Airport Tiles || [[Action0/Airport Tiles | yes]] || [[Action1 | yes]] || [[Action2/Sprite Layout | yes]] || [[VariationalAction2/Airport Tiles | yes]] || [[RandomAction2#Stations | yes]] || [[Callbacks | yes]] || [[Action3 | yes]] || &#039;&#039;no&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|12 || Roadtypes || [[Action0/Roadtypes | yes]] || [[Action1 | yes]] || [[Action2/Single Set | yes]] || [[VariationalAction2/Roadtypes | yes]] || [[RandomAction2#Road_types | yes]] || &#039;&#039;no&#039;&#039; || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|13 || Tramtypes || [[Action0/Tramtypes | yes]] || [[Action1 | yes]] || [[Action2/Single Set | yes]] || [[VariationalAction2/Tramtypes | yes]] || [[RandomAction2#Tram_types | yes]] || &#039;&#039;no&#039;&#039; || [[Action3 | yes]] || [[Action4 | yes]]&lt;br /&gt;
|-&lt;br /&gt;
|N/A &amp;lt;!-- Towns have no feature. NML and OTTD assign a pseudo feature number, but this does not mean there is an actual feature number --&amp;gt;&lt;br /&gt;
| Towns || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || [[VariationalAction2/Towns | yes]] || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || [[ActionF]]&lt;br /&gt;
|-&lt;br /&gt;
|48 || Original Strings &amp;lt;ref&amp;gt;This is a pseudo-feature only used in Action4 to assign original strings. The value 0x48 originates from the way old TTDPatch versions checked for switches enabling/disabling features. NewTrains (feature 0x00) are activated by [[TTDPatchFlags | switch 0x37]]. Adding 0x48 to that results in 0x7F - a switch which is always set when TTDPatch is active. Thus feature 0x48 was not disabled by any switch. (today TTDPatch does not depend on the switches being in order of the features)&amp;lt;/ref&amp;gt; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || &#039;&#039;no&#039;&#039; || [[Action4 | yes]]&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Roadtypes&amp;diff=3941</id>
		<title>Action0/Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Roadtypes&amp;diff=3941"/>
		<updated>2019-12-28T10:34:39Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial roadtype spec&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;&#039;&#039;Action 0 properties for road types&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Action 0 - Properties for road types =&lt;br /&gt;
&lt;br /&gt;
Defining properties of road types.&lt;br /&gt;
&lt;br /&gt;
Up to 64 roadtypes can be defined.&lt;br /&gt;
&lt;br /&gt;
== Properties ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Number&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Version&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Size&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|08&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|4*B&lt;br /&gt;
|Road type label&lt;br /&gt;
|-&lt;br /&gt;
|09&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Build road toolbar caption&amp;lt;!--&amp;lt;ref&amp;gt;{{grfTill|7}} For GRF version 7 or earlier, setting property 09 sets property 1B as well.&amp;lt;/ref&amp;gt;--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0A&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Road construction dropdown text&lt;br /&gt;
|-&lt;br /&gt;
|0B&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Build vehicle window caption&lt;br /&gt;
|-&lt;br /&gt;
|0C&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Autoreplace text&lt;br /&gt;
|-&lt;br /&gt;
|0D&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: New engine text&lt;br /&gt;
|-&lt;br /&gt;
|0F&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B n*D &lt;br /&gt;
|Powered road type list&amp;lt;ref name=&amp;quot;alt_label&amp;quot;&amp;gt;Road type labels in this list are &#039;&#039;not&#039;&#039; resolved using the alternate label list.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|10&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B&lt;br /&gt;
|Road type flags&lt;br /&gt;
|-&lt;br /&gt;
|13&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|Construction costs&lt;br /&gt;
|-&lt;br /&gt;
|14&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|Speed limit&lt;br /&gt;
|-&lt;br /&gt;
|16&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B&lt;br /&gt;
|Minimap colour&lt;br /&gt;
|-&lt;br /&gt;
|17&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|D&lt;br /&gt;
|Introduction date&lt;br /&gt;
|-&lt;br /&gt;
|18&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B n*D &lt;br /&gt;
|Introduction required road type list&amp;lt;ref name=&amp;quot;alt_label&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|19&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B n*D &lt;br /&gt;
|Introduced road type list&amp;lt;ref name=&amp;quot;alt_label&amp;quot; /&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1A&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B&lt;br /&gt;
|Sort order&lt;br /&gt;
|-&lt;br /&gt;
|1B&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|StringID: Road type name&amp;lt;!--&amp;lt;ref&amp;gt;{{grfTill|7}} For GRF version 7 or earlier, set property 1B &#039;&#039;after&#039;&#039; setting property 09, as property 09 sets the rail type name as well for backwards compatibility.&amp;lt;/ref&amp;gt;--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1C&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|W&lt;br /&gt;
|Infrastructure maintenance cost factor&lt;br /&gt;
|-&lt;br /&gt;
|1D&lt;br /&gt;
|{{ottdp|1.10}}&lt;br /&gt;
|B n*D&lt;br /&gt;
|Alternate road type labels that shall be &amp;quot;redirected&amp;quot; to this road type&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In NFO, road type IDs will be GRF local, with an ID to label mapping. Therefore to modify an existing road type, specify its label in property 08. To create a new road type, again just specify its label in property 08. This way there is no need for complex GRM mechanisms to allocate IDs. If a label &#039;clashes&#039; with another GRF, then one GRF will end up modifying the properties instead of creating a new road type.&lt;br /&gt;
&lt;br /&gt;
When a new road type is created, it is populated with the information from the first road type, except that the powered list contains only the road type being created. However, no default values should be assumed, as the first road type may have been modified.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Roadtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and roadtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which roadtype it is, and the roadtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its roadtype (road vehicle prop 05) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its roadtype (road vehicle prop 05).&lt;br /&gt;
* A roadtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the roadtype (road vehicle prop 05).&lt;br /&gt;
** Another roadtype is introduced, that references the roadtype via the introduced roadtype list (roadtype prop 19).&lt;br /&gt;
** The introduction date (roadtype prop 17) is passed and all required roadtypes (roadtype prop 18) are available.&lt;br /&gt;
&lt;br /&gt;
Via roadtype property 1D multiple roadtypes can be defined, which shall be considered equivalent to a roadtype.&lt;br /&gt;
This affects the interpretation of road vehicle property 05. If road vehicle property 05 references an undefined roadtype, then&lt;br /&gt;
roadtype property 1D is checked for all defined roadtypes, whether the vehicle can be reassigned to some other roadtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
== Road type label (08) ==&lt;br /&gt;
&lt;br /&gt;
These are globally unique four-letter identifiers for specific road types (analoguous to [[Action0Cargos#Cargo label 17|cargo labels]]), used to make various road types accessible from road vehicle grfs. Reserved labels for default road types are:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Label&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Road Type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ROAD &lt;br /&gt;
| Normal Road&lt;br /&gt;
|-&lt;br /&gt;
|ELRD &lt;br /&gt;
| Electrified Road&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Road type sets may use up to 64 roadtypes and have to specify their own [[RoadtypeLabels|labels]].&lt;br /&gt;
&lt;br /&gt;
See also [[Action0/Global Settings#Road type translation table 12|Road Type Translation Table]] for further info.&lt;br /&gt;
&lt;br /&gt;
== Build road toolbar caption (09) ==&lt;br /&gt;
&lt;br /&gt;
String ID of the name of the road type as shown in the toolbar caption.&lt;br /&gt;
&lt;br /&gt;
== Road construction dropdown text (0A) ==&lt;br /&gt;
&lt;br /&gt;
String ID for text in the dropdown of all road types.&lt;br /&gt;
&lt;br /&gt;
This string must never start with a colour control code.&lt;br /&gt;
&lt;br /&gt;
== Build vehicle window caption (0B) ==&lt;br /&gt;
&lt;br /&gt;
String ID for build vehicle window caption.&lt;br /&gt;
&lt;br /&gt;
== Autoreplace text (0C) ==&lt;br /&gt;
&lt;br /&gt;
String ID for road type shown in autoreplace window.&lt;br /&gt;
&lt;br /&gt;
== New engines (0D) ==&lt;br /&gt;
&lt;br /&gt;
StringID to use for showing texts of the type &amp;quot;We have invented a new &amp;amp;lt;road type&amp;amp;gt; engine&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
== Powered road type list (0F) ==&lt;br /&gt;
&lt;br /&gt;
List of road types on which road vehicles of this road type are powered. E.g. vehicles of &amp;quot;normal road&amp;quot;-type are powered on &amp;quot;electrified road&amp;quot;- and &amp;quot;haul-road&amp;quot;-type as well. Note that there is no &amp;quot;compatible road type list&amp;quot; since there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for roadtypes&lt;br /&gt;
&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;0E &amp;amp;lt;nvar&amp;amp;gt; (&amp;amp;lt;road type label&amp;amp;gt;){n}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That is you give the number of compatible road types in a single byte followed by a list of that length of road type labels. A road type is automatically powered with itself, so you don&#039;t need to list the current road type.&lt;br /&gt;
&lt;br /&gt;
Note that these properties apply to road vehicles of this road type, not the road itself. If you want road vehicles of other road types to be able to run on your road types, you must set the powered road types property for each road type. Setting these properties behaves always incremental, so you only need to the set additional bits for each other road type, you cannot remove poweredness once it is set (by some other grf).&lt;br /&gt;
&lt;br /&gt;
== Road type flags (10) ==&lt;br /&gt;
&lt;br /&gt;
Flags to define properties related to the road type:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Bit&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Value&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Meaning&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|Draw catenary for this road type&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|2&lt;br /&gt;
|Disallow level crossings for this road type&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|4&lt;br /&gt;
|Disallow construction of houses along roadtype&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|8&lt;br /&gt;
|Hide this road type from construction menu&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|16&lt;br /&gt;
|Enables road type to be built by towns, picked by highest speed limit (defaults to ROAD label if no speed limits?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Speed limit (14) ==&lt;br /&gt;
&lt;br /&gt;
Speed limit in mph*1.6 (approx. km/h). Set to &amp;quot;0&amp;quot; for no limit at all.&lt;br /&gt;
&lt;br /&gt;
== Map colour (16) ==&lt;br /&gt;
&lt;br /&gt;
This property defines the colour this road type is drawn in the minimap view. The byte value specifies the colour entry in the [[PalettesAndCoordinates|DOS palette]].&lt;br /&gt;
&lt;br /&gt;
== Introduction date (17) ==&lt;br /&gt;
&lt;br /&gt;
This property defines the long date formatted introduction date of this road type. With this property set the road type will be introduced at (or after) this date when all of the introduction required road types are available to the company of the player, or whenever a vehicle using this road type gets introduced whichever is first.&lt;br /&gt;
&lt;br /&gt;
== Introduction required road type list (18) ==&lt;br /&gt;
&lt;br /&gt;
List of road types on that need to be available to the company of the player for this road type to be introduced at (or after) the introduction date. This limit does not apply when the road type is introduced by the introduction of a vehicle.&lt;br /&gt;
&lt;br /&gt;
Same format as for property 0F above.&lt;br /&gt;
&lt;br /&gt;
This can, for example, be used to introduce a road type with streetlights when both paved road and electrified road types are available.&lt;br /&gt;
&lt;br /&gt;
== Introduced road type list (19) ==&lt;br /&gt;
&lt;br /&gt;
List of road types that get introduced when this road type is introduced. For example, to make sure that when a fast road type is introduced the slow variant exists.&lt;br /&gt;
&lt;br /&gt;
Same format as for property 0F above.&lt;br /&gt;
&lt;br /&gt;
== Sort order (1A) ==&lt;br /&gt;
&lt;br /&gt;
Property for influencing the sort order of the drop down lists with road types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!&#039;&#039;&#039;Value&#039;&#039;&#039;&lt;br /&gt;
!&#039;&#039;&#039;Meaning&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|07&lt;br /&gt;
|Normal Road&lt;br /&gt;
|-&lt;br /&gt;
|17&lt;br /&gt;
|Electrified Road&lt;br /&gt;
|-&lt;br /&gt;
|n7&lt;br /&gt;
|Roadtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the road type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
== Road type name (1B) ==&lt;br /&gt;
&lt;br /&gt;
String ID of the name of the road type.&lt;br /&gt;
&lt;br /&gt;
== Alternate road type labels (1D) ==&lt;br /&gt;
&lt;br /&gt;
A list of alternate labels that get &amp;quot;redirected&amp;quot; to this road type when used e.g. as road type of road vehicle or when testing if a label is defined. The redirection only happens if the alternate label isn&#039;t defined as a real road type. Same format as for property 0F above.&lt;br /&gt;
&lt;br /&gt;
Alternate labels are not considered when evaluating properties 0F, 18, and 19.&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
&lt;br /&gt;
To be written&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Tramtypes&amp;diff=3940</id>
		<title>NML:Tramtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Tramtypes&amp;diff=3940"/>
		<updated>2019-12-28T08:39:25Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Tramtype IDs */ typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Tramtypes can only be defined in OpenTTD {{ottd|1.10}} and {{nml|0.5}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tramtype IDs==&lt;br /&gt;
Tramtypes and Roadtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other tramtype/roadtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (tramtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing tramtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Tramtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and tramtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which tramtype it is, and the tramtypes define the compatibility between each other.&lt;br /&gt;
* Remember that the road vehicle flag &#039;ROADVEH_FLAG_TRAM&#039; must be set in order for a road vehicle to be considered a tram.&lt;br /&gt;
* A vehicle exists, if its tramtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its tramtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A tramtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the tramtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another tramtype is introduced, that references the tramtype via the introduced tramtype list (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_tramtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required tramtypes (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_tramtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; multiple tramtypes can be defined, which shall be considered equivalent to a tramtype.&lt;br /&gt;
This affects the interpretation of road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt;. If road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt; references an undefined tramtype, then tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; is checked for all defined tramtypes, whether the vehicle can be reassigned to some other tramtype. Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Tramtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default tram types: &amp;quot;RAIL&amp;quot; and &amp;quot;ELRL&amp;quot;. See the [[TramtypeLabels|List of tramtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this tramtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build tram toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;tram type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| Provide a list of tram types that tram vehicles of this type are powered on, e.g. [&amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;].  Note that there is no &amp;quot;compatible_tramtype_list&amp;quot; since there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| tramtype_flags&lt;br /&gt;
| bitmask(TRAMTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
;HIDDEN&lt;br /&gt;
:Hides the tramtype from players, but remains available to towns...which can&#039;t use them&lt;br /&gt;
;TOWN_BUILD&lt;br /&gt;
:Towns don&#039;t build tramtracks...so not sure what the purpose of this is&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of track as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that need to be available to the company of the player for this tram type to be introduced at (or after) the introduction date. This limit does not apply when the tram type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that get introduced when this tram type is introduced. For example, to make sure that when a fast tram type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among tram types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th tramtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of tram of this tramtype. Default cost factors are 16 and 24 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types which this tram type will act as fallback for, if the corresponding tram type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with tram types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal tram&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified tram&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| tramtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the tram type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Tramtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| enhanced_tunnels&lt;br /&gt;
| 0&lt;br /&gt;
| Reserved for future use, always returns 0 in OpenTTD. Should custom tunnel entrances be implemented, other values than 0 might be returned&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Tramtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For tram types a number of callbacks are used to define tram type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example tramtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for tram in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a tram vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this tramtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default&amp;quot; graphics callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== overlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this tramtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:TramtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for tramtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_TRAMTYPES, dctram, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;DCTM&amp;quot;;&lt;br /&gt;
         name:                       string(STR_DC_TRAM);&lt;br /&gt;
         menu_text:                  string(STR_DC_TRAM);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_tramtype_list:      [&amp;quot;DCTM&amp;quot;,&amp;quot;ELRL&amp;quot;];                          // These trams are compatible with other electric trams&lt;br /&gt;
         tramtype_flags:             bitmask(TRAMTYPE_FLAG_CATENARY);          // These tramways require catenary&lt;br /&gt;
         construction_cost:          24;                                       // Electric tramways are pricey&lt;br /&gt;
         speed_limit:                50 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the tramtrack underlay&lt;br /&gt;
         overlay:         track_overlay_switch;      // defines the tramtrack overlay&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the track drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Tramtypes&amp;diff=3939</id>
		<title>NML:Tramtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Tramtypes&amp;diff=3939"/>
		<updated>2019-12-28T08:37:56Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: various fixes and clean up&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Tramtypes can only be defined in OpenTTD {{ottd|1.10}} and {{nml|0.5}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tramtype IDs==&lt;br /&gt;
Tramtypes and Roadtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other tramtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (tramtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing tramtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Tramtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and tramtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which tramtype it is, and the tramtypes define the compatibility between each other.&lt;br /&gt;
* Remember that the road vehicle flag &#039;ROADVEH_FLAG_TRAM&#039; must be set in order for a road vehicle to be considered a tram.&lt;br /&gt;
* A vehicle exists, if its tramtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its tramtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A tramtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the tramtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another tramtype is introduced, that references the tramtype via the introduced tramtype list (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_tramtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required tramtypes (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_tramtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; multiple tramtypes can be defined, which shall be considered equivalent to a tramtype.&lt;br /&gt;
This affects the interpretation of road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt;. If road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;tram_type&amp;lt;/code&amp;gt; references an undefined tramtype, then tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; is checked for all defined tramtypes, whether the vehicle can be reassigned to some other tramtype. Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Tramtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default tram types: &amp;quot;RAIL&amp;quot; and &amp;quot;ELRL&amp;quot;. See the [[TramtypeLabels|List of tramtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this tramtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build tram toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;tram type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| Provide a list of tram types that tram vehicles of this type are powered on, e.g. [&amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;].  Note that there is no &amp;quot;compatible_tramtype_list&amp;quot; since there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| tramtype_flags&lt;br /&gt;
| bitmask(TRAMTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
;HIDDEN&lt;br /&gt;
:Hides the tramtype from players, but remains available to towns...which can&#039;t use them&lt;br /&gt;
;TOWN_BUILD&lt;br /&gt;
:Towns don&#039;t build tramtracks...so not sure what the purpose of this is&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of track as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that need to be available to the company of the player for this tram type to be introduced at (or after) the introduction date. This limit does not apply when the tram type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that get introduced when this tram type is introduced. For example, to make sure that when a fast tram type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among tram types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th tramtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of tram of this tramtype. Default cost factors are 16 and 24 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types which this tram type will act as fallback for, if the corresponding tram type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with tram types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal tram&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified tram&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| tramtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the tram type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Tramtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| enhanced_tunnels&lt;br /&gt;
| 0&lt;br /&gt;
| Reserved for future use, always returns 0 in OpenTTD. Should custom tunnel entrances be implemented, other values than 0 might be returned&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Tramtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For tram types a number of callbacks are used to define tram type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example tramtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for tram in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a tram vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this tramtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default&amp;quot; graphics callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== overlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this tramtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:TramtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for tramtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_TRAMTYPES, dctram, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;DCTM&amp;quot;;&lt;br /&gt;
         name:                       string(STR_DC_TRAM);&lt;br /&gt;
         menu_text:                  string(STR_DC_TRAM);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_tramtype_list:      [&amp;quot;DCTM&amp;quot;,&amp;quot;ELRL&amp;quot;];                          // These trams are compatible with other electric trams&lt;br /&gt;
         tramtype_flags:             bitmask(TRAMTYPE_FLAG_CATENARY);          // These tramways require catenary&lt;br /&gt;
         construction_cost:          24;                                       // Electric tramways are pricey&lt;br /&gt;
         speed_limit:                50 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the tramtrack underlay&lt;br /&gt;
         overlay:         track_overlay_switch;      // defines the tramtrack overlay&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the track drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Roadtypes&amp;diff=3938</id>
		<title>NML:Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Roadtypes&amp;diff=3938"/>
		<updated>2019-12-28T08:18:36Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: various fixes and clean up&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Roadtypes can only be defined in OpenTTD {{ottd|1.10}} and {{nml|0.5}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Roadtype IDs==&lt;br /&gt;
Roadtypes and Tramtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other roadtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (roadtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing roadtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Roadtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and roadtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which roadtype it is, and the roadtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A roadtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another roadtype is introduced, that references the roadtype via the introduced roadtype list (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_roadtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required roadtypes (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_roadtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_roadtype_list&amp;lt;/code&amp;gt; multiple roadtypes can be defined, which shall be considered equivalent to a roadtype.&lt;br /&gt;
This affects the interpretation of road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt;. If road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;road_type&amp;lt;/code&amp;gt; references an undefined roadtype, then&lt;br /&gt;
roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_roadtype_list&amp;lt;/code&amp;gt; is checked for all defined roadtypes, whether the vehicle can be reassigned to some other roadtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Roadtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default road types: &amp;quot;ROAD&amp;quot; and &amp;quot;ELRD&amp;quot;. See the [[RoadtypeLabels|List of roadtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this roadtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build road toolbar&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;road type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| Provide a list of road types that road vehicles of this type are powered on, e.g. [&amp;quot;ROAD&amp;quot;, &amp;quot;ELRD&amp;quot;]. Note that there is no &amp;quot;compatible_roadtype_list&amp;quot; since there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| roadtype_flags&lt;br /&gt;
| bitmask(ROADTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
;HIDDEN&lt;br /&gt;
:Hides the roadtype from players, but remains available to towns&lt;br /&gt;
;TOWN_BUILD&lt;br /&gt;
:Enables the roadtype to be built by towns, based on ???&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of road as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that need to be available to the company of the player for this road type to be introduced at (or after) the introduction date. This limit does not apply when the road type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that get introduced when this road type is introduced. For example, to make sure that when a fast road type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among road types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th roadtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of road of this roadtype. Default cost factors are 16 and 24 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types which this road type will act as fallback for, if the corresponding road type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with road types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal road&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified road&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| roadtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the road type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Roadtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| enhanced_tunnels&lt;br /&gt;
| 0&lt;br /&gt;
| Reserved for future use, always returns 0 in OpenTTD. Should custom tunnel entrances be implemented, other values than 0 might be returned&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits, based on tile location&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Roadtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For road types a number of callbacks are used to define road type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example roadtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for road in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a road vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this roadtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| roadstops&lt;br /&gt;
| 4&lt;br /&gt;
| Overlays for drive-in road stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default&amp;quot; graphics callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&lt;br /&gt;
==== roadstops ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_drivein.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this roadtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RoadtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for roadtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_ROADTYPES, highway, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;HWY_&amp;quot;;&lt;br /&gt;
         name:                       string(STR_HWY);&lt;br /&gt;
         menu_text:                  string(STR_HWY);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_roadtype_list:      [&amp;quot;HWY_&amp;quot;,&amp;quot;ROAD&amp;quot;];                          // Highways are compatible with other roads&lt;br /&gt;
         roadtype_flags:             bitmask(ROADTYPE_FLAG_NO_LEVEL_CROSSING, ROADTYPE_FLAG_NO_HOUSES); // Highways should not have level crossings or houses&lt;br /&gt;
         construction_cost:          32;                                       // Highways are expensive&lt;br /&gt;
         speed_limit:                100 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual roads&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the roads drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
         roadstops:       roadstops_switch;          // defines the look of roadstop pavement&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Language_files&amp;diff=3937</id>
		<title>NML:Language files</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Language_files&amp;diff=3937"/>
		<updated>2019-12-28T07:45:06Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* String codes */  added push/pop function&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavNoSubpages}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Language files are usually found in the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;lang&amp;lt;/code&amp;gt; sub-folder of the project, but the place NML looks for the language files can be changed via command line parameter to any directory desired:&lt;br /&gt;
&lt;br /&gt;
 nmlc -l path/to/lang-dir path/to/nml-source-file.nml&lt;br /&gt;
 nmlc --lang-dir=path/to/lang-dir path/to/nml-source-file.nml&lt;br /&gt;
&lt;br /&gt;
Language files MUST have the extension &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;.lng&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt; The language files themselves follow a certain structure:&lt;br /&gt;
&lt;br /&gt;
 ##grflangid &amp;amp;lt;number&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;string-name&amp;amp;gt;                                                   :&amp;amp;lt;text&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;string-name&amp;amp;gt;                                                   :&amp;amp;lt;text&amp;amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
&lt;br /&gt;
where the first line must give the language code for the language this file describes (see below). The following lines each describe a string. The translated string follows immediately the colon. An NML project has exactly one fallback language, by default this is english.lng. You can change this with the command line parameter --default-lang. Example for a valid language file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;&lt;br /&gt;
 ##grflangid 0x01&lt;br /&gt;
 STR_GRF_NAME                                                    :{TITLE} 0.1.0 - {VERSION}&lt;br /&gt;
 STR_GRF_DESCRIPTION                                             :{TITLE} contains pimped ground tiles.&lt;br /&gt;
 STR_NAME_MYVEHICLE                                              :General Robotics Anti-Grav UFO Mark X&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== String codes ==&lt;br /&gt;
&lt;br /&gt;
Strings may contain a number of special string codes which control how the string is being printed or which values to insert into the string. Custom replacements can be stored in the plain text file &amp;lt;code&amp;gt;custom_tags.txt&amp;lt;/code&amp;gt; (for example a newgrf version which is written by your build script). In the case above the &amp;lt;code&amp;gt;custom_tags.txt&amp;lt;/code&amp;gt; could, for example read&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;&lt;br /&gt;
 VERSION  :alpha-r88&lt;br /&gt;
 TITLE    :Example NewGRF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Additionally to custom-defined tags, NML comes with a number of default tags:&lt;br /&gt;
{|&lt;br /&gt;
!width=&amp;quot;150pt&amp;quot;|Tag&lt;br /&gt;
!width=&amp;quot;600pt&amp;quot;|Meaning&lt;br /&gt;
!Example&lt;br /&gt;
|-&lt;br /&gt;
|              ||empty tag, written as {} is used to create a newline ||&lt;br /&gt;
|-&lt;br /&gt;
|NBSP          || non-breaking space ||&lt;br /&gt;
|-&lt;br /&gt;
|{             || Display a left curly bracket. You write this as {{}. If you&#039;d include it without surrounding it by { and } it&#039;d be seen as the start of a tag and the rest of the string would be read as name of the tag. ||&lt;br /&gt;
|-&lt;br /&gt;
|COPYRIGHT     || copyright symbol            || © &lt;br /&gt;
|-&lt;br /&gt;
|TRAIN         || display train symbol ||&lt;br /&gt;
|-&lt;br /&gt;
|LORRY         || display lorry symbol ||&lt;br /&gt;
|-&lt;br /&gt;
|BUS           || display bus symbol ||&lt;br /&gt;
|-&lt;br /&gt;
|PLANE         || display plane symbol ||&lt;br /&gt;
|-&lt;br /&gt;
|SHIP          || display ship symbol ||&lt;br /&gt;
|-&lt;br /&gt;
|TINYFONT      || switch to small font ||&lt;br /&gt;
|-&lt;br /&gt;
|BIGFONT       || switch to big font ||&lt;br /&gt;
|-&lt;br /&gt;
|BLUE          || switch to blue text || &amp;lt;div style=&amp;quot;background:#3890E8;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|SILVER        || switch to silver text || &amp;lt;div style=&amp;quot;background:#C8C8C8;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|GOLD          || switch to golden text || &amp;lt;div style=&amp;quot;background:#FCC000;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|RED           || switch to red text || &amp;lt;div style=&amp;quot;background:#FC0000;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|PURPLE        || switch to purple text || &amp;lt;div style=&amp;quot;background:#A888E0;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|LTBROWN       || switch to light brown text || &amp;lt;div style=&amp;quot;background:#B0B084;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|ORANGE        || switch to orange text || &amp;lt;div style=&amp;quot;background:#FCB030;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|GREEN         || switch to green text || &amp;lt;div style=&amp;quot;background:#90E05C;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|YELLOW        || switch to yellow text || &amp;lt;div style=&amp;quot;background:#FCF880;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|DKGREEN       || switch to dark green text || &amp;lt;div style=&amp;quot;background:#B4CC7C;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|CREAM         || switch to cream-coloured text || &amp;lt;div style=&amp;quot;background:#D49480;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|BROWN         || switch to brown text || &amp;lt;div style=&amp;quot;background:#A46040;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|WHITE         || switch to white text || &amp;lt;div style=&amp;quot;background:#FCFCFC;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|LTBLUE        || switch to light blue text || &amp;lt;div style=&amp;quot;background:#80C4FC;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|GRAY          || switch to gray text || &amp;lt;div style=&amp;quot;background:#626562;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|DKBLUE        || switch to dark blue text || &amp;lt;div style=&amp;quot;background:#8484A4;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|BLACK         || switch to black text || &amp;lt;div style=&amp;quot;background:#101010;width:2em;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|PUSH_COLOUR   || {{ottdp|1.10|no}} Push current colour onto colour stack. Use this if you need to switch colour and restore later ||&lt;br /&gt;
|-&lt;br /&gt;
|POP_COLOUR    || {{ottdp|1.10|no}} Pop last colour from colour stack. Use this to restore previous colour ||&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== String parameters ==&lt;br /&gt;
The above tags can be used in almost all strings. There are also a number of tags that need an argument they&#039;ll read from the textstack. The textstack is only available for certain callbacks an properties.&lt;br /&gt;
{|&lt;br /&gt;
!width=&amp;quot;150pt&amp;quot;|Tag&lt;br /&gt;
!width=&amp;quot;600pt&amp;quot;|Meaning&lt;br /&gt;
!Size (number of bytes read from stack)&lt;br /&gt;
!Example&lt;br /&gt;
|-&lt;br /&gt;
|COMMA         || signed number with decimal separator between 1000&#039;s.   || 4&lt;br /&gt;
|-&lt;br /&gt;
|SIGNED_WORD   || signed number with decimal separator between 1000&#039;s.   || 2&lt;br /&gt;
|-&lt;br /&gt;
|UNSIGNED_WORD || unsigned number with decimal separator between 1000&#039;s. || 2&lt;br /&gt;
|-&lt;br /&gt;
|CURRENCY      || money in proper currency units                         || 4 || 24,492 €&lt;br /&gt;
|-&lt;br /&gt;
|VELOCITY      || velocity in proper units                               || 2 || 35 km/h&lt;br /&gt;
|-&lt;br /&gt;
|VOLUME        || volume in proper units                                 || 2 || 29,000 litres&lt;br /&gt;
|-&lt;br /&gt;
|VOLUME_SHORT  || volume in proper units in short form                   || 2 || 29,000l&lt;br /&gt;
|-&lt;br /&gt;
|POWER         || power in proper units                                  || 2 || 2,030 kW&lt;br /&gt;
|-&lt;br /&gt;
|WEIGHT        || weight in proper units                                 || 2 || 5 tonnes&lt;br /&gt;
|-&lt;br /&gt;
|WEIGHT_SHORT  || weight in proper units in short form                   || 2 || 5t&lt;br /&gt;
|-&lt;br /&gt;
|CARGO_LONG    || {{ottdp|1.4|no|ottdrev=r26244}} cargo amount in proper units                           || 4 (2 + 2)&amp;lt;ref name=&amp;quot;cargoamount&amp;quot;&amp;gt;First (lower) 2 bytes for cargo type, second (higher) 2 bytes for cargo amount.&amp;lt;/ref&amp;gt; || 10 bags of mail&lt;br /&gt;
|-&lt;br /&gt;
|CARGO_SHORT   || {{ottdp|1.4|no|ottdrev=r26244}} cargo amount in proper units in short form             || 4 (2 + 2)&amp;lt;ref name=&amp;quot;cargoamount&amp;quot;/&amp;gt; || 10 bags&lt;br /&gt;
|-&lt;br /&gt;
|CARGO_TINY    || {{ottdp|1.4|no|ottdrev=r26244}} cargo amount in proper units in tiny form (only unit conversion) || 4 (2 + 2)&amp;lt;ref name=&amp;quot;cargoamount&amp;quot;/&amp;gt; || 10&lt;br /&gt;
|-&lt;br /&gt;
|CARGO_NAME    || {{ottdp|1.7|no|ottdrev=r27706}} cargo name || 2 || Coal&lt;br /&gt;
|-&lt;br /&gt;
|HEX           || hexadecimal presentation                               || 4 || F0 3D D4 33&lt;br /&gt;
|-&lt;br /&gt;
|STRING        || include other string                                   || 2&lt;br /&gt;
|-&lt;br /&gt;
|DATE1920_LONG || days since 1920 as long date                           || 2 || 12 August 1935&lt;br /&gt;
|-&lt;br /&gt;
|DATE1920_SHORT|| days since 1920 as short date                          || 2 || 12 Aug 1935&lt;br /&gt;
|-&lt;br /&gt;
|DATE_LONG     || days since 0 as long date                              || 4 || 12 August 1610&lt;br /&gt;
|-&lt;br /&gt;
|DATE_SHORT    || days since 0 as short date                             || 4 || 12 Aug 3049&lt;br /&gt;
|-&lt;br /&gt;
|POP_WORD      || Remove 2 bytes from the top of the stack               || 2&lt;br /&gt;
|-&lt;br /&gt;
|STATION       || Station name of station with given ID                  || 2&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don&#039;t want to use the first 2 (or 4) bytes from the stack but rather another variable, you can prefix the tag name with the number, like {1:COMMA} to use the second (indexing starts at 0) argument from the stack. You can also use this in translations that require a different order, for example (in english.lng):&lt;br /&gt;
&lt;br /&gt;
 STR_SOME_STRING    :{COMMA} items cost {CURRENCY}&lt;br /&gt;
&lt;br /&gt;
And the same string in dutch.lng:&lt;br /&gt;
&lt;br /&gt;
 STR_SOME_STRING    :{1:CURRENCY} is de prijs van {0:COMMA} items.&lt;br /&gt;
&lt;br /&gt;
The string parameters itself are assigned in units of dwords (4 bytes), starting with temporary storage 256, up to 259 or 261. Thus if you use parameters which are not of dword size (e.g. strings or word-sized numbers), you have to construct the text stack via bit arithmetic:&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;&lt;br /&gt;
switch(FEAT_INDUSTRIES, SELF, extra_text_switch, [&lt;br /&gt;
			STORE_TEMP(&lt;br /&gt;
				(    (LOAD_PERM(var_supply_efficiency_factor) == 1) * string(STR_EXTRA_PRIMARY_EFFICIENT1)    ) +&lt;br /&gt;
				(    (LOAD_PERM(var_supply_efficiency_factor) == 2) * string(STR_EXTRA_PRIMARY_EFFICIENT2)    ) +&lt;br /&gt;
				(    (LOAD_PERM(var_supply_efficiency_factor) == 3) * string(STR_EXTRA_PRIMARY_EFFICIENT3)    ) +&lt;br /&gt;
				(    (LOAD_PERM(var_supply_efficiency_factor) == 4) * string(STR_EXTRA_PRIMARY_EFFICIENT4)    ) |&lt;br /&gt;
				LOAD_PERM(var_supply_requirement) &amp;lt;&amp;lt; 16,&lt;br /&gt;
				256&lt;br /&gt;
			),&lt;br /&gt;
	return string(STR_EXTRA_PRIMARY);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
for a language file which reads&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;&lt;br /&gt;
STR_EXTRA_PRIMARY_EFFICIENT1 :{YELLOW}very efficient{BLACK}ly&lt;br /&gt;
STR_EXTRA_PRIMARY_EFFICIENT2 :{YELLOW}efficient{BLACK}ly&lt;br /&gt;
STR_EXTRA_PRIMARY_EFFICIENT3 :in a {YELLOW}normal{BLACK} way&lt;br /&gt;
STR_EXTRA_PRIMARY_EFFICIENT4 :{YELLOW}wasteful{BLACK}ly&lt;br /&gt;
STR_EXTRA_PRIMARY            :{BLACK}This industry needs {YELLOW}supplies{BLACK}.{}They use them {STRING}{}{}Monthly demand: {YELLOW}{UNSIGNED_WORD} crate{P &amp;quot;&amp;quot; s} of engineering supplies{BLACK}.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Defining cases ==&lt;br /&gt;
Similar to OpenTTD&#039;s language files, NML can also make use of cases, genders and plural forms. In order to utilize them, they have to be defined in the language file&#039;s header and have to match the definition as used in OpenTTD&#039;s language files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
##case pragma&lt;br /&gt;
&lt;br /&gt;
STR_NAME                                     :Utas&lt;br /&gt;
STR_NAME.pragma                              :utast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
e.g. for Hungarian you&#039;d have&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;&lt;br /&gt;
##case t ba&lt;br /&gt;
&lt;br /&gt;
STR_CARGO_PLURAL_PASSENGERS                  :Utas&lt;br /&gt;
STR_CARGO_PLURAL_PASSENGERS.t                :utast&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case the name of a case changes in the OpenTTD language file, your language file will have to follow that change. To keep compatible with older OpenTTD versions you can use the ##map_case pragma, like this:&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;##map_case t t_old&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Defining genders ==&lt;br /&gt;
Genders just like cases are defined in the header of the language file and have to match the definition as found within OpenTTD&#039;s language files. The gender of a word or expression is declared within the string&#039;s text itself by a tag of the form &amp;lt;code&amp;gt;{G=gendername}&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
##gender pragma&lt;br /&gt;
&lt;br /&gt;
STR_NAME                                      :{G=gendername}String which requires gender &#039;gendername&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
where the string with the defined gender then will trigger the correct usage in a string which includes it and which has to take provisions to show the proper gender:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
STR_OTHER                                     :Some text {G gender1 gender2 ...} {STRING}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
for example in German&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;&lt;br /&gt;
##gender m w n p&lt;br /&gt;
&lt;br /&gt;
STR_CARGO_NAME_BAUXITE                        :{G=n}Bauxit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
which then will be used with the correct gender by a string which includes it:&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;&lt;br /&gt;
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO                        :{WHITE}{STATION} akzeptiert kein{G &amp;quot;en&amp;quot; &amp;quot;e&amp;quot; &amp;quot;&amp;quot; &amp;quot;e&amp;quot;} {STRING} mehr.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case the name of a gender changes in the OpenTTD language file, your language file will have to follow that change. To keep compatible with older OpenTTD versions you can use the ##map_gender pragma, like this:&lt;br /&gt;
&amp;lt;pre class=example&amp;gt;##gender m f&lt;br /&gt;
##map_gender m male&lt;br /&gt;
##map_gender f female&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== LanguageIDs ==&lt;br /&gt;
&lt;br /&gt;
{{:language_IDs}}&lt;br /&gt;
&lt;br /&gt;
In case a language is not in this list, edit the shared [[language_IDs|master language list]] in the NewGRF Specs. This master list is always leading. NFO language ID 7F has no meaning in NML (set --default-lang instead) and setting bit 8 will break your language file.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Railtypes&amp;diff=3936</id>
		<title>NML:Railtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Railtypes&amp;diff=3936"/>
		<updated>2019-12-28T06:21:17Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Railtype variables */ added random_bits and clarified description of enhanced_tunnels&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Railtypes can only be defined in OpenTTD {{ottd|1.0|r18969}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Railtype IDs==&lt;br /&gt;
Railtype IDs are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other railtype GRFs are loaded, it may be that there are not enough railtype slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (railtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing railtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Railtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and railtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which railtype it is, and the railtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A railtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another railtype is introduced, that references the railtype via the introduced railtype list (railtype propery &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_railtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required railtypes (railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_railtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_railtype_list&amp;lt;/code&amp;gt; multiple railtypes can be defined, which shall be considered equivalent to a railtype.&lt;br /&gt;
This affects the interpretation of train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined railtype, then&lt;br /&gt;
railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_railtype_list&amp;lt;/code&amp;gt; is checked for all defined railtypes, whether the vehicle can be reassigned to some other railtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Railtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default rail types: &amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;, &amp;quot;MONO&amp;quot;, &amp;quot;MGLV&amp;quot;. See the [[RailtypeLabels|List of railtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21842}} Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this railtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| {{ottdp|1.2|no|ottdrev=23129}} Caption of the build rail toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all railtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;rail type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| compatible_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
| Provide a list of rail types that trains of this type can also run on. e.g. [&amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;, &amp;quot;MONO&amp;quot;]&lt;br /&gt;
|-&lt;br /&gt;
| powered_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
| Provide a list of rail types that trains of this type are powered on.&lt;br /&gt;
|-&lt;br /&gt;
| railtype_flags&lt;br /&gt;
| bitmask(RAILTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
; CATENARY&lt;br /&gt;
: Enable catenary&lt;br /&gt;
; NO_LEVEL_CROSSING&lt;br /&gt;
: Disable level crossings&lt;br /&gt;
; HIDDEN {{ottd|1.9}}&lt;br /&gt;
: Hides railtype from player&lt;br /&gt;
; PRECOMBINED {{ottd|1.10}}&lt;br /&gt;
: Enable use of precombined overlay sprites&lt;br /&gt;
; ALLOW_90DEG {{ottd|1.10}}&lt;br /&gt;
: Always allow 90 degree turns&lt;br /&gt;
; DISALLOW_90DEG {{ottd|1.10}}&lt;br /&gt;
: Always prohibit 90 degree turns (takes precedence over ALLOW_90DEG)&lt;br /&gt;
|-&lt;br /&gt;
| curve_speed_multiplier&lt;br /&gt;
| 0...255&lt;br /&gt;
| max curve speed is defined as multiple of the base curve speed (see below)&lt;br /&gt;
|-&lt;br /&gt;
| station_graphics&lt;br /&gt;
| RAILTYPE_STATION_NORMAL, RAILTYPE_STATION_MONORAIL, RAILTYPE_STATION_MAGLEV&lt;br /&gt;
| Type of station graphics to use for the default stations&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19307}} per piece of track as multiplier to PR_BUILD_RAIL base cost. Default cost factors are 8, 12, 16 and 24 for RAIL, ELRL, MONO and MGLV.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| acceleration_model&lt;br /&gt;
| ACC_MODEL_RAIL, ACC_MODEL_MONORAIL, ACC_MODEL_MAGLEV&lt;br /&gt;
| ACC_MODEL_RAIL and ACC_MODEL_MONORAIL behave the same currently&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19307}} entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21842}} List of rail types on that need to be available to the company of the player for this rail type to be introduced at (or after) the introduction date. This limit does not apply when the rail type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21841}} List of rail types that get introduced when this rail type is introduced. For example, to make sure that when a fast rail type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21866}} number which defines the sort order among rail types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th railtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.2|r23415}} Maintenance cost factor for each piece of tracks of this railtype. Default cost factors are 8, 12, 16 and 24 for RAIL, ELRL, MONO and MGLV.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.2|r23758}} List of rail types which this rail type will act as fallback for, if the corresponding rail type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with rail types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal rail&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified rail&lt;br /&gt;
|-&lt;br /&gt;
| 27&lt;br /&gt;
| monorail&lt;br /&gt;
|-&lt;br /&gt;
| 37&lt;br /&gt;
| maglev&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| railtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the rail type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
===Base speeds for curves===&lt;br /&gt;
&lt;br /&gt;
The base speeds relevant for the curve_speed_multiplier are:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! curve length&lt;br /&gt;
! base speed [km/h]&lt;br /&gt;
|-&lt;br /&gt;
| 0 (90 degree turn)&lt;br /&gt;
| 30&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 44&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 55&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| 66&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 75&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 84&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| 91&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| 98&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 103&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| 108&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 111&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 114&lt;br /&gt;
|-&lt;br /&gt;
| 12+&lt;br /&gt;
| 115&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Railtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| enhanced_tunnels&lt;br /&gt;
| 0&lt;br /&gt;
| Reserved for future use, always returns 0 in OpenTTD. Should custom tunnel entrances be implemented, other values than 0 might be returned&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile. (Only available for level crossings and depots.)&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo-random bits, based on tile location&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Railtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For rail types a number of callbacks are used to define rail type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example railtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 16&lt;br /&gt;
| 4 rail directions, autorail, depot, tunnel and convert rail sprites for rail menu.&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 10&lt;br /&gt;
| 6 flat and 4 slope sprites. Track without landscape. Used in junctions, and also with path signals, if the &amp;quot;Show reserved tracks&amp;quot; option is enabled in the game settings.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
| 6 flat and 4 slope, one crossing WITH track, 5 junction pieces without track. Tracks with ballast but without landscape.&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for track in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a train and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_wire&lt;br /&gt;
| 28&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| catenary_pylons&lt;br /&gt;
| 8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossings&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 10&lt;br /&gt;
| For each direction: one track sprite and 4 sprites for road lights etc&lt;br /&gt;
|-&lt;br /&gt;
| depots&amp;lt;ref name=depotr22854&amp;gt;{{ottd|1.2|r22854}} In OpenTTD prior to r22854, depot sprites would not be used if the above &#039;all or none&#039; sprites were not supplied.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 sprites for each south-ish, 1 sprite for each north-ish depot. Like original depots.&lt;br /&gt;
|-&lt;br /&gt;
| fences&lt;br /&gt;
| 8 / 16&lt;br /&gt;
| x, y, vertical, horizontal, SW, SE, NE and NW slopes like original fences at sprite 1301. {{ottdp|1.6|no|ottdrev=r27343}} Since OpenTTD r27343 there is also a 16 sprites version, see below.&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this railtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, train sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
|-&lt;br /&gt;
| signals&lt;br /&gt;
| 8&lt;br /&gt;
| {{ottd|1.3|r24367}} 1 sprite for each direction, order is SW(-facing), NE, NW, SE, E, W, S, N. For more information, see [[#signals|below]]&lt;br /&gt;
|-&lt;br /&gt;
| precombined&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 63&lt;br /&gt;
| {{ottd|1.10}} 1 sprite for each combination of track on a tile. The index is determined by treating each track piece as a bit in the order X Y N S W E, subtracting 1, see [[#Precombined overlay sprites|below]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
If a callback is not implemented or fails, graphics from the fallback railtype (picked via the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;station_graphics&amp;lt;/code&amp;gt; property) will be used instead.&amp;lt;br /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot;-callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== track_overlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== level_crossings ====&lt;br /&gt;
&lt;br /&gt;
You can define a special track piece which crosses the road and for each of two directions and each of the corners of the tile a separate sprite for a light, sign, or whatever should go there.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Sprite number for X&lt;br /&gt;
!Sprite number for Y&lt;br /&gt;
!Useage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Rail overlay&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;North light&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;East light&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;7&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;West light&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;9&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;South light&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_levelcrossing.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== fences ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_fences.png]]&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.6|no|ottdrev=r27343}} Since OpenTTD r27343 there is also a 16 sprites version, this allows to use different sprites resp. offsets for the fences on either track side.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
! Sprite number !! Tile slope !! Track bit !! Fence position !! Version&lt;br /&gt;
|-&lt;br /&gt;
| 0 || flat || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || flat || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 2 || flat || left || E || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 3 || flat || upper || S || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 4 || SW || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 5 || SE || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 6 || NE || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 7 || NW || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 8 || flat || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 9 || flat || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 10 || flat || left || W || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 11 || flat || upper || N || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 12 || SW || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 13 || SE || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 14 || NE || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 15 || NW || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this railtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, train sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RailtypeTunnelExample.png]]&lt;br /&gt;
&lt;br /&gt;
==== signals ====&lt;br /&gt;
&lt;br /&gt;
This callback can be used to supply custom signal graphics.&lt;br /&gt;
&lt;br /&gt;
The resulting sprite set must consist of 8 sprites, corresponding to the following signal directions: SW-facing, NE-facing, NW-facing, SE-facing, E-facing, W-facing, S-facing, N-facing. If resolving fails or results in an empty sprite group, the matching base set sprite will be used instead.&lt;br /&gt;
&lt;br /&gt;
Variable &amp;lt;code style:darkgreen&amp;gt;extra_callback_info2&amp;lt;/code&amp;gt; contains the state, variant and type of the signal. Use the builtin function &amp;lt;code style:darkgreen&amp;gt;getbits()&amp;lt;/code&amp;gt; in the following fashion to access the information:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal state: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 0, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Red signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Green signal&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal variant: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 8, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Light (electric) signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Semaphore&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal type: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 16, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Normal block signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Entry pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 02 || Exit pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 03 || Combo pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 04 || Two-way path signal&lt;br /&gt;
|-&lt;br /&gt;
| 05 || One-way path signal&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Variable &amp;lt;code style:darkgreen&amp;gt;extra_callback_info1&amp;lt;/code&amp;gt; contains the drawing context.&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Signal is drawn in a viewport, i.e. on the map.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || Signal is drawn in the signal GUI. The returned sprite set must still have 8 sprites, but OpenTTD will only use the 7th sprite, so all other sprites can be empty.&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Precombined overlay sprites====&lt;br /&gt;
&lt;br /&gt;
[[File:Rails_combined.png]]&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for railtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_RAILTYPES, elrail, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;SHIN&amp;quot;;&lt;br /&gt;
         name:                       string(STR_EL_RAIL);&lt;br /&gt;
         menu_text:                  string(STR_EL_RAIL);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         compatile_railtype_list:    [&amp;quot;SHIN&amp;quot;,&amp;quot;RAIL&amp;quot;,&amp;quot;ELRL&amp;quot;];                   // Tracks of rail and electrified rail are compatible&lt;br /&gt;
         powered_railtype_list:      [&amp;quot;ELRL&amp;quot;,&amp;quot;SHIN&amp;quot;];                          // But we only have power when we have electricity&lt;br /&gt;
         railtype_flags:             bitmask(RAILTYPE_FLAG_NO_LEVEL_CROSSING); // High speed tracks should not have level crossings&lt;br /&gt;
         curve_speed_multiplier:     1;&lt;br /&gt;
         station_graphics:           RAILTYPE_STATION_MAGLEV;                  // We want the most modern stations&lt;br /&gt;
         construction_cost:          32;                                       // should be pretty steep&lt;br /&gt;
         speed_limit:                500 km/h;&lt;br /&gt;
         acceleration_model:         ACC_MODEL_RAIL;                           // This is still rail, though&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         track_overlay:   ground_switch_overlay;     // defines the sprites drawn as overlay for junctions and highlight&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual tracks and the underlay for junctions&lt;br /&gt;
         level_crossings: level_crossing_switch;     // defines level crossings including traffic lights and blocking bars&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the tracks drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch_electric;     // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges&lt;br /&gt;
         fences:          fences_set;                // defines the look of fences&lt;br /&gt;
         // we don&#039;t define catenary wire and pylons, thus we use the default which comes with the base graphics.&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=RandomAction2&amp;diff=3935</id>
		<title>RandomAction2</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=RandomAction2&amp;diff=3935"/>
		<updated>2019-12-28T06:07:11Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Triggers */ added road/tramtypes&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;
&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||8||8 read-only||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;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Vehicles ===&lt;br /&gt;
&lt;br /&gt;
Vehicles have 8 random bits, 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;
=== 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>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action5&amp;diff=3934</id>
		<title>Action5</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action5&amp;diff=3934"/>
		<updated>2019-12-28T05:06:24Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* 15 / 95 OpenTTD GUI sprites */  added nrt sprites&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Define base graphics specific sets&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Action 5 is used to define graphics for several new features of OpenTTD and TTDPatch. This is similar to action 1.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&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; 05 &amp;lt;type&amp;gt; &amp;lt;num-sprites&amp;gt; [&amp;lt;offset&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Element!![[GRFActionsDetailed|Size]]!!Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Sprite-number&amp;gt;||dec||A sequential sprite number&lt;br /&gt;
&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;
|-&lt;br /&gt;
|05||B||Defines action 05&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;type&amp;gt;||B||What type of graphics follow&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;num-sprites&amp;gt;||B*||How many regular sprites follow&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;offset&amp;gt;||B*||Offset in the Action 5 assignable block of sprites&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following num-sprites sprites in the .nfo file have to be RealSprites that will be used as graphics for the given TTDPatch feature, except for type 0A, which requires RecolorSprites.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.7|2.5|ttdprev=alpha 19}}Action 5 entries in a .grf file which has a regular GRFID (not FFFFFFFF) will always override those from .grf files with a GRFID of FFFFFFFF.&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;
=== type ===&lt;br /&gt;
&lt;br /&gt;
This sets the type of feature that the graphics are for. If bit 7 is set, the offset variable needs to be set. Bit 7 may only be set if the type supports it. The type can be one of:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Type!!Version!!Feature!!num-sprites (decimal)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04||{{ottdp|0.6|2.0}}||Pre-signal graphics||48&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04||{{ottdp|0.6|2.0}}||Pre-signal and semaphore graphics||112&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04,84&amp;lt;ref name=&amp;quot;offset&amp;quot;&amp;gt;Offset allowed since {{ottdp|1.2|no|ottdrev=r23005}}&amp;lt;/ref&amp;gt;||{{ottdp| |2.5|ttdprev=alpha 41}}||Pre-signal, semaphore, and [[PathBasedSignalling|PBS]] graphics||240&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|05,85&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.0}}||Overhead wires and pylon graphics||48&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|06 ||{{ottdp|0.6| }}||Foundations (retaining walls) for BuildOnSlopes ||74&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|06,86&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|no|ottdrev=r11321}}||Foundations for BuildOnSlopes and half tiles (NS and EW foundations) ||90&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|07||{{ottdp|no|2.5|ttdprev=alpha 43}}||TTDPatch GUI sprites||93 &amp;lt;ref&amp;gt;Type 07 only requires 73 sprites in the stable (2.5 branch); the extra sprites are the clone train and build canal cursors.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|08,88&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|no}}&amp;lt;ref&amp;gt;TTDPatch supported canals via Action5 from 2.0.1 alpha 17 up to alpha 25. In alpha 26 it was removed again in favour of an action-1-2-3 method; see [[Action3/Canals|Action3]]. The method via Action5 is no longer supported by TTDpatch 2.0.1 alpha 26 and newer.&amp;lt;/ref&amp;gt;||Canals||65&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|09,89&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||One-way road arrows||6&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0A,8A&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.5|ttdprev=alpha 67}}||Two company color translation maps||256&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0B,8B&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.5|ttdprev=alpha 68}}||Tram tracks||113&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0C||{{ottdp|no|2.5|ttdprev=alpha 74}}||Snowy temperate trees||133&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0D||{{ottdp|0.6|2.5|ottdrev=r7325 (r11726)|ttdprev=beta 5}}||Coast Tile graphics||16 (18)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0E||{{ottdp|no|2.6|ttdprev=r1247}}||New Signals||Any&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0F,8F&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.7|2.6|ottdrev=r13469|ttdprev=r1487}}||Sprites for marking tracks on slopes (for track reservation systems like PBS or YAPP)||Up to 12&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10,90&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|no|ottdrev=r9645}}||Additional airport graphics||15&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11,91&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.6|ottdrev=r9645|ttdprev=r1589}}||Road stop graphics||8&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12,92&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.7|2.6|ottdrev=r13464|ttdprev=r1498}}||Aqueduct graphics||8&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13,93&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|no|ottdrev=r11433}}||Autorail sprites||55&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14,94||{{ottdp|0.6|no|ottdrev=11433}}||Flag sprites||Up to 36&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15,95||{{ottdp|0.6|no|ottdrev=r11433}}||OpenTTD GUI sprites||Up to 184&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|16,96||{{ottdp|1.1|no|ottdrev=r20370}}||Airport preview sprites||Up to 9&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|17,97||{{ottdp|1.2|no|ottdrev=r23952}}||Railtype tunnel base sprites||16&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18,98||{{ottdp|1.5|no|ottdrev=r26869}}||Extra all black palette||1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 04 Signal graphics. ====&lt;br /&gt;
&lt;br /&gt;
Signal graphics come in groups of 16. These groups contain sprites in the same order as sprites 1275-1290 in trg1[r].grf; red, then green, for each of: SW-facing, NE-facing, NW-facing, SE-facing, E-facing, W-facing, S-facing, N-facing.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Group(s)!!Contents&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0||lighted entrance signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1||lighted exit signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2||lighted combo signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3||standard (non-pre-signal) semaphore signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4..6||repeat 0..2 for semaphores&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7||standard lighted PBS signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8..14||repeat 0..6 for PBS signals&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 0C Snowy temperate trees ====&lt;br /&gt;
&lt;br /&gt;
If the temperate snow line is enabled, you can use this to specify the snowy versions of temperate trees. The sprites must be the snowy versions of sprites 1576-1708 from TRG1.GRF, in the same order as they appear there.&lt;br /&gt;
&lt;br /&gt;
==== 0D Coast tile sprites ====&lt;br /&gt;
&lt;br /&gt;
===== In NewGRFs =====&lt;br /&gt;
If diagonal flooding is enabled then due to new corner coasts, you can use this to give a complete set of replacement coast tile sprites. There are 16 in total, 8 original Transport Tycoon Deluxe sprites and 8 for the corner slopes. Order of the sprites&amp;lt;ref name=numbers&amp;gt;Sprite numbers from trg1(r).pcx.&amp;lt;/ref&amp;gt; is as follows:&lt;br /&gt;
&lt;br /&gt;
 3997, 4063, 4064, 4068, 4062, 3998, 4066, 3988,&lt;br /&gt;
 4065, 4069, 3996, 3992, 4067, 3994, 3995, 3999.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Action5Coast16Sprites.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The 16 sprites for feature 0D&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== In Base Set&#039;s extra grf =====&lt;br /&gt;
Additionally, OpenTTD (since r11726) supports another method of supplying all additional coast tile sprites, but this is only allowed in the &#039;&#039;extra&#039;&#039; NewGRF of [http://wiki.openttd.org/Base_graphics Base Graphic Sets]. In this, only 10 sprites are supplied in the same order as the 16 sprites above, but without the coast sprites already in the base grf. Note that the 10 sprites version supplies two additional slopes, but they are not used, and are currently unlikely to be ever used.&lt;br /&gt;
&lt;br /&gt;
[[File:Action5Coast10Sprites.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Only 10 sprites are required for OpenTTD base graphic sets&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;In OpenTTD 10 sprites for type 0D is enough in base graphic sets. The 16 sprites version should not be used for base graphics.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason for the existence of a 10 sprite version is to remove the need for including original graphics, and to keep compatibility with old NewGRFs that replace the original shore graphics using Action A without adding new shores using Action 5: When a NewGRF uses the 16 sprites version it takes precedence above any NewGRF replacing the shore graphics using Action A; when a NewGRF uses Action A to replace shore graphics it takes precedence above a 10-sprite Action 5, effectively disabling diagonal flooding. Also due to compatibility the 10 sprites version is invalid for normal NewGRFs, which are not the &amp;quot;extra&amp;quot; NewGRF of some Base Graphics Set.&lt;br /&gt;
&lt;br /&gt;
==== 0E New Signals ====&lt;br /&gt;
&lt;br /&gt;
Any number of real and recolour sprites can be specified in the action in any order.&lt;br /&gt;
&lt;br /&gt;
Sprites are referenced by their offset into the action5 block by a [[VarAction2NewSignals]], hence a logically easily calculable order is advised.&lt;br /&gt;
&lt;br /&gt;
As of TTDPatch 2.6 alpha 0 r1346, the action 5 block defined in the same GRF file as the varaction2, will be used as the base sprite block for the offsets returned by the callback even if it is overridden by a higher priority GRF action 5 definition of the same feature (0E).&lt;br /&gt;
&lt;br /&gt;
==== 0F Tracks for Slopes ====&lt;br /&gt;
&lt;br /&gt;
This should be in the same order as sprites 1031 to 1035 (1). These should only be the rails, basically the same format as sprites 1005 to 1010 (1). There should be 3 groups of these sprites, one for each rail type (railroad, monorail, maglev).&lt;br /&gt;
&lt;br /&gt;
(1) Sprite numbers from trg1r.pcx / ogfx1_base.grf&lt;br /&gt;
&lt;br /&gt;
==== 11 Road stop graphics ====&lt;br /&gt;
&lt;br /&gt;
Road stop graphics consist of 2 groups of 4 sprites. The first group contains graphics for bus stops, second for truck stops. In each group, the sprites are in the following order: SW, NE, NW, SE.&lt;br /&gt;
&lt;br /&gt;
SW and NE sprites are used with road going along the Y axis ( .\&#039; ), NW and SE with road along the X axis( &#039;/. ).&lt;br /&gt;
&lt;br /&gt;
Internally, the stations are defined using the following station layouts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;\d1313&lt;br /&gt;
&lt;br /&gt;
\b13 \b0 \b0 \b3 \b16 \b16 &amp;lt;SW sprite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
\b0 \b0 \b0 \b3 \b16 \b16 &amp;lt;NE sprite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
80&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;\d1314&lt;br /&gt;
&lt;br /&gt;
\b0 \b0 \b0 \b16 \b3 \b16 &amp;lt;NW sprite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
\b0 \b13 \b0 \b16 \b3 \b16 &amp;lt;SE sprite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
80&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 1313 and 1314 are town road sprites.&lt;br /&gt;
&lt;br /&gt;
[[File:roadstops.png]]&lt;br /&gt;
&lt;br /&gt;
Further sprites can be found in &#039;&#039;&#039;openttd.grf&#039;&#039;&#039; (OpenTTD), &#039;&#039;&#039;ogfxe_extra.grf&#039;&#039;&#039; (OpenGFX) or &#039;&#039;&#039;ttdpbase(w).grf&#039;&#039;&#039; (TTDPatch).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: As of OpenTTD r10185, the behaviour of this feature is identical in both games.&lt;br /&gt;
&lt;br /&gt;
==== 12 Aqueducts ====&lt;br /&gt;
&lt;br /&gt;
8 real sprites should be given. Firstly: 4 bridge end sprites in the order: SW, SE, NE, NW, where the direction is that heading onto the aqueduct. Then 2 middle part sprites for the X and Y directions. Followed by two pillar sprites for the X and Y directions. For examples of where the division between middle sprites and pillars should be made see sprites 2437 to 2592 (1), or an existing aqueduct GRF. Note, that for higher bridges to work effectively, pillars should be approximately 8px in height.&lt;br /&gt;
&lt;br /&gt;
[[File:aqueduct.png]]&lt;br /&gt;
&lt;br /&gt;
==== 15 / 95 OpenTTD GUI sprites ====&lt;br /&gt;
&lt;br /&gt;
OpenTTD defines 184 GUI sprites. Additional sprites not needed by an OpenTTD are simply ignored, so that new(er) base sets can be used by old OpenTTD versions. One can (re-)define a subset of the GUI sprites by giving an offset into the GUI sprites. The sprites are:&lt;br /&gt;
{|&lt;br /&gt;
!Offset !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0 .. 11|| Halftile selections&lt;br /&gt;
|-&lt;br /&gt;
|12 .. 13 || Title screen letters E and D&lt;br /&gt;
|-&lt;br /&gt;
|14 .. 37 || Bridge piers colours 1 .. 4&lt;br /&gt;
|-&lt;br /&gt;
|38 || square indicating NewGRF compatibility&lt;br /&gt;
|-&lt;br /&gt;
|39 || blob indicating server compatibility&lt;br /&gt;
|-&lt;br /&gt;
|40 || lock icon&lt;br /&gt;
|-&lt;br /&gt;
|41 || empty check box&lt;br /&gt;
|-&lt;br /&gt;
|42 || checked check box&lt;br /&gt;
|-&lt;br /&gt;
|43 || warning sign&lt;br /&gt;
|-&lt;br /&gt;
|44 || window resize right&lt;br /&gt;
|-&lt;br /&gt;
|45 .. 48|| arrows&lt;br /&gt;
|-&lt;br /&gt;
|49 || house&lt;br /&gt;
|-&lt;br /&gt;
|50 || shared orders&lt;br /&gt;
|-&lt;br /&gt;
|51 .. 52 || pin / pinned&lt;br /&gt;
|-&lt;br /&gt;
|53 .. 62 || rail build icons and cursors&lt;br /&gt;
|-&lt;br /&gt;
|63 .. 68 || monorail build icons and cursors&lt;br /&gt;
|-&lt;br /&gt;
|69 .. 74 || maglev build icons and cursors&lt;br /&gt;
|-&lt;br /&gt;
|75 || ??&lt;br /&gt;
|-&lt;br /&gt;
|76 .. 77 || waypoint toolbar and cursor icon&lt;br /&gt;
|-&lt;br /&gt;
|78 .. 81 || waypoint buildings&lt;br /&gt;
|-&lt;br /&gt;
|82 .. 85 || autoroad toobar and cursor for road and trams&lt;br /&gt;
|-&lt;br /&gt;
|86 || helipad&lt;br /&gt;
|-&lt;br /&gt;
|87 || build ship lift cursor&lt;br /&gt;
|-&lt;br /&gt;
|88 .. 89 || build canal toolbar and cursor&lt;br /&gt;
|-&lt;br /&gt;
|90 || fast forward&lt;br /&gt;
|-&lt;br /&gt;
|91 .. 92 || level land toolbar and cursor&lt;br /&gt;
|-&lt;br /&gt;
|93 .. 96 || sell vehicle&lt;br /&gt;
|-&lt;br /&gt;
|97 .. 100 || sell all vehicles&lt;br /&gt;
|-&lt;br /&gt;
|101 .. 104 || replace vehicle&lt;br /&gt;
|-&lt;br /&gt;
|105 || sell chain of rail vehicles&lt;br /&gt;
|-&lt;br /&gt;
|106 .. 113 || clone vehicles button and cursors&lt;br /&gt;
|-&lt;br /&gt;
|114 .. 117 || create vehicle group button&lt;br /&gt;
|-&lt;br /&gt;
|118 .. 121 || delete vehicle group button&lt;br /&gt;
|-&lt;br /&gt;
|122 .. 125 || rename vehicle group button&lt;br /&gt;
|-&lt;br /&gt;
|126 .. 133 || group replace on / off button&lt;br /&gt;
|-&lt;br /&gt;
|134 || road toolbar: build one-way roads&lt;br /&gt;
|-&lt;br /&gt;
|135 || signal toolbar: convert signals&lt;br /&gt;
|-&lt;br /&gt;
|136 .. 137|| build rivers toolbar and cursor&lt;br /&gt;
|-&lt;br /&gt;
|138 .. 143 || OSK&lt;br /&gt;
|-&lt;br /&gt;
|144 || switch toolbar&lt;br /&gt;
|-&lt;br /&gt;
|145 .. 146 || build aqueduct toolbar and cursor&lt;br /&gt;
|-&lt;br /&gt;
|147 .. 148 || (+) and (-) icon&lt;br /&gt;
|-&lt;br /&gt;
|149 || window resize left&lt;br /&gt;
|-&lt;br /&gt;
|150 || play music right-to-left languages&lt;br /&gt;
|-&lt;br /&gt;
|151 .. 152 || shade / unshade&lt;br /&gt;
|-&lt;br /&gt;
|153 || debug&lt;br /&gt;
|-&lt;br /&gt;
|154 .. 157 || vehicle profit icons&lt;br /&gt;
|-&lt;br /&gt;
|158 || unread news&lt;br /&gt;
|-&lt;br /&gt;
|159 || exclusive transport rights&lt;br /&gt;
|-&lt;br /&gt;
|160 || autoreplace protection&lt;br /&gt;
|-&lt;br /&gt;
|161 || autoreplace defined&lt;br /&gt;
|-&lt;br /&gt;
|162 .. 165 || Town happiness indicator: N/A, appalling, mediocre and good&lt;br /&gt;
|-&lt;br /&gt;
|166 .. 167 || Icons for delete to the left resp. right&lt;br /&gt;
|-&lt;br /&gt;
|168 || Default window size&lt;br /&gt;
|-&lt;br /&gt;
|169 .. 173 || Story book: Main toolbar icon, goto place, unfinished goal, finished goal, broken goal&lt;br /&gt;
|-&lt;br /&gt;
|174 || Smallmap cargoflow button&lt;br /&gt;
|-&lt;br /&gt;
|175 .. 178 || Icons for group livery selection&lt;br /&gt;
|-&lt;br /&gt;
|179 .. 183 || NotRoadTypes toolbar and cursor icons&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 16 / 96 Airport preview sprites ====&lt;br /&gt;
[[File:airport_preview_commuter.png|right]]&lt;br /&gt;
Preview sprites for the airports in the order&lt;br /&gt;
# Small airport&lt;br /&gt;
# City airport&lt;br /&gt;
# Heliport&lt;br /&gt;
# Metropolitan airport&lt;br /&gt;
# International airport&lt;br /&gt;
# Commuter airport&lt;br /&gt;
# Heli depot&lt;br /&gt;
# Intercontinental airport&lt;br /&gt;
# Heli station&lt;br /&gt;
&lt;br /&gt;
Sprites are without any offsets and should all be the same size. Make sure so by using the forbid cropping.&lt;br /&gt;
&lt;br /&gt;
==== 17 / 97 Tunnel overlay sprites ====&lt;br /&gt;
[[File:tunnel_overlays.png|right]]&lt;br /&gt;
The sprites provide the ground for the tunnel sprites to be used by railtype NewGRFs which only need to provide the tunnel portals. They must be provided for both terrain types which could be used in any given climate (grass; grass+snow; grass+desert; grass).&lt;br /&gt;
&lt;br /&gt;
=== num-sprites ===&lt;br /&gt;
&lt;br /&gt;
The number of sprites that follow.&lt;br /&gt;
&lt;br /&gt;
Since TTDPatch 2.0.1 alpha 49, this value is an extended byte.&lt;br /&gt;
&lt;br /&gt;
Note that it is not generally an error to provide more sprites than required, but this does expend sprite slots unnecessarily.&lt;br /&gt;
&lt;br /&gt;
=== offset ===&lt;br /&gt;
&lt;br /&gt;
The offset in the Action 5 assignable block of sprites. This term is only read when bit 7 of the type has been set. It can be used to only replace a subset of sprites from a set.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; When creating a TTDPatch compatible grf, you have to skip the OpenTTD specific Action 05&#039;s using an Action 09 rather than an Action 07. Using the latter will result in an error on your Action 05 when using the grf in TTDPatch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; NFORenum distinguishes Action5 with no offset and Action5 with offset 0. While they have technically the same effect, NFORenum assumes an Action5 with no offset has the intention to replace all sprites and checks the number of sprites accordingly. An Action5 with offset is considered to only replace a subset of the sprites, so the sprites are not checked for completeness.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Replace the piers for the aqueduct&lt;br /&gt;
 1457 * 3        05 12 02 06 // action5, type 12, 2 sprites, at offset 6 into that type&lt;br /&gt;
    9 sprites/png/terrain/waterfeatures.png 546 8 09 23 33 -26 0&lt;br /&gt;
   10 sprites/png/terrain/waterfeatures.png 594 8 09 23 33 -5 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action5&amp;diff=3933</id>
		<title>Action5</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=Action5&amp;diff=3933"/>
		<updated>2019-12-28T05:01:39Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* type */ increase ottd gui sprite count to 184&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Define base graphics specific sets&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Action 5 is used to define graphics for several new features of OpenTTD and TTDPatch. This is similar to action 1.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&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; 05 &amp;lt;type&amp;gt; &amp;lt;num-sprites&amp;gt; [&amp;lt;offset&amp;gt;]&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Element!![[GRFActionsDetailed|Size]]!!Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;Sprite-number&amp;gt;||dec||A sequential sprite number&lt;br /&gt;
&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;
|-&lt;br /&gt;
|05||B||Defines action 05&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;type&amp;gt;||B||What type of graphics follow&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;num-sprites&amp;gt;||B*||How many regular sprites follow&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;offset&amp;gt;||B*||Offset in the Action 5 assignable block of sprites&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following num-sprites sprites in the .nfo file have to be RealSprites that will be used as graphics for the given TTDPatch feature, except for type 0A, which requires RecolorSprites.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|0.7|2.5|ttdprev=alpha 19}}Action 5 entries in a .grf file which has a regular GRFID (not FFFFFFFF) will always override those from .grf files with a GRFID of FFFFFFFF.&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;
=== type ===&lt;br /&gt;
&lt;br /&gt;
This sets the type of feature that the graphics are for. If bit 7 is set, the offset variable needs to be set. Bit 7 may only be set if the type supports it. The type can be one of:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Type!!Version!!Feature!!num-sprites (decimal)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04||{{ottdp|0.6|2.0}}||Pre-signal graphics||48&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04||{{ottdp|0.6|2.0}}||Pre-signal and semaphore graphics||112&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04,84&amp;lt;ref name=&amp;quot;offset&amp;quot;&amp;gt;Offset allowed since {{ottdp|1.2|no|ottdrev=r23005}}&amp;lt;/ref&amp;gt;||{{ottdp| |2.5|ttdprev=alpha 41}}||Pre-signal, semaphore, and [[PathBasedSignalling|PBS]] graphics||240&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|05,85&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.0}}||Overhead wires and pylon graphics||48&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|06 ||{{ottdp|0.6| }}||Foundations (retaining walls) for BuildOnSlopes ||74&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|06,86&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|no|ottdrev=r11321}}||Foundations for BuildOnSlopes and half tiles (NS and EW foundations) ||90&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|07||{{ottdp|no|2.5|ttdprev=alpha 43}}||TTDPatch GUI sprites||93 &amp;lt;ref&amp;gt;Type 07 only requires 73 sprites in the stable (2.5 branch); the extra sprites are the clone train and build canal cursors.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|08,88&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|no}}&amp;lt;ref&amp;gt;TTDPatch supported canals via Action5 from 2.0.1 alpha 17 up to alpha 25. In alpha 26 it was removed again in favour of an action-1-2-3 method; see [[Action3/Canals|Action3]]. The method via Action5 is no longer supported by TTDpatch 2.0.1 alpha 26 and newer.&amp;lt;/ref&amp;gt;||Canals||65&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|09,89&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.5|ttdprev=alpha 58}}||One-way road arrows||6&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0A,8A&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.5|ttdprev=alpha 67}}||Two company color translation maps||256&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0B,8B&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.5|ttdprev=alpha 68}}||Tram tracks||113&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0C||{{ottdp|no|2.5|ttdprev=alpha 74}}||Snowy temperate trees||133&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0D||{{ottdp|0.6|2.5|ottdrev=r7325 (r11726)|ttdprev=beta 5}}||Coast Tile graphics||16 (18)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0E||{{ottdp|no|2.6|ttdprev=r1247}}||New Signals||Any&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0F,8F&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.7|2.6|ottdrev=r13469|ttdprev=r1487}}||Sprites for marking tracks on slopes (for track reservation systems like PBS or YAPP)||Up to 12&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10,90&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|no|ottdrev=r9645}}||Additional airport graphics||15&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11,91&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|2.6|ottdrev=r9645|ttdprev=r1589}}||Road stop graphics||8&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12,92&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.7|2.6|ottdrev=r13464|ttdprev=r1498}}||Aqueduct graphics||8&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13,93&amp;lt;ref name=&amp;quot;offset&amp;quot; /&amp;gt;||{{ottdp|0.6|no|ottdrev=r11433}}||Autorail sprites||55&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14,94||{{ottdp|0.6|no|ottdrev=11433}}||Flag sprites||Up to 36&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15,95||{{ottdp|0.6|no|ottdrev=r11433}}||OpenTTD GUI sprites||Up to 184&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|16,96||{{ottdp|1.1|no|ottdrev=r20370}}||Airport preview sprites||Up to 9&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|17,97||{{ottdp|1.2|no|ottdrev=r23952}}||Railtype tunnel base sprites||16&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18,98||{{ottdp|1.5|no|ottdrev=r26869}}||Extra all black palette||1&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== 04 Signal graphics. ====&lt;br /&gt;
&lt;br /&gt;
Signal graphics come in groups of 16. These groups contain sprites in the same order as sprites 1275-1290 in trg1[r].grf; red, then green, for each of: SW-facing, NE-facing, NW-facing, SE-facing, E-facing, W-facing, S-facing, N-facing.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Group(s)!!Contents&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0||lighted entrance signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1||lighted exit signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2||lighted combo signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3||standard (non-pre-signal) semaphore signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4..6||repeat 0..2 for semaphores&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7||standard lighted PBS signals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8..14||repeat 0..6 for PBS signals&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 0C Snowy temperate trees ====&lt;br /&gt;
&lt;br /&gt;
If the temperate snow line is enabled, you can use this to specify the snowy versions of temperate trees. The sprites must be the snowy versions of sprites 1576-1708 from TRG1.GRF, in the same order as they appear there.&lt;br /&gt;
&lt;br /&gt;
==== 0D Coast tile sprites ====&lt;br /&gt;
&lt;br /&gt;
===== In NewGRFs =====&lt;br /&gt;
If diagonal flooding is enabled then due to new corner coasts, you can use this to give a complete set of replacement coast tile sprites. There are 16 in total, 8 original Transport Tycoon Deluxe sprites and 8 for the corner slopes. Order of the sprites&amp;lt;ref name=numbers&amp;gt;Sprite numbers from trg1(r).pcx.&amp;lt;/ref&amp;gt; is as follows:&lt;br /&gt;
&lt;br /&gt;
 3997, 4063, 4064, 4068, 4062, 3998, 4066, 3988,&lt;br /&gt;
 4065, 4069, 3996, 3992, 4067, 3994, 3995, 3999.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Action5Coast16Sprites.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The 16 sprites for feature 0D&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===== In Base Set&#039;s extra grf =====&lt;br /&gt;
Additionally, OpenTTD (since r11726) supports another method of supplying all additional coast tile sprites, but this is only allowed in the &#039;&#039;extra&#039;&#039; NewGRF of [http://wiki.openttd.org/Base_graphics Base Graphic Sets]. In this, only 10 sprites are supplied in the same order as the 16 sprites above, but without the coast sprites already in the base grf. Note that the 10 sprites version supplies two additional slopes, but they are not used, and are currently unlikely to be ever used.&lt;br /&gt;
&lt;br /&gt;
[[File:Action5Coast10Sprites.png]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Only 10 sprites are required for OpenTTD base graphic sets&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;In OpenTTD 10 sprites for type 0D is enough in base graphic sets. The 16 sprites version should not be used for base graphics.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The reason for the existence of a 10 sprite version is to remove the need for including original graphics, and to keep compatibility with old NewGRFs that replace the original shore graphics using Action A without adding new shores using Action 5: When a NewGRF uses the 16 sprites version it takes precedence above any NewGRF replacing the shore graphics using Action A; when a NewGRF uses Action A to replace shore graphics it takes precedence above a 10-sprite Action 5, effectively disabling diagonal flooding. Also due to compatibility the 10 sprites version is invalid for normal NewGRFs, which are not the &amp;quot;extra&amp;quot; NewGRF of some Base Graphics Set.&lt;br /&gt;
&lt;br /&gt;
==== 0E New Signals ====&lt;br /&gt;
&lt;br /&gt;
Any number of real and recolour sprites can be specified in the action in any order.&lt;br /&gt;
&lt;br /&gt;
Sprites are referenced by their offset into the action5 block by a [[VarAction2NewSignals]], hence a logically easily calculable order is advised.&lt;br /&gt;
&lt;br /&gt;
As of TTDPatch 2.6 alpha 0 r1346, the action 5 block defined in the same GRF file as the varaction2, will be used as the base sprite block for the offsets returned by the callback even if it is overridden by a higher priority GRF action 5 definition of the same feature (0E).&lt;br /&gt;
&lt;br /&gt;
==== 0F Tracks for Slopes ====&lt;br /&gt;
&lt;br /&gt;
This should be in the same order as sprites 1031 to 1035 (1). These should only be the rails, basically the same format as sprites 1005 to 1010 (1). There should be 3 groups of these sprites, one for each rail type (railroad, monorail, maglev).&lt;br /&gt;
&lt;br /&gt;
(1) Sprite numbers from trg1r.pcx / ogfx1_base.grf&lt;br /&gt;
&lt;br /&gt;
==== 11 Road stop graphics ====&lt;br /&gt;
&lt;br /&gt;
Road stop graphics consist of 2 groups of 4 sprites. The first group contains graphics for bus stops, second for truck stops. In each group, the sprites are in the following order: SW, NE, NW, SE.&lt;br /&gt;
&lt;br /&gt;
SW and NE sprites are used with road going along the Y axis ( .\&#039; ), NW and SE with road along the X axis( &#039;/. ).&lt;br /&gt;
&lt;br /&gt;
Internally, the stations are defined using the following station layouts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;\d1313&lt;br /&gt;
&lt;br /&gt;
\b13 \b0 \b0 \b3 \b16 \b16 &amp;lt;SW sprite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
\b0 \b0 \b0 \b3 \b16 \b16 &amp;lt;NE sprite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
80&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;\d1314&lt;br /&gt;
&lt;br /&gt;
\b0 \b0 \b0 \b16 \b3 \b16 &amp;lt;NW sprite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
\b0 \b13 \b0 \b16 \b3 \b16 &amp;lt;SE sprite&amp;gt;&lt;br /&gt;
&lt;br /&gt;
80&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where 1313 and 1314 are town road sprites.&lt;br /&gt;
&lt;br /&gt;
[[File:roadstops.png]]&lt;br /&gt;
&lt;br /&gt;
Further sprites can be found in &#039;&#039;&#039;openttd.grf&#039;&#039;&#039; (OpenTTD), &#039;&#039;&#039;ogfxe_extra.grf&#039;&#039;&#039; (OpenGFX) or &#039;&#039;&#039;ttdpbase(w).grf&#039;&#039;&#039; (TTDPatch).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: As of OpenTTD r10185, the behaviour of this feature is identical in both games.&lt;br /&gt;
&lt;br /&gt;
==== 12 Aqueducts ====&lt;br /&gt;
&lt;br /&gt;
8 real sprites should be given. Firstly: 4 bridge end sprites in the order: SW, SE, NE, NW, where the direction is that heading onto the aqueduct. Then 2 middle part sprites for the X and Y directions. Followed by two pillar sprites for the X and Y directions. For examples of where the division between middle sprites and pillars should be made see sprites 2437 to 2592 (1), or an existing aqueduct GRF. Note, that for higher bridges to work effectively, pillars should be approximately 8px in height.&lt;br /&gt;
&lt;br /&gt;
[[File:aqueduct.png]]&lt;br /&gt;
&lt;br /&gt;
==== 15 / 95 OpenTTD GUI sprites ====&lt;br /&gt;
&lt;br /&gt;
OpenTTD defines 162 GUI sprites. Additional sprites not needed by an OpenTTD are simply ignored, so that new(er) base sets can be used by old OpenTTD versions. One can (re-)define a subset of the GUI sprites by giving an offset into the GUI sprites. The sprites are:&lt;br /&gt;
{|&lt;br /&gt;
!Offset !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0 .. 11|| Halftile selections&lt;br /&gt;
|-&lt;br /&gt;
|12 .. 13 || Title screen letters E and D&lt;br /&gt;
|-&lt;br /&gt;
|14 .. 37 || Bridge piers colours 1 .. 4&lt;br /&gt;
|-&lt;br /&gt;
|38 || square indicating NewGRF compatibility&lt;br /&gt;
|-&lt;br /&gt;
|39 || blob indicating server compatibility&lt;br /&gt;
|-&lt;br /&gt;
|40 || lock icon&lt;br /&gt;
|-&lt;br /&gt;
|41 || empty check box&lt;br /&gt;
|-&lt;br /&gt;
|42 || checked check box&lt;br /&gt;
|-&lt;br /&gt;
|43 || warning sign&lt;br /&gt;
|-&lt;br /&gt;
|44 || window resize right&lt;br /&gt;
|-&lt;br /&gt;
|45 .. 48|| arrows&lt;br /&gt;
|-&lt;br /&gt;
|49 || house&lt;br /&gt;
|-&lt;br /&gt;
|50 || shared orders&lt;br /&gt;
|-&lt;br /&gt;
|51 .. 52 || pin / pinned&lt;br /&gt;
|-&lt;br /&gt;
|53 .. 62 || rail build icons and cursors&lt;br /&gt;
|-&lt;br /&gt;
|63 .. 68 || monorail build icons and cursors&lt;br /&gt;
|-&lt;br /&gt;
|69 .. 74 || maglev build icons and cursors&lt;br /&gt;
|-&lt;br /&gt;
|75 || ??&lt;br /&gt;
|-&lt;br /&gt;
|76 .. 77 || waypoint toolbar and cursor icon&lt;br /&gt;
|-&lt;br /&gt;
|78 .. 81 || waypoint buildings&lt;br /&gt;
|-&lt;br /&gt;
|82 .. 85 || autoroad toobar and cursor for road and trams&lt;br /&gt;
|-&lt;br /&gt;
|86 || helipad&lt;br /&gt;
|-&lt;br /&gt;
|87 || build ship lift cursor&lt;br /&gt;
|-&lt;br /&gt;
|88 .. 89 || build canal toolbar and cursor&lt;br /&gt;
|-&lt;br /&gt;
|90 || fast forward&lt;br /&gt;
|-&lt;br /&gt;
|91 .. 92 || level land toolbar and cursor&lt;br /&gt;
|-&lt;br /&gt;
|93 .. 96 || sell vehicle&lt;br /&gt;
|-&lt;br /&gt;
|97 .. 100 || sell all vehicles&lt;br /&gt;
|-&lt;br /&gt;
|101 .. 104 || replace vehicle&lt;br /&gt;
|-&lt;br /&gt;
|105 || sell chain of rail vehicles&lt;br /&gt;
|-&lt;br /&gt;
|106 .. 113 || clone vehicles button and cursors&lt;br /&gt;
|-&lt;br /&gt;
|114 .. 117 || create vehicle group button&lt;br /&gt;
|-&lt;br /&gt;
|118 .. 121 || delete vehicle group button&lt;br /&gt;
|-&lt;br /&gt;
|122 .. 125 || rename vehicle group button&lt;br /&gt;
|-&lt;br /&gt;
|126 .. 133 || group replace on / off button&lt;br /&gt;
|-&lt;br /&gt;
|134 || road toolbar: build one-way roads&lt;br /&gt;
|-&lt;br /&gt;
|135 || signal toolbar: convert signals&lt;br /&gt;
|-&lt;br /&gt;
|136 .. 137|| build rivers toolbar and cursor&lt;br /&gt;
|-&lt;br /&gt;
|138 .. 143 || OSK&lt;br /&gt;
|-&lt;br /&gt;
|144 || switch toolbar&lt;br /&gt;
|-&lt;br /&gt;
|145 .. 146 || build aqueduct toolbar and cursor&lt;br /&gt;
|-&lt;br /&gt;
|147 .. 148 || (+) and (-) icon&lt;br /&gt;
|-&lt;br /&gt;
|149 || window resize left&lt;br /&gt;
|-&lt;br /&gt;
|150 || play music right-to-left languages&lt;br /&gt;
|-&lt;br /&gt;
|151 .. 152 || shade / unshade&lt;br /&gt;
|-&lt;br /&gt;
|153 || debug&lt;br /&gt;
|-&lt;br /&gt;
|154 .. 157 || vehicle profit icons&lt;br /&gt;
|-&lt;br /&gt;
|158 || unread news&lt;br /&gt;
|-&lt;br /&gt;
|159 || exclusive transport rights&lt;br /&gt;
|-&lt;br /&gt;
|160 || autoreplace protection&lt;br /&gt;
|-&lt;br /&gt;
|161 || autoreplace defined&lt;br /&gt;
|-&lt;br /&gt;
|162 .. 165 || Town happiness indicator: N/A, appalling, mediocre and good&lt;br /&gt;
|-&lt;br /&gt;
|166 .. 167 || Icons for delete to the left resp. right&lt;br /&gt;
|-&lt;br /&gt;
|168 || Default window size&lt;br /&gt;
|-&lt;br /&gt;
|169 .. 173 || Story book: Main toolbar icon, goto place, unfinished goal, finished goal, broken goal&lt;br /&gt;
|-&lt;br /&gt;
|174 || Smallmap cargoflow button&lt;br /&gt;
|-&lt;br /&gt;
|175 .. 178 || Icons for group livery selection&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== 16 / 96 Airport preview sprites ====&lt;br /&gt;
[[File:airport_preview_commuter.png|right]]&lt;br /&gt;
Preview sprites for the airports in the order&lt;br /&gt;
# Small airport&lt;br /&gt;
# City airport&lt;br /&gt;
# Heliport&lt;br /&gt;
# Metropolitan airport&lt;br /&gt;
# International airport&lt;br /&gt;
# Commuter airport&lt;br /&gt;
# Heli depot&lt;br /&gt;
# Intercontinental airport&lt;br /&gt;
# Heli station&lt;br /&gt;
&lt;br /&gt;
Sprites are without any offsets and should all be the same size. Make sure so by using the forbid cropping.&lt;br /&gt;
&lt;br /&gt;
==== 17 / 97 Tunnel overlay sprites ====&lt;br /&gt;
[[File:tunnel_overlays.png|right]]&lt;br /&gt;
The sprites provide the ground for the tunnel sprites to be used by railtype NewGRFs which only need to provide the tunnel portals. They must be provided for both terrain types which could be used in any given climate (grass; grass+snow; grass+desert; grass).&lt;br /&gt;
&lt;br /&gt;
=== num-sprites ===&lt;br /&gt;
&lt;br /&gt;
The number of sprites that follow.&lt;br /&gt;
&lt;br /&gt;
Since TTDPatch 2.0.1 alpha 49, this value is an extended byte.&lt;br /&gt;
&lt;br /&gt;
Note that it is not generally an error to provide more sprites than required, but this does expend sprite slots unnecessarily.&lt;br /&gt;
&lt;br /&gt;
=== offset ===&lt;br /&gt;
&lt;br /&gt;
The offset in the Action 5 assignable block of sprites. This term is only read when bit 7 of the type has been set. It can be used to only replace a subset of sprites from a set.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; When creating a TTDPatch compatible grf, you have to skip the OpenTTD specific Action 05&#039;s using an Action 09 rather than an Action 07. Using the latter will result in an error on your Action 05 when using the grf in TTDPatch.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; NFORenum distinguishes Action5 with no offset and Action5 with offset 0. While they have technically the same effect, NFORenum assumes an Action5 with no offset has the intention to replace all sprites and checks the number of sprites accordingly. An Action5 with offset is considered to only replace a subset of the sprites, so the sprites are not checked for completeness.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// Replace the piers for the aqueduct&lt;br /&gt;
 1457 * 3        05 12 02 06 // action5, type 12, 2 sprites, at offset 6 into that type&lt;br /&gt;
    9 sprites/png/terrain/waterfeatures.png 546 8 09 23 33 -26 0&lt;br /&gt;
   10 sprites/png/terrain/waterfeatures.png 594 8 09 23 33 -5 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=Action0/Airport_Tiles&amp;diff=3932</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=3932"/>
		<updated>2019-12-22T22:48:54Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Animation triggers via callback 152 (11) */ added new animation trigger&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;
&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!!Var 18&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|1.1|ottdrev=r19204}}||airport was just constructed||&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|1.1|ottdrev=r19204}}||the tile is processed in the periodic processing loop||&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)||&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)||&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)||&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|1.9}}||Triggered when an airplane (not a helicopter!) lands at airport (single tile only)||&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>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Airports&amp;diff=3931</id>
		<title>NML:Airports</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Airports&amp;diff=3931"/>
		<updated>2019-12-22T22:11:33Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: more clarification on new anim_trigger&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Airports and airport tiles can only be defined in OpenTTD {{ottd|1.1|r19459}} or later.&lt;br /&gt;
&lt;br /&gt;
==Airport (tile) IDs==&lt;br /&gt;
Airport and airport tile IDs are local to the NewGRF, you are free to choose any ID in the 0..255-range. For airport tiles, you should start your item definition with the &#039;substitute&#039;-property, which allocates a new airport tile. The value of this property should be the ID of a [[AirportTileDefaultProps|default airport tile]], which will be used instead of your item if it is not available for whatever reason (for example, missing NewGRF).&lt;br /&gt;
&lt;br /&gt;
Furthermore, you can set the &#039;override&#039;-property, which will cause the existing airport tile to be replaced with your item. For airports, there only is an &#039;override&#039;-property, which acts as a combined substitute and override.&lt;br /&gt;
&lt;br /&gt;
==Airport properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| override&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} The id of airport to replace / override, see [[AirportTypes]]. &#039;&#039;&#039;This property &#039;&#039;must&#039;&#039; be set first, before any other properties or graphics.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| layouts&lt;br /&gt;
| list of layouts&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r20377}}&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} Name of the airport&lt;br /&gt;
|-&lt;br /&gt;
| years_available&lt;br /&gt;
| [start year, last year]&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} List of the availablility years: first and last year it can be built&lt;br /&gt;
|-&lt;br /&gt;
| ttd_airport-type&lt;br /&gt;
| 0 ... 3&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} Substitute TTDPatch airport type&lt;br /&gt;
|-&lt;br /&gt;
| catchment_area&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} Catchment area of the airport in tiles around its perimeter&lt;br /&gt;
|-&lt;br /&gt;
| noise_level&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} Noise generation of this airport&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.2|r23415}} Maintenance cost factor for this airport&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Airport tile properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| override&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} The id of airport tile to override, see [[AirportTypes]]. &#039;&#039;&#039;This property &#039;&#039;must&#039;&#039; be set first, before any other properties or graphics.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| substitute&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} The id of airport tile to replace&lt;br /&gt;
|-&lt;br /&gt;
| callback_flags&lt;br /&gt;
| bitmask&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} Do not set this, unless you use [[NML:Old style callbacks|old-style callbacks]].&lt;br /&gt;
|-&lt;br /&gt;
| animation_info&lt;br /&gt;
| Array [ANIMATION_XXX, frame-count]&lt;br /&gt;
|{{ottd|1.1|r19204}} XXX = [LOOPING &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; NON_LOOPING], 1..253 frames&lt;br /&gt;
|-&lt;br /&gt;
| animation_speed&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} See [[NML:Animation speed|speed settings]]&lt;br /&gt;
|-&lt;br /&gt;
| animation_triggers&lt;br /&gt;
| bitmask(ANIM_TRIGGER_APT_XXX, ... )&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} Bitmask of triggers that will trigger the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;anim_control&amp;lt;/code&amp;gt; callback, see the [[#Animation triggers|table]] below.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Airport variables==&lt;br /&gt;
&lt;br /&gt;
A number of variables are shared between airports and stations. These are listed on the [[NML:Stations#Base station variables|stations]] page.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| layout&lt;br /&gt;
| 0 .. (number of layouts - 1)&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r20364}} Layout number of the airport (index in the layouts array)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Airport tile variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| town_radius_group&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| relative_x&lt;br /&gt;
| 0..255&lt;br /&gt;
| X-coordinate (top right -&amp;amp;gt; bottom left) of the tile relative to the northernmost tile.&lt;br /&gt;
|-&lt;br /&gt;
| relative_y&lt;br /&gt;
| 0..255&lt;br /&gt;
| Y-coordinate (top left -&amp;amp;gt; bottom right) of the tile relative to the northernmost tile.&lt;br /&gt;
|-&lt;br /&gt;
| relative_pos&lt;br /&gt;
| 0xYYXX&lt;br /&gt;
|&lt;br /&gt;
A combination of relative_x and relative_y in the format 0xYYXX. Useful if you want to check for a single position. The [[NML:Builtin functions|builtin function]] relative_coord(x, y) may be useful when making comparisons.&lt;br /&gt;
|-&lt;br /&gt;
| animation_frame&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following variables require a signed x,y offset as parameters. The offset is relative to the current tile. Offset 0,0 means the current tile.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_slope&lt;br /&gt;
| SLOPE_XXX&lt;br /&gt;
|&lt;br /&gt;
See [[NML:List of tile slopes|tile slopes]] for an overview of possible values&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_is_same_airport&lt;br /&gt;
| 1 if the tile is part of the same airport, 0 otherwise&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_is_water&lt;br /&gt;
| 1 if the tile is water, 0 otherwise&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_terrain_type&lt;br /&gt;
| TILETYPE_XX&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_water_class&lt;br /&gt;
| WATER_CLASS_XXX&lt;br /&gt;
| XXX = [NONE &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; SEA &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; CANAL &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; RIVER] Note that tiles for which &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;nearby_tile_is_water&amp;lt;/code&amp;gt; is 0 may still have a water class, e.g. industry tiles with water beneath them.&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_height&lt;br /&gt;
| 0..120&lt;br /&gt;
| The height of the lowest corner of the given tile.&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_class&lt;br /&gt;
|&lt;br /&gt;
[[NML:List of tile classes|Tile class]]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_animation_frame&lt;br /&gt;
| 0..255&lt;br /&gt;
| Animation frame of the given tile&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_airporttile_id&lt;br /&gt;
| 0x00aa, 0xFFbb, 0xFFFE or 0xFFFF&lt;br /&gt;
| 0x00aa: The tile is an airport tile that is part of this GRF, the tile id is aa.&amp;lt;br /&amp;gt; 0xFFbb: The tile is an original airport tile with id bb.&amp;lt;br /&amp;gt; 0xFFFE: The tile is an airport tile defined in another GRF.&amp;lt;br /&amp;gt; 0xFFFF: The tile is not an airport tile or it belongs to another GRF.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Airport callbacks==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callback&lt;br /&gt;
! return value&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| default&lt;br /&gt;
| Sprite set (with 1 sprite)&lt;br /&gt;
| Preview graphics to use in the build menu. One sprite per layout may be given, use the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;layout&amp;lt;/code&amp;gt; to distinguish between layouts.&lt;br /&gt;
|-&lt;br /&gt;
| additional_text&lt;br /&gt;
| String&lt;br /&gt;
| Additional text to show in the buy menu. String may differ per layout, use the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;layout&amp;lt;/code&amp;gt; variable for this.&lt;br /&gt;
|-&lt;br /&gt;
| layout_name&lt;br /&gt;
| String&lt;br /&gt;
| Name of the airport layout in the variable &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;layout&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that, although the airport isn&#039;t built yet, the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;layout&amp;lt;/code&amp;gt; variable is always available and set to the layout the user has selected in the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Airport tile callbacks==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callback&lt;br /&gt;
! return value&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| default&lt;br /&gt;
| Sprite layout&lt;br /&gt;
| Graphics for an airport tile&lt;br /&gt;
|-&lt;br /&gt;
| anim_next_frame&lt;br /&gt;
| Next animation frame or CB_RESULT_XXX&lt;br /&gt;
| Called for every animation frame, returns the next frame to display. Alternatively, return CB_RESULT_NEXT_FRAME or CB_RESULT_STOP_ANIMATION to show the next frame or stop animation, respectively. Returning a sound effect in the high byte will cause that sound effect to be played.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;extra_callback_info1&amp;lt;/code&amp;gt;: 32 random bits.&lt;br /&gt;
|-&lt;br /&gt;
| anim_control&lt;br /&gt;
| Next animation frame or CB_RESULT_XXX&lt;br /&gt;
|&lt;br /&gt;
Called whenever an animation trigger happens. Return the animation frame to show, or CB_RESULT_XXX with XXX = [CB_RESULT_START_ANIMATION &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; STOP_ANIMATION &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; DO_NOTHING] to respectively start the animation in its current frame, stop the animation or do nothing. Returning a sound effect in the high byte will cause that sound effect to be played.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;extra_callback_info1&amp;lt;/code&amp;gt;: 32 random bits.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info2, 0, 8)&amp;lt;/code&amp;gt;: Reason for callback trigger, see the [[#Animation triggers|table]] below. Note that you need to enable the wanted triggers in the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;animation_triggers&amp;lt;/code&amp;gt; property.&lt;br /&gt;
|-&lt;br /&gt;
| anim_speed&lt;br /&gt;
| 0 .. 16&lt;br /&gt;
| Decide the time an animation frame should last. Return value is interpreted as (num_ticks = 2^anim_speed), which each tick lasting 30 ms. Avoid using this callback if possible, since it has to be called each tick for every animated tile. This can be used to create animation frames that last between 30 ms and 33 minutes.&lt;br /&gt;
|-&lt;br /&gt;
| foundations&lt;br /&gt;
| CB_RESULT[_NO]_FOUNDATIONS&lt;br /&gt;
| Return CB_RESULT_FOUNDATIONS to draw standard foundations (default) or CB_RESULT_NO_FOUNDATIONS to not draw them.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Animation triggers===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Animation trigger&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_BUILT&lt;br /&gt;
| Airport is built (all tiles at the same time)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_TILELOOP&lt;br /&gt;
| Airport tile is processed in the tileloop (at different times for different tiles)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_NEW_CARGO&lt;br /&gt;
| New cargo arrives at the airport (all tiles at the same time)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_CARGO_TAKEN&lt;br /&gt;
| All cargo of a cargo type is removed from the airport (all tiles at the same time)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_250_TICKS&lt;br /&gt;
| Every 250 ticks (all tiles at the same time)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_AIRPLANE_LANDS&lt;br /&gt;
| {{ottd|1.9}} Triggered when an airplane (not a helicopter!) lands at airport (single tile only)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Airports&amp;diff=3930</id>
		<title>NML:Airports</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Airports&amp;diff=3930"/>
		<updated>2019-12-22T15:55:16Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Animation triggers */ added ANIM_TRIGGER_APT_AIRPLANE_LANDS&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Airports and airport tiles can only be defined in OpenTTD {{ottd|1.1|r19459}} or later.&lt;br /&gt;
&lt;br /&gt;
==Airport (tile) IDs==&lt;br /&gt;
Airport and airport tile IDs are local to the NewGRF, you are free to choose any ID in the 0..255-range. For airport tiles, you should start your item definition with the &#039;substitute&#039;-property, which allocates a new airport tile. The value of this property should be the ID of a [[AirportTileDefaultProps|default airport tile]], which will be used instead of your item if it is not available for whatever reason (for example, missing NewGRF).&lt;br /&gt;
&lt;br /&gt;
Furthermore, you can set the &#039;override&#039;-property, which will cause the existing airport tile to be replaced with your item. For airports, there only is an &#039;override&#039;-property, which acts as a combined substitute and override.&lt;br /&gt;
&lt;br /&gt;
==Airport properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| override&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} The id of airport to replace / override, see [[AirportTypes]]. &#039;&#039;&#039;This property &#039;&#039;must&#039;&#039; be set first, before any other properties or graphics.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| layouts&lt;br /&gt;
| list of layouts&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r20377}}&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} Name of the airport&lt;br /&gt;
|-&lt;br /&gt;
| years_available&lt;br /&gt;
| [start year, last year]&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} List of the availablility years: first and last year it can be built&lt;br /&gt;
|-&lt;br /&gt;
| ttd_airport-type&lt;br /&gt;
| 0 ... 3&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} Substitute TTDPatch airport type&lt;br /&gt;
|-&lt;br /&gt;
| catchment_area&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} Catchment area of the airport in tiles around its perimeter&lt;br /&gt;
|-&lt;br /&gt;
| noise_level&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19459}} Noise generation of this airport&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.2|r23415}} Maintenance cost factor for this airport&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Airport tile properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| override&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} The id of airport tile to override, see [[AirportTypes]]. &#039;&#039;&#039;This property &#039;&#039;must&#039;&#039; be set first, before any other properties or graphics.&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| substitute&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} The id of airport tile to replace&lt;br /&gt;
|-&lt;br /&gt;
| callback_flags&lt;br /&gt;
| bitmask&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} Do not set this, unless you use [[NML:Old style callbacks|old-style callbacks]].&lt;br /&gt;
|-&lt;br /&gt;
| animation_info&lt;br /&gt;
| Array [ANIMATION_XXX, frame-count]&lt;br /&gt;
|{{ottd|1.1|r19204}} XXX = [LOOPING &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; NON_LOOPING], 1..253 frames&lt;br /&gt;
|-&lt;br /&gt;
| animation_speed&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} See [[NML:Animation speed|speed settings]]&lt;br /&gt;
|-&lt;br /&gt;
| animation_triggers&lt;br /&gt;
| bitmask(ANIM_TRIGGER_APT_XXX, ... )&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19204}} Bitmask of triggers that will trigger the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;anim_control&amp;lt;/code&amp;gt; callback, see the [[#Animation triggers|table]] below.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Airport variables==&lt;br /&gt;
&lt;br /&gt;
A number of variables are shared between airports and stations. These are listed on the [[NML:Stations#Base station variables|stations]] page.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| layout&lt;br /&gt;
| 0 .. (number of layouts - 1)&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r20364}} Layout number of the airport (index in the layouts array)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Airport tile variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| town_radius_group&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| relative_x&lt;br /&gt;
| 0..255&lt;br /&gt;
| X-coordinate (top right -&amp;amp;gt; bottom left) of the tile relative to the northernmost tile.&lt;br /&gt;
|-&lt;br /&gt;
| relative_y&lt;br /&gt;
| 0..255&lt;br /&gt;
| Y-coordinate (top left -&amp;amp;gt; bottom right) of the tile relative to the northernmost tile.&lt;br /&gt;
|-&lt;br /&gt;
| relative_pos&lt;br /&gt;
| 0xYYXX&lt;br /&gt;
|&lt;br /&gt;
A combination of relative_x and relative_y in the format 0xYYXX. Useful if you want to check for a single position. The [[NML:Builtin functions|builtin function]] relative_coord(x, y) may be useful when making comparisons.&lt;br /&gt;
|-&lt;br /&gt;
| animation_frame&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following variables require a signed x,y offset as parameters. The offset is relative to the current tile. Offset 0,0 means the current tile.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_slope&lt;br /&gt;
| SLOPE_XXX&lt;br /&gt;
|&lt;br /&gt;
See [[NML:List of tile slopes|tile slopes]] for an overview of possible values&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_is_same_airport&lt;br /&gt;
| 1 if the tile is part of the same airport, 0 otherwise&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_is_water&lt;br /&gt;
| 1 if the tile is water, 0 otherwise&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_terrain_type&lt;br /&gt;
| TILETYPE_XX&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_water_class&lt;br /&gt;
| WATER_CLASS_XXX&lt;br /&gt;
| XXX = [NONE &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; SEA &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; CANAL &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; RIVER] Note that tiles for which &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;nearby_tile_is_water&amp;lt;/code&amp;gt; is 0 may still have a water class, e.g. industry tiles with water beneath them.&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_height&lt;br /&gt;
| 0..120&lt;br /&gt;
| The height of the lowest corner of the given tile.&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_class&lt;br /&gt;
|&lt;br /&gt;
[[NML:List of tile classes|Tile class]]&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_animation_frame&lt;br /&gt;
| 0..255&lt;br /&gt;
| Animation frame of the given tile&lt;br /&gt;
|-&lt;br /&gt;
| nearby_tile_airporttile_id&lt;br /&gt;
| 0x00aa, 0xFFbb, 0xFFFE or 0xFFFF&lt;br /&gt;
| 0x00aa: The tile is an airport tile that is part of this GRF, the tile id is aa.&amp;lt;br /&amp;gt; 0xFFbb: The tile is an original airport tile with id bb.&amp;lt;br /&amp;gt; 0xFFFE: The tile is an airport tile defined in another GRF.&amp;lt;br /&amp;gt; 0xFFFF: The tile is not an airport tile or it belongs to another GRF.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Airport callbacks==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callback&lt;br /&gt;
! return value&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| default&lt;br /&gt;
| Sprite set (with 1 sprite)&lt;br /&gt;
| Preview graphics to use in the build menu. One sprite per layout may be given, use the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;layout&amp;lt;/code&amp;gt; to distinguish between layouts.&lt;br /&gt;
|-&lt;br /&gt;
| additional_text&lt;br /&gt;
| String&lt;br /&gt;
| Additional text to show in the buy menu. String may differ per layout, use the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;layout&amp;lt;/code&amp;gt; variable for this.&lt;br /&gt;
|-&lt;br /&gt;
| layout_name&lt;br /&gt;
| String&lt;br /&gt;
| Name of the airport layout in the variable &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;layout&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that, although the airport isn&#039;t built yet, the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;layout&amp;lt;/code&amp;gt; variable is always available and set to the layout the user has selected in the GUI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Airport tile callbacks==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callback&lt;br /&gt;
! return value&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| default&lt;br /&gt;
| Sprite layout&lt;br /&gt;
| Graphics for an airport tile&lt;br /&gt;
|-&lt;br /&gt;
| anim_next_frame&lt;br /&gt;
| Next animation frame or CB_RESULT_XXX&lt;br /&gt;
| Called for every animation frame, returns the next frame to display. Alternatively, return CB_RESULT_NEXT_FRAME or CB_RESULT_STOP_ANIMATION to show the next frame or stop animation, respectively. Returning a sound effect in the high byte will cause that sound effect to be played.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;extra_callback_info1&amp;lt;/code&amp;gt;: 32 random bits.&lt;br /&gt;
|-&lt;br /&gt;
| anim_control&lt;br /&gt;
| Next animation frame or CB_RESULT_XXX&lt;br /&gt;
|&lt;br /&gt;
Called whenever an animation trigger happens. Return the animation frame to show, or CB_RESULT_XXX with XXX = [CB_RESULT_START_ANIMATION &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; STOP_ANIMATION &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; DO_NOTHING] to respectively start the animation in its current frame, stop the animation or do nothing. Returning a sound effect in the high byte will cause that sound effect to be played.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;extra_callback_info1&amp;lt;/code&amp;gt;: 32 random bits.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info2, 0, 8)&amp;lt;/code&amp;gt;: Reason for callback trigger, see the [[#Animation triggers|table]] below. Note that you need to enable the wanted triggers in the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;animation_triggers&amp;lt;/code&amp;gt; property.&lt;br /&gt;
|-&lt;br /&gt;
| anim_speed&lt;br /&gt;
| 0 .. 16&lt;br /&gt;
| Decide the time an animation frame should last. Return value is interpreted as (num_ticks = 2^anim_speed), which each tick lasting 30 ms. Avoid using this callback if possible, since it has to be called each tick for every animated tile. This can be used to create animation frames that last between 30 ms and 33 minutes.&lt;br /&gt;
|-&lt;br /&gt;
| foundations&lt;br /&gt;
| CB_RESULT[_NO]_FOUNDATIONS&lt;br /&gt;
| Return CB_RESULT_FOUNDATIONS to draw standard foundations (default) or CB_RESULT_NO_FOUNDATIONS to not draw them.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Animation triggers===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Animation trigger&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_BUILT&lt;br /&gt;
| Airport is built (all tiles at the same time)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_TILELOOP&lt;br /&gt;
| Airport tile is processed in the tileloop (at different times for different tiles)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_NEW_CARGO&lt;br /&gt;
| New cargo arrives at the airport (all tiles at the same time)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_CARGO_TAKEN&lt;br /&gt;
| All cargo of a cargo type is removed from the airport (all tiles at the same time)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_250_TICKS&lt;br /&gt;
| Every 250 ticks (all tiles at the same time)&lt;br /&gt;
|-&lt;br /&gt;
| ANIM_TRIGGER_APT_AIRPLANE_LANDS&lt;br /&gt;
| {{ottd|1.9}} Triggered when airplane lands at airport&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Railtypes&amp;diff=3929</id>
		<title>NML:Railtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Railtypes&amp;diff=3929"/>
		<updated>2019-12-22T14:57:46Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: added new flags and callbacks for 1.9 / 1.10&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Railtypes can only be defined in OpenTTD {{ottd|1.0|r18969}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Railtype IDs==&lt;br /&gt;
Railtype IDs are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other railtype GRFs are loaded, it may be that there are not enough railtype slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (railtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing railtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Railtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and railtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which railtype it is, and the railtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A railtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another railtype is introduced, that references the railtype via the introduced railtype list (railtype propery &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_railtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required railtypes (railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_railtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_railtype_list&amp;lt;/code&amp;gt; multiple railtypes can be defined, which shall be considered equivalent to a railtype.&lt;br /&gt;
This affects the interpretation of train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined railtype, then&lt;br /&gt;
railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_railtype_list&amp;lt;/code&amp;gt; is checked for all defined railtypes, whether the vehicle can be reassigned to some other railtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Railtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default rail types: &amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;, &amp;quot;MONO&amp;quot;, &amp;quot;MGLV&amp;quot;. See the [[RailtypeLabels|List of railtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21842}} Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this railtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| {{ottdp|1.2|no|ottdrev=23129}} Caption of the build rail toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all railtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;rail type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| compatible_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
| Provide a list of rail types that trains of this type can also run on. e.g. [&amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;, &amp;quot;MONO&amp;quot;]&lt;br /&gt;
|-&lt;br /&gt;
| powered_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
| Provide a list of rail types that trains of this type are powered on.&lt;br /&gt;
|-&lt;br /&gt;
| railtype_flags&lt;br /&gt;
| bitmask(RAILTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
; CATENARY&lt;br /&gt;
: Enable catenary&lt;br /&gt;
; NO_LEVEL_CROSSING&lt;br /&gt;
: Disable level crossings&lt;br /&gt;
; HIDDEN {{ottd|1.9}}&lt;br /&gt;
: Hides railtype from player&lt;br /&gt;
; PRECOMBINED {{ottd|1.10}}&lt;br /&gt;
: Enable use of precombined overlay sprites&lt;br /&gt;
; ALLOW_90DEG {{ottd|1.10}}&lt;br /&gt;
: Always allow 90 degree turns&lt;br /&gt;
; DISALLOW_90DEG {{ottd|1.10}}&lt;br /&gt;
: Always prohibit 90 degree turns (takes precedence over ALLOW_90DEG)&lt;br /&gt;
|-&lt;br /&gt;
| curve_speed_multiplier&lt;br /&gt;
| 0...255&lt;br /&gt;
| max curve speed is defined as multiple of the base curve speed (see below)&lt;br /&gt;
|-&lt;br /&gt;
| station_graphics&lt;br /&gt;
| RAILTYPE_STATION_NORMAL, RAILTYPE_STATION_MONORAIL, RAILTYPE_STATION_MAGLEV&lt;br /&gt;
| Type of station graphics to use for the default stations&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19307}} per piece of track as multiplier to PR_BUILD_RAIL base cost. Default cost factors are 8, 12, 16 and 24 for RAIL, ELRL, MONO and MGLV.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| acceleration_model&lt;br /&gt;
| ACC_MODEL_RAIL, ACC_MODEL_MONORAIL, ACC_MODEL_MAGLEV&lt;br /&gt;
| ACC_MODEL_RAIL and ACC_MODEL_MONORAIL behave the same currently&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19307}} entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21842}} List of rail types on that need to be available to the company of the player for this rail type to be introduced at (or after) the introduction date. This limit does not apply when the rail type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21841}} List of rail types that get introduced when this rail type is introduced. For example, to make sure that when a fast rail type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21866}} number which defines the sort order among rail types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th railtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.2|r23415}} Maintenance cost factor for each piece of tracks of this railtype. Default cost factors are 8, 12, 16 and 24 for RAIL, ELRL, MONO and MGLV.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.2|r23758}} List of rail types which this rail type will act as fallback for, if the corresponding rail type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with rail types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal rail&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified rail&lt;br /&gt;
|-&lt;br /&gt;
| 27&lt;br /&gt;
| monorail&lt;br /&gt;
|-&lt;br /&gt;
| 37&lt;br /&gt;
| maglev&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| railtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the rail type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
===Base speeds for curves===&lt;br /&gt;
&lt;br /&gt;
The base speeds relevant for the curve_speed_multiplier are:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! curve length&lt;br /&gt;
! base speed [km/h]&lt;br /&gt;
|-&lt;br /&gt;
| 0 (90 degree turn)&lt;br /&gt;
| 30&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 44&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 55&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| 66&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 75&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 84&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| 91&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| 98&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 103&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| 108&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 111&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 114&lt;br /&gt;
|-&lt;br /&gt;
| 12+&lt;br /&gt;
| 115&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Railtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| enhanced_tunnels&lt;br /&gt;
| 0&lt;br /&gt;
| should custom tunnel entrances be modified other values than 0 might be returned&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile. (Only available for level crossings and depots.) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Railtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For rail types a number of callbacks are used to define rail type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example railtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 16&lt;br /&gt;
| 4 rail directions, autorail, depot, tunnel and convert rail sprites for rail menu.&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 10&lt;br /&gt;
| 6 flat and 4 slope sprites. Track without landscape. Used in junctions, and also with path signals, if the &amp;quot;Show reserved tracks&amp;quot; option is enabled in the game settings.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
| 6 flat and 4 slope, one crossing WITH track, 5 junction pieces without track. Tracks with ballast but without landscape.&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for track in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a train and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_wire&lt;br /&gt;
| 28&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| catenary_pylons&lt;br /&gt;
| 8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossings&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 10&lt;br /&gt;
| For each direction: one track sprite and 4 sprites for road lights etc&lt;br /&gt;
|-&lt;br /&gt;
| depots&amp;lt;ref name=depotr22854&amp;gt;{{ottd|1.2|r22854}} In OpenTTD prior to r22854, depot sprites would not be used if the above &#039;all or none&#039; sprites were not supplied.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 sprites for each south-ish, 1 sprite for each north-ish depot. Like original depots.&lt;br /&gt;
|-&lt;br /&gt;
| fences&lt;br /&gt;
| 8 / 16&lt;br /&gt;
| x, y, vertical, horizontal, SW, SE, NE and NW slopes like original fences at sprite 1301. {{ottdp|1.6|no|ottdrev=r27343}} Since OpenTTD r27343 there is also a 16 sprites version, see below.&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this railtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, train sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
|-&lt;br /&gt;
| signals&lt;br /&gt;
| 8&lt;br /&gt;
| {{ottd|1.3|r24367}} 1 sprite for each direction, order is SW(-facing), NE, NW, SE, E, W, S, N. For more information, see [[#signals|below]]&lt;br /&gt;
|-&lt;br /&gt;
| precombined&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 63&lt;br /&gt;
| {{ottd|1.10}} 1 sprite for each combination of track on a tile. The index is determined by treating each track piece as a bit in the order X Y N S W E, subtracting 1, see [[#Precombined overlay sprites|below]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
If a callback is not implemented or fails, graphics from the fallback railtype (picked via the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;station_graphics&amp;lt;/code&amp;gt; property) will be used instead.&amp;lt;br /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot;-callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== track_overlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== level_crossings ====&lt;br /&gt;
&lt;br /&gt;
You can define a special track piece which crosses the road and for each of two directions and each of the corners of the tile a separate sprite for a light, sign, or whatever should go there.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Sprite number for X&lt;br /&gt;
!Sprite number for Y&lt;br /&gt;
!Useage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Rail overlay&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;North light&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;East light&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;7&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;West light&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;9&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;South light&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_levelcrossing.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== fences ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_fences.png]]&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.6|no|ottdrev=r27343}} Since OpenTTD r27343 there is also a 16 sprites version, this allows to use different sprites resp. offsets for the fences on either track side.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
! Sprite number !! Tile slope !! Track bit !! Fence position !! Version&lt;br /&gt;
|-&lt;br /&gt;
| 0 || flat || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || flat || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 2 || flat || left || E || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 3 || flat || upper || S || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 4 || SW || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 5 || SE || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 6 || NE || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 7 || NW || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 8 || flat || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 9 || flat || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 10 || flat || left || W || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 11 || flat || upper || N || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 12 || SW || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 13 || SE || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 14 || NE || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 15 || NW || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this railtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, train sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RailtypeTunnelExample.png]]&lt;br /&gt;
&lt;br /&gt;
==== signals ====&lt;br /&gt;
&lt;br /&gt;
This callback can be used to supply custom signal graphics.&lt;br /&gt;
&lt;br /&gt;
The resulting sprite set must consist of 8 sprites, corresponding to the following signal directions: SW-facing, NE-facing, NW-facing, SE-facing, E-facing, W-facing, S-facing, N-facing. If resolving fails or results in an empty sprite group, the matching base set sprite will be used instead.&lt;br /&gt;
&lt;br /&gt;
Variable &amp;lt;code style:darkgreen&amp;gt;extra_callback_info2&amp;lt;/code&amp;gt; contains the state, variant and type of the signal. Use the builtin function &amp;lt;code style:darkgreen&amp;gt;getbits()&amp;lt;/code&amp;gt; in the following fashion to access the information:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal state: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 0, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Red signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Green signal&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal variant: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 8, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Light (electric) signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Semaphore&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal type: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 16, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Normal block signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Entry pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 02 || Exit pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 03 || Combo pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 04 || Two-way path signal&lt;br /&gt;
|-&lt;br /&gt;
| 05 || One-way path signal&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Variable &amp;lt;code style:darkgreen&amp;gt;extra_callback_info1&amp;lt;/code&amp;gt; contains the drawing context.&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Signal is drawn in a viewport, i.e. on the map.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || Signal is drawn in the signal GUI. The returned sprite set must still have 8 sprites, but OpenTTD will only use the 7th sprite, so all other sprites can be empty.&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Precombined overlay sprites====&lt;br /&gt;
&lt;br /&gt;
[[File:Rails_combined.png]]&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for railtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_RAILTYPES, elrail, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;SHIN&amp;quot;;&lt;br /&gt;
         name:                       string(STR_EL_RAIL);&lt;br /&gt;
         menu_text:                  string(STR_EL_RAIL);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         compatile_railtype_list:    [&amp;quot;SHIN&amp;quot;,&amp;quot;RAIL&amp;quot;,&amp;quot;ELRL&amp;quot;];                   // Tracks of rail and electrified rail are compatible&lt;br /&gt;
         powered_railtype_list:      [&amp;quot;ELRL&amp;quot;,&amp;quot;SHIN&amp;quot;];                          // But we only have power when we have electricity&lt;br /&gt;
         railtype_flags:             bitmask(RAILTYPE_FLAG_NO_LEVEL_CROSSING); // High speed tracks should not have level crossings&lt;br /&gt;
         curve_speed_multiplier:     1;&lt;br /&gt;
         station_graphics:           RAILTYPE_STATION_MAGLEV;                  // We want the most modern stations&lt;br /&gt;
         construction_cost:          32;                                       // should be pretty steep&lt;br /&gt;
         speed_limit:                500 km/h;&lt;br /&gt;
         acceleration_model:         ACC_MODEL_RAIL;                           // This is still rail, though&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         track_overlay:   ground_switch_overlay;     // defines the sprites drawn as overlay for junctions and highlight&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual tracks and the underlay for junctions&lt;br /&gt;
         level_crossings: level_crossing_switch;     // defines level crossings including traffic lights and blocking bars&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the tracks drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch_electric;     // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges&lt;br /&gt;
         fences:          fences_set;                // defines the look of fences&lt;br /&gt;
         // we don&#039;t define catenary wire and pylons, thus we use the default which comes with the base graphics.&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Cargos&amp;diff=3928</id>
		<title>NML:Cargos</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Cargos&amp;diff=3928"/>
		<updated>2019-12-22T13:52:53Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* Cargo properties */  updated number of cargos available&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
==Cargo IDs==&lt;br /&gt;
For cargos, the item ID corresponds to the cargo type slot of the cargo. TTD default cargos occupy slots 0-11, so if you want to define a new cargo be sure to set this ID to 12 or higher. It is recommended to set the &#039;number&#039;-property to the same value as the item ID.&lt;br /&gt;
&lt;br /&gt;
==Cargo properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| number&lt;br /&gt;
| 0..63&lt;br /&gt;
| Number of the cargo for bitmasks. Prior to {{ottd|1.9}} this was clamped to 0..31. This mostly affects old NewGRFs that don&#039;t have a cargo translation table.&lt;br /&gt;
|-&lt;br /&gt;
| type_name&lt;br /&gt;
| string&lt;br /&gt;
| String to use as cargo type name. Example: &amp;quot;Passengers&amp;quot;. The list of [[NML:Default_TTD_strings|default TTD strings]] contains the strings used by the default cargos (TTD_STR_CARGO_PLURAL_XXX), which may be re-used.&lt;br /&gt;
|-&lt;br /&gt;
| unit_name&lt;br /&gt;
| string&lt;br /&gt;
| String to use for the name of one unit from the cargo type. Currently used for subsidies only (First Passenger service to..). Example string: &amp;quot;Passenger&amp;quot;. The list of [[NML:Default_TTD_strings|default TTD strings]] contains the strings used by the default cargos (TTD_STR_CARGO_SINGULAR_XXX), which may be re-used.&lt;br /&gt;
|-&lt;br /&gt;
| units_of_cargo&lt;br /&gt;
| string&lt;br /&gt;
| String used to show the &amp;quot;short cargo&amp;quot; form for cargo units, e.g. &amp;quot;10 tonnes&amp;quot; or &amp;quot;20.000 litres&amp;quot;. Example: &amp;quot;{COMMA} item{P &amp;quot;&amp;quot; s}&amp;quot;. The list of [[NML:Default_TTD_strings|default TTD strings]] contains the strings used by the default cargos (TTD_STR_PASSENGERS and further), which may be re-used.&lt;br /&gt;
|-&lt;br /&gt;
| items_of_cargo&lt;br /&gt;
| string&lt;br /&gt;
| String used to show the &amp;quot;long cargo&amp;quot; form for cargo units, e.g. &amp;quot;10 tonnes of coal&amp;quot; or &amp;quot;20.000 litres of water&amp;quot;. Example: &amp;quot;{COMMA} item{P &amp;quot;&amp;quot; s} of livestock&amp;quot;. The list of [[NML:Default_TTD_strings|default TTD strings]] contains the strings used by the default cargos (TTD_STR_QUANTITY_XXX), which may be re-used.&lt;br /&gt;
|-&lt;br /&gt;
| type_abbreviation&lt;br /&gt;
| string&lt;br /&gt;
| String used for the two-letter cargo type abbreviation. Must start with a {TINYFONT} string-code. Example: &amp;quot;{TINYFONT}XX&amp;quot;. Make sure to avoid multiple cargos having the same abbreviation. The list of [[NML:Default_TTD_strings|default TTD strings]] contains the strings used by the default cargos (TTD_STR_ABBREV_XXX), which may be re-used.&lt;br /&gt;
|-&lt;br /&gt;
| sprite&lt;br /&gt;
| sprite&lt;br /&gt;
| TTD sprite number for the icon of the cargo. Alternatively, set to NEW_CARGO_SPRITE and use a graphics block to define a custom sprite.&lt;br /&gt;
|-&lt;br /&gt;
| weight&lt;br /&gt;
| float 0..255&lt;br /&gt;
| Weight of one unit of the cargo (in tons)&lt;br /&gt;
|-&lt;br /&gt;
| penalty_lowerbound&lt;br /&gt;
| 0..255&lt;br /&gt;
| Delivery time until penalty is applied&lt;br /&gt;
|-&lt;br /&gt;
| single_penalty_length&lt;br /&gt;
| 0..255&lt;br /&gt;
| Length of the interval where a single penalty is applied&lt;br /&gt;
|-&lt;br /&gt;
| price_factor&lt;br /&gt;
| float&lt;br /&gt;
| Payment for delivering 10 units of cargo across a distance of 20 squares (in British Pounds).&lt;br /&gt;
|-&lt;br /&gt;
| station_list_colour&lt;br /&gt;
| 0..255&lt;br /&gt;
|&lt;br /&gt;
Colour for the station list window (index from the [[NML:Graphic files|default (DOS) palette]])&lt;br /&gt;
|-&lt;br /&gt;
| cargo_payment_list_colour&lt;br /&gt;
| 0..255&lt;br /&gt;
|&lt;br /&gt;
Colour for the cargo payment list window (index from the [[NML:Graphic files|default (DOS) palette]])&lt;br /&gt;
|-&lt;br /&gt;
| is_freight&lt;br /&gt;
| 0 or 1&lt;br /&gt;
| Freight status (for the freighttrains switch); 0=not freight, 1=is freight&lt;br /&gt;
|-&lt;br /&gt;
| cargo_classes&lt;br /&gt;
|&lt;br /&gt;
bitmask([[#Cargo classes|cargo classes]])&lt;br /&gt;
| Cargo classes&lt;br /&gt;
|-&lt;br /&gt;
| cargo_label&lt;br /&gt;
| 4 letters&lt;br /&gt;
| [[CargoTypes|Cargo label]], as used in the [[NML:Cargotable|cargo table]]&lt;br /&gt;
|-&lt;br /&gt;
| town_growth_effect&lt;br /&gt;
| TOWNGROWTH_XXX&lt;br /&gt;
|&lt;br /&gt;
Effect for town growth, see [[#Cargo effects on town growth|Cargo effects on town growth]]&lt;br /&gt;
|-&lt;br /&gt;
| town_growth_multiplier&lt;br /&gt;
| float 0..255&lt;br /&gt;
| Multiplier for town growth. To be used in conjuction with town_growth_effect, when that is not TOWNGROWTH_NONE. For example, a value of 4 makes your cargo have the same effect on town growth as 4 units of food/goods/etc.&lt;br /&gt;
|-&lt;br /&gt;
| callback_flags&lt;br /&gt;
| bitmask(flags)&lt;br /&gt;
|&lt;br /&gt;
Do not set this, unless you use [[NML:Old style callbacks|old-style callbacks]].&lt;br /&gt;
|-&lt;br /&gt;
| capacity_multiplier&lt;br /&gt;
| float 0 .. 255&lt;br /&gt;
| {{ottd|1.2|r22860}} This defines the capacity of vehicles carrying this cargo type, if the vehicle sets no specific capacity to this specific cargo type. Set this property to the amount of cargo a vehicle shall carry, which can carry 1 ton of coal or 1000 thousand litres of water (whatever comparison is more suitable for your cargotype). Depending on whether your cargo type is light or heavy you should set this property either comparing the weight or the volume. Default values are 4 for passengers, 2 for mail, goods and sweets and 1 for all other cargos.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Cargo payment is computed from &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;price_factor&amp;lt;/code&amp;gt;, amount of cargo transported, distance, and a time delivery factor. Unit of the delivery time is 185 ticks, roughly 2.5 days. The factor is constant (with value 255) if delivery time is less than &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;penalty_lowerbound&amp;lt;/code&amp;gt;. It goes down with rate 1 between &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;penalty_lowerbound + single_penalty_length&amp;lt;/code&amp;gt;, and goes down with rate 2 if the delivery time is even longer. Time delivery factor is never less than 31.&lt;br /&gt;
&lt;br /&gt;
===Cargo classes===&lt;br /&gt;
&lt;br /&gt;
Available cargo classes are listed in the following table. Cargos may be in more than one class. Cargo classes are always used as a bitmask, use the built-in function &amp;lt;code&amp;gt;bitmask()&amp;lt;/code&amp;gt;. For example, &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;bitmask(CC_EXPRESS, CC_REFRIGERATED)&amp;lt;/code&amp;gt; is used for food.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! type of cargo&lt;br /&gt;
|-&lt;br /&gt;
| CC_PASSENGERS&lt;br /&gt;
| passengers, also tourists (ECS)&lt;br /&gt;
|-&lt;br /&gt;
| CC_MAIL&lt;br /&gt;
| mail&lt;br /&gt;
|-&lt;br /&gt;
| CC_EXPRESS&lt;br /&gt;
| express goods, also tourists (ECS)&lt;br /&gt;
|-&lt;br /&gt;
| CC_ARMOURED&lt;br /&gt;
| valuables, diamonds, gold and alike&lt;br /&gt;
|-&lt;br /&gt;
| CC_BULK&lt;br /&gt;
| coal, ore, grain,...&lt;br /&gt;
|-&lt;br /&gt;
| CC_PIECE_GOODS&lt;br /&gt;
| containers, crates, livestock&lt;br /&gt;
|-&lt;br /&gt;
| CC_LIQUID&lt;br /&gt;
| oil, milk, water, ...&lt;br /&gt;
|-&lt;br /&gt;
| CC_REFRIGERATED&lt;br /&gt;
| food, milk, ...&lt;br /&gt;
|-&lt;br /&gt;
| CC_HAZARDOUS&lt;br /&gt;
| chemicals?, uranium, ...&lt;br /&gt;
|-&lt;br /&gt;
| CC_COVERED&lt;br /&gt;
| grain, cement, fruit, ...&lt;br /&gt;
|-&lt;br /&gt;
| CC_OVERSIZED&lt;br /&gt;
| vehicles, ...&lt;br /&gt;
|-&lt;br /&gt;
| CC_POWDERIZED&lt;br /&gt;
| cement, ...&lt;br /&gt;
|-&lt;br /&gt;
| CC_NON_POURABLE&amp;lt;br&amp;gt;CC_NEO_BULK&lt;br /&gt;
| sugar cane, wool or straw bales, ...&lt;br /&gt;
|-&lt;br /&gt;
| CC_SPECIAL&lt;br /&gt;
| Special cargo, used for refit tricks. (e.g. regearing in NARS)&lt;br /&gt;
|-&lt;br /&gt;
| NO_CARGO_CLASS&lt;br /&gt;
| Special value that you can used to instead of 0.&lt;br /&gt;
|-&lt;br /&gt;
| ALL_NORMAL_CARGO_CLASSES&lt;br /&gt;
| Bitmask of all cargo classes except CC_SPECIAL. This is the same as &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;bitmask(CC_PASSENGERS, CC_MAIL, ..., CC_OVERSIZED)&amp;lt;/code&amp;gt;. Note: This is already a bitmask, don&#039;t use the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;bitmask(..)&amp;lt;/code&amp;gt; function with this.&lt;br /&gt;
|-&lt;br /&gt;
| ALL_CARGO_CLASSES&lt;br /&gt;
| Bitmask of all cargo classes. Same as &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;ALL_NORMAL_CARGO_CLASSES | bitmask(CC_SPECIAL)&amp;lt;/code&amp;gt; Note: This is already a bitmask, don&#039;t use the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;bitmask(..)&amp;lt;/code&amp;gt; function with this.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Cargo effects on town growth===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! value&lt;br /&gt;
! effect&lt;br /&gt;
|-&lt;br /&gt;
| TOWNGROWTH_PASSENGERS&lt;br /&gt;
| Affect towns as passengers do&lt;br /&gt;
|-&lt;br /&gt;
| TOWNGROWTH_MAIL&lt;br /&gt;
| Affect towns as mail does&lt;br /&gt;
|-&lt;br /&gt;
| TOWNGROWTH_GOODS&lt;br /&gt;
| Affect towns as goods/candy does&lt;br /&gt;
|-&lt;br /&gt;
| TOWNGROWTH_WATER&lt;br /&gt;
| Affect towns as water does (second required cargo for towngrowth in the desert)&lt;br /&gt;
|-&lt;br /&gt;
| TOWNGROWTH_FOOD&lt;br /&gt;
| Affect towns as food/fizzy drinks do (first required cargo for towngrowth in desert/above snowline)&lt;br /&gt;
|-&lt;br /&gt;
| TOWNGROWTH_NONE&lt;br /&gt;
| Don&#039;t affect town growth (default)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Cargo variables==&lt;br /&gt;
&lt;br /&gt;
Cargos have no variables (yet).&lt;br /&gt;
&lt;br /&gt;
==Cargo callbacks==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callback&lt;br /&gt;
! return value&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| default&lt;br /&gt;
| Sprite set (with 1 sprite)&lt;br /&gt;
| Graphics for the cargo icon (only if property &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;sprite&amp;lt;/code&amp;gt; is set to NEW_CARGO_SPRITE)&lt;br /&gt;
|-&lt;br /&gt;
| station_rating&lt;br /&gt;
| -16384 .. 16383&lt;br /&gt;
| See detailed explanation below&lt;br /&gt;
|-&lt;br /&gt;
| profit&lt;br /&gt;
| -12748 .. 12748&lt;br /&gt;
| Called whenever cargo is delivered.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info2, 0, 16):&amp;lt;/code&amp;gt; The manhattan distance the cargo was transported.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info2, 16, 8):&amp;lt;/code&amp;gt; The amount of cargo delivered.&lt;br /&gt;
* &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info2, 24, 8):&amp;lt;/code&amp;gt; The time spent en-route (1 unit = 2.5 days).&lt;br /&gt;
The returned value is multiplied by the amount and the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;price_factor&amp;lt;/code&amp;gt; and then divided by 256 to determine the income the player receives. Returning negative values is possible, it makes players pay for the delivery.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Station rating callback===&lt;br /&gt;
&lt;br /&gt;
The station rating callback is quite complicated and deserves some detailed explanation. The default station rating calculation works as follows:&lt;br /&gt;
&lt;br /&gt;
Internally, station rating is byte with values 0 .. 255, representing respectively 0% and 100%. Every 2.5 days, the transportation &#039;performance&#039; is calculated using some factors outlined below. The station rating is then set to this performance value, with the caveat that the rating change cannot exceed 2 points. Therefore, rating changes are always slow, this callback cannot change this. The initial rating is 175 points (69%). The following factors are parts of the performance, their effects are summed.&lt;br /&gt;
&lt;br /&gt;
====Time since the cargo was last picked up====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Time units (days)&lt;br /&gt;
! Score (%, rounded)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;gt;21 (&amp;amp;gt;52.5 days)&lt;br /&gt;
| 0 (0%)&lt;br /&gt;
|-&lt;br /&gt;
| 13 .. 21 (32.5 days .. 52.5 days)&lt;br /&gt;
| 25 (10%)&lt;br /&gt;
|-&lt;br /&gt;
| 7 .. 12 (17.5 days .. 32.5 days)&lt;br /&gt;
| 50 (20%)&lt;br /&gt;
|-&lt;br /&gt;
| 4 .. 6 (10 days .. 17.5 days)&lt;br /&gt;
| 95 (37%)&lt;br /&gt;
|-&lt;br /&gt;
| 0..3 (0 days..10 days)&lt;br /&gt;
| 130 (51%)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The time unit used equals 185 engine ticks, or 2.5 TTD days. For ships, the time units are divided by 4 before calculating this component, so ships have four times more time before the ratings start dropping.&lt;br /&gt;
&lt;br /&gt;
====Amount of cargo waiting====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Amount of cargo&lt;br /&gt;
! Score (%, rounded)&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;gt;1500&lt;br /&gt;
| -90 (-35%)&lt;br /&gt;
|-&lt;br /&gt;
| 1001..1500&lt;br /&gt;
| -35 (-14%)&lt;br /&gt;
|-&lt;br /&gt;
| 601..1000&lt;br /&gt;
| 0 (0%)&lt;br /&gt;
|-&lt;br /&gt;
| 301..600&lt;br /&gt;
| 10 (4%)&lt;br /&gt;
|-&lt;br /&gt;
| 101..300&lt;br /&gt;
| 30 (12%)&lt;br /&gt;
|-&lt;br /&gt;
| 0..100&lt;br /&gt;
| 40 (16%)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Max. speed of the last vehicle picking up the cargo====&lt;br /&gt;
&lt;br /&gt;
This calculation is somewhat complicated. The maximum speed of the vehicle is expressed in &amp;quot;speed units&amp;quot;. For trains and road vehicles, the speed unit is 1 km/h; for ships, it&#039;s 0.5 km/h; for aircraft, it&#039;s 8 mph. If the max. speed is above 255 speed units, 255 is used instead. If the vehicle is slower than 85 units, no points are awarded; otherwise, you get (speed_units-85)/4 points. Therefore, the maximum you can get is 42 points, or 16%.&lt;br /&gt;
&lt;br /&gt;
====Age of the last carrier picking up the cargo====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Age of vehicle (years)&lt;br /&gt;
! Score (%, rounded)&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 10 (4%)&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 20 (8%)&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| 33 (13%)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In TTDPatch this changes when the &#039;newagerating&#039; switch is enabled&lt;br /&gt;
&lt;br /&gt;
====Bonus for AI companies (TTDPatch only)====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! AI intelligence setting&lt;br /&gt;
! Score (%, rounded)&lt;br /&gt;
|-&lt;br /&gt;
| Low&lt;br /&gt;
| 0 (0%)&lt;br /&gt;
|-&lt;br /&gt;
| Medium&lt;br /&gt;
| 31 (12%)&lt;br /&gt;
|-&lt;br /&gt;
| High&lt;br /&gt;
| 63 (25%)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Bonus for statue in nearest town====&lt;br /&gt;
&lt;br /&gt;
If your company has erected a statue in the nearest town, you get 26 points (10%) bonus to all cargo ratings.&lt;br /&gt;
&lt;br /&gt;
====Callback parameters====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
!value!!meaning&lt;br /&gt;
|-&lt;br /&gt;
|0x10||the last vehicle entering the station was a train&lt;br /&gt;
|-&lt;br /&gt;
|0x11||the last vehicle entering the station was a road vehicle&lt;br /&gt;
|-&lt;br /&gt;
|0x12||the last vehicle entering the station was a ship&lt;br /&gt;
|-&lt;br /&gt;
|0x13||the last vehicle entering the station was an aircraft&lt;br /&gt;
|-&lt;br /&gt;
|0||no vehicle entered the station yet, or (TTDPatch) the last one entering was sold&lt;br /&gt;
|}&lt;br /&gt;
Please note that there&#039;s only one &amp;quot;last vehicle type&amp;quot; field per station, so the vehicle this refers to may not have picked up any of your cargo.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info2, 0, 8)&amp;lt;/code&amp;gt;: The time since the cargo was last picked up, in the time units described above (1 unit = 2.5 days independent of vehicle type)&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info2, 8, 16)&amp;lt;/code&amp;gt;: The amount of cargo waiting.&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;getbits(extra_callback_info2, 24, 8)&amp;lt;/code&amp;gt;: The speed of the last vehicle picking the cargo up, in the speed units described above (if no vehicle entered the station yet, the value is 0xFF).&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Effect of callback====&lt;br /&gt;
&lt;br /&gt;
The return value of the callback replaces the first three components (time since pickup, amount of cargo, max speed) of the calculation. The bonus for statues, TTDPatch AIs and new vehicles is always in effect, you cannot (yet) change this.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Builtin_functions&amp;diff=3927</id>
		<title>NML:Builtin functions</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Builtin_functions&amp;diff=3927"/>
		<updated>2019-12-22T13:25:59Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: updated number of permanent storage registers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavExpressions}}&lt;br /&gt;
&lt;br /&gt;
Available builtin functions are&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Function&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| min(&#039;&#039;v1&#039;&#039;, &#039;&#039;v2&#039;&#039;)&lt;br /&gt;
| Return the smallest value&lt;br /&gt;
|-&lt;br /&gt;
| max(&#039;&#039;v1&#039;&#039;, &#039;&#039;v2&#039;&#039;)&lt;br /&gt;
| Return the biggest value&lt;br /&gt;
|-&lt;br /&gt;
| date(&#039;&#039;year&#039;&#039;, &#039;&#039;month&#039;&#039;, &#039;&#039;day&#039;&#039;)&lt;br /&gt;
| If all values are constants, returns the number of days since year 0. If the year is a variable, the month and day should be 1.&lt;br /&gt;
|-&lt;br /&gt;
| day_of_year(&#039;&#039;month&#039;&#039;, &#039;&#039;day&#039;&#039;)&lt;br /&gt;
| Return the day of the year since January 1st. Both values must be compile-time constants.&lt;br /&gt;
|-&lt;br /&gt;
| bitmask(&#039;&#039;bitpos1&#039;&#039;, ...)&lt;br /&gt;
| Compose an integer by switching the bits at the given positions on.&lt;br /&gt;
|-&lt;br /&gt;
| STORE_TEMP(&#039;&#039;value&#039;&#039;, &#039;&#039;address&#039;&#039;)&lt;br /&gt;
| Store value in temporary storage&lt;br /&gt;
|-&lt;br /&gt;
| STORE_PERM(&#039;&#039;value&#039;&#039;, &#039;&#039;address&#039;&#039;)&lt;br /&gt;
| Store value in permanent storage (industries, airports, towns only). Since {{ottd|1.9}} up to 256 registers are available. Note that accessing permanent town registers thrashes the contents of temporary register 0x100.&lt;br /&gt;
|-&lt;br /&gt;
| LOAD_TEMP(&#039;&#039;address&#039;&#039;)&lt;br /&gt;
| Get value from temporary storage&lt;br /&gt;
|-&lt;br /&gt;
| LOAD_PERM(&#039;&#039;address [, grfid]&#039;&#039;)&lt;br /&gt;
| Get value from permanent storage (industries, airports, towns only). For towns only, specifying a grfid (4-byte string, optional) allows reading the storage of other grfs. Note that accessing permanent town registers thrashes the contents of temporary register 0x100.&lt;br /&gt;
|-&lt;br /&gt;
| hasbit(&#039;&#039;value&#039;&#039;, &#039;&#039;bit_num&#039;&#039;)&lt;br /&gt;
| Test whether a bit in a value is on&lt;br /&gt;
|-&lt;br /&gt;
| getbits(&#039;&#039;value&#039;&#039;, &#039;&#039;first&#039;&#039;, &#039;&#039;amount&#039;&#039;)&lt;br /&gt;
| {{nml|0.4.1}} Extract some bits from a value. Result is (value &amp;gt;&amp;gt; first) &amp;amp; (1 &amp;lt;&amp;lt; amount - 1)&lt;br /&gt;
|-&lt;br /&gt;
| version_openttd(&#039;&#039;major&#039;&#039;, &#039;&#039;minor&#039;&#039;, &#039;&#039;revision&#039;&#039;[, &#039;&#039;build&#039;&#039;])&lt;br /&gt;
| Return the constant representing an OpenTTD version&lt;br /&gt;
|-&lt;br /&gt;
| cargotype_available(&#039;&#039;cargotype&#039;&#039;)&lt;br /&gt;
| Check if a certain cargo type is available in this game. &#039;&#039;cargotype&#039;&#039; must be a literal string of length 4.&lt;br /&gt;
|-&lt;br /&gt;
| railtype_available(&#039;&#039;railtype&#039;&#039;)&lt;br /&gt;
| Check if a railtype is available in this game. &#039;&#039;railtype&#039;&#039; must be a literal string of length 4.&lt;br /&gt;
|-&lt;br /&gt;
| grf_current_status(&#039;&#039;grfid[, mask]&#039;&#039;)&lt;br /&gt;
| 1 if the given GRF is currently active 0, otherwise. If &#039;&#039;mask&#039;&#039; is set, only the bits set in the mask will be tested. Both parameters must be a literal string of length 4.&lt;br /&gt;
|-&lt;br /&gt;
| grf_future_status(&#039;&#039;grfid[, mask]&#039;&#039;)&lt;br /&gt;
| Same as above, but tests whether the grf will become active instead of whether it&#039;s currently active.&lt;br /&gt;
|-&lt;br /&gt;
| grf_order_behind(&#039;&#039;grfid[, mask]&#039;&#039;)&lt;br /&gt;
| Same as above, but tests whether current grf will become active in the order behind the referenced grf.&lt;br /&gt;
|-&lt;br /&gt;
| create_effect(&#039;&#039;effect_sprite&#039;&#039;, &#039;&#039;l_x_offset&#039;&#039;, &#039;&#039;t_y_offset&#039;&#039;, &#039;&#039;z_offset&#039;&#039;)&lt;br /&gt;
| Helper function for the vehicle callback &#039;create_effect&#039;.&lt;br /&gt;
* &#039;&#039;effect_sprite&#039;&#039;: Sprite for the effect. One of EFFECT_SPRITE_[NONE|STEAM|DIESEL|ELECTRIC|AIRCRAFT_BREAKDOWN_SMOKE].&lt;br /&gt;
* &#039;&#039;l_x_offset&#039;&#039;: Longitudinal or X position of the effect, depending on callback result CB_RESULT_CREATE_EFFECT_NO_ROTATION.&lt;br /&gt;
* &#039;&#039;t_y_offset&#039;&#039;: Transversal or Y position of the effect, depending on callback result CB_RESULT_CREATE_EFFECT_NO_ROTATION.&lt;br /&gt;
* &#039;&#039;z_offset&#039;&#039;: Z position of the effect.&lt;br /&gt;
|-&lt;br /&gt;
| visual_effect_and_powered(&#039;&#039;effect&#039;&#039;, &#039;&#039;offset&#039;&#039;, &#039;&#039;powered&#039;&#039;&lt;br /&gt;
| Helper function for the train property visual_effect_and_powered and the VEH_CB_VISUAL_EFFECT_AND_POWERED callback.&lt;br /&gt;
|-&lt;br /&gt;
| str2number(&#039;&#039;4-byte long string&#039;&#039;)&lt;br /&gt;
| Interpret the given string as a dword and return the value as integer.&lt;br /&gt;
|-&lt;br /&gt;
| cargotype(&#039;&#039;4-byte long string&#039;&#039;)&lt;br /&gt;
| Return the index of the given cargo type in the cargo translation table.&lt;br /&gt;
|-&lt;br /&gt;
| railtype(&#039;&#039;4-byte long string&#039;&#039;)&lt;br /&gt;
| Return the index of the given railtype in the railtype translation table.&lt;br /&gt;
|-&lt;br /&gt;
| reserve_sprites(&#039;&#039;number of sprites&#039;&#039;)&lt;br /&gt;
|&lt;br /&gt;
Reserve a number of sprites in the TTD sprite range. This is needed if you want to use your own recolour sprites. Example:&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 param[10] = reserve_sprites(1);&lt;br /&gt;
 replace(param[10]) {&lt;br /&gt;
 	recolour_sprite {&lt;br /&gt;
 		// your colour remap.&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
 spritelayout xyz {&lt;br /&gt;
 	building {&lt;br /&gt;
 		...&lt;br /&gt;
 		recolour: param[10];&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| int(&#039;&#039;v1&#039;&#039;)&lt;br /&gt;
| Converts v1 to an int. This is done by cutting off everything after the decimal point.&lt;br /&gt;
|-&lt;br /&gt;
| abs(&#039;&#039;v1&#039;&#039;)&lt;br /&gt;
| Return the absolute value of v1.&lt;br /&gt;
|-&lt;br /&gt;
| acos / asin / atan / cos / sin / tan&lt;br /&gt;
| Standard trigonometric functions.&lt;br /&gt;
|-&lt;br /&gt;
| CMP(&#039;&#039;param1, param2&#039;&#039;)&lt;br /&gt;
| Compares param1 and param2 (considering them as signed values). Returns CMP_LESS if param1 is less than param2, CMP_EQUAL if they are equal and CMP_GREATER if param1 is greater than param2.&lt;br /&gt;
|-&lt;br /&gt;
| UCMP(&#039;&#039;param1, param2&#039;&#039;)&lt;br /&gt;
| Compares param1 and param2 (considering them as unsigned values). Returns CMP_LESS if param1 is less than param2, CMP_EQUAL if they are equal and CMP_GREATER if param1 is greater than param2.&lt;br /&gt;
|-&lt;br /&gt;
| rotate(&#039;&#039;value, amount&#039;&#039;)&lt;br /&gt;
| Rotates &#039;&#039;value&#039;&#039; to the right &#039;&#039;amount&#039;&#039; steps. This is always a 32 bits rotation.&lt;br /&gt;
|-&lt;br /&gt;
| sound(&#039;&#039;soundfile[, volume]&#039;&#039;)&lt;br /&gt;
| Import sound from .wav-file &#039;&#039;soundfile&#039;&#039; into the grf file and return its numeric ID. Including a file multiple times will not cause it to be duplicated. Loaded sound files must be in WAV format, PCM encoding:&lt;br /&gt;
* mono&lt;br /&gt;
* 8-bit or {{ottdp|1.0|no}} 16-bit&lt;br /&gt;
* 11025 Hz, 22050 Hz or 44100 Hz.&lt;br /&gt;
&#039;&#039;volume&#039;&#039; is in the [0, 100] range, the default value (if not set) is 100.&lt;br /&gt;
|-&lt;br /&gt;
| import_sound(&#039;&#039;grfid, id[, volume]&#039;&#039;)&lt;br /&gt;
| Import sound from a different grf file. &#039;&#039;grfid&#039;&#039; refers to the grf-file to import the sound from. &#039;&#039;id&#039;&#039; is the zero-based internal ID of the sound within the other grf-file. &#039;&#039;volume&#039;&#039; is in the [0, 100] range, the default value (if not set) is 100.&lt;br /&gt;
|-&lt;br /&gt;
| relative_coord(&#039;&#039;x, y&#039;&#039;)&lt;br /&gt;
| Returns the coordinates in &#039;&#039;0xYYXX&#039;&#039; format. x and y must be in the [0, 255] range.&lt;br /&gt;
|-&lt;br /&gt;
| num_corners_raised(&#039;&#039;slope&#039;&#039;)&lt;br /&gt;
|&lt;br /&gt;
Returns the number of corners raised in a slope. Return value is 0 .. 3 for normal slopes and 4 for steep ones. See also [[NML:List of tile slopes|here]] for more information about slopes. Using this on values that are not slopes results in undefined behaviour.&lt;br /&gt;
|-&lt;br /&gt;
| slope_to_sprite_offset(&#039;&#039;slope&#039;&#039;)&lt;br /&gt;
|&lt;br /&gt;
Returns the sprite offset corresponding to a given slope. Return value is in range 0 .. 18. See also [[NML:List of tile slopes|here]] for more information about slopes. The section on [[NML:Spritelayout|spritelayouts]] contains some more information one possible uses, as well as an example. Using this on values that are not slopes results in undefined behaviour.&lt;br /&gt;
|-&lt;br /&gt;
| palette_1cc(&#039;&#039;colour&#039;&#039;)&lt;br /&gt;
|&lt;br /&gt;
Returns the 1cc palette for the given company colour, see [[NML:List_of_default_colour_translation_palettes#Company colour helper functions|here]] for more info.&lt;br /&gt;
|-&lt;br /&gt;
| palette_2cc(&#039;&#039;colour1&#039;&#039;, &#039;&#039;colour2&#039;&#039;)&lt;br /&gt;
|&lt;br /&gt;
Returns the 2cc palette for the given first and second company colour, see [[NML:List_of_default_colour_translation_palettes#Company colour helper functions|here]] for more info.&lt;br /&gt;
|-&lt;br /&gt;
| vehicle_curv_info(&#039;&#039;prev_cur&#039;&#039;, &#039;&#039;cur_next&#039;&#039;)&lt;br /&gt;
| Returns the curvature state of a vehicle, given the direction differences between the (previous-current) and (current-next) vehicle pairs. For use with the vehicle variable &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;curv_info&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| format_string(&#039;&#039;format&#039;&#039;, args)&lt;br /&gt;
| Use the python string formatting functions to create a literal string. Keep in mind that the output is a literal string which cannot be used by string(). This function can however be used to create filenames.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=GlobalVariables&amp;diff=3926</id>
		<title>GlobalVariables</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=GlobalVariables&amp;diff=3926"/>
		<updated>2019-12-22T13:12:34Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: /* OpenTTD Version (21 / A1) */  fixed typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
{|&lt;br /&gt;
!colspan=3|&#039;&#039;&#039;Variable&#039;&#039;&#039;&lt;br /&gt;
!rowspan=2|[[GRFActionsDetailed|&#039;&#039;&#039;Size&#039;&#039;&#039;]]&lt;br /&gt;
!rowspan=2|&#039;&#039;&#039;Versions&#039;&#039;&#039;&lt;br /&gt;
!rowspan=2|&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|[[VariationalAction2 | VA2]]||A[[Action6|6]]/[[Action7|7]]/[[Action9|9]]/[[ActionD|D]]&amp;lt;br&amp;gt;(read)||[[ActionD|ActD]]&amp;lt;br&amp;gt;(write)&lt;br /&gt;
|-&lt;br /&gt;
|00||80||  ||W||{{ottdp|0.6|2.0}}||current date (counted as days from 1920)&amp;lt;ref name=&amp;quot;startdate&amp;quot;&amp;gt;{{ottdp|0.7}} In multiplayer games OpenTTD doesn&#039;t report the current date and year to actions 6,7,9 and D, but the date and year the game was loaded. The reason lies in the fact that it was seen that use of this variable leads to desyncs in network games.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|01||81||  ||B||{{ottdp|0.6|2.0}}|| Current year (count from 1920, max. 2175 even with eternalgame)&amp;lt;ref name=&amp;quot;startdate&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|02||82||  ||B/D||{{ottdp|0.6|2.0}}|| current month (0-11) in bits 0-7; the higher bytes contain unusable junk.&amp;lt;ref name=&amp;quot;startdate&amp;quot;/&amp;gt;&amp;lt;br/&amp;gt;{{ottdp|0.7|ottdrev=r13594}} Since OpenTTD r13594 &#039;day of month&#039; (0-30) is stored in bits 8-12, bit 15 is set in leapyears and &#039;day of year&#039;(0-364 resp. 365) is stored in bits 16-24. All other bits are reserved and should be masked.&lt;br /&gt;
|-&lt;br /&gt;
|03||83||  ||B||{{ottdp|0.6|2.0}}|| Current climate: 00 = temp, 01 = arctic, 02 = trop, 03 = toyland&lt;br /&gt;
|-&lt;br /&gt;
|  ||84||  ||D||{{ottdp|0.6|2.0}}|| [[GrfLoadingStages|GRF loading stage]], see [[#GRF_Loading_stage_.28-_.2F_84.29|below]]&lt;br /&gt;
|-&lt;br /&gt;
|  ||85||  ||B||{{ottdp|0.6|2.0}}|| [[TTDPatchFlags|TTDPatch flags]]: only for bit tests&lt;br /&gt;
|-&lt;br /&gt;
|06||86||  ||B||{{ottdp|0.6|2.0}}|| Road traffic side: bit 4 clear=left, set=right; other bits are reserved and must be masked.&lt;br /&gt;
|-&lt;br /&gt;
|  ||(87)||(87)||B||{{ottdp|no|no}}|| No longer used since TTDPatch 2.0. (was width of &amp;quot;€&amp;quot; character)&lt;br /&gt;
|-&lt;br /&gt;
|  ||88||  ||4*B||{{ottdp|0.6|2.0}}|| Checks specified GRFID (see [[Action7#condition-type|condition-types]])&amp;lt;ref&amp;gt;The value of variable 88 can only be tested with the GRFID tests.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|09||89||  ||W||{{ottdp|0.6|2.0}}|| date fraction, incremented by 0x375 every engine tick&lt;br /&gt;
|-&lt;br /&gt;
|0A||8A||  ||W||{{ottdp|0.6|2.0}}|| animation counter, incremented every tick&lt;br /&gt;
|-&lt;br /&gt;
|0B||8B||  ||D||{{ottdp|no|2.0}}|| [[Version_numbers#TTDPatch_version|TTDPatch version]], see [[#TTDPatch_Version_.280B_.2F_8B.29|below]] &amp;lt;ref&amp;gt;OpenTTD reports some arbitrary TTDPatch 2.6 version number to make old GRFs work, which do not know about OpenTTD. Do not rely on this for new NewGRFs.&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;versionchecks&amp;quot;&amp;gt;It is generally not useful to check version variables using Action 7. If you want to skip certain actions which are incompatible to some versions, you want to skip them during all loading stages. So, use Action 9.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0C||  ||  ||W||{{ottdp|0.6|2.5}}|| current [[Callbacks|callback]] ID (feature-specific), set to 00 when not in a callback&lt;br /&gt;
|-&lt;br /&gt;
|0D||8D||  ||B||{{ottdp|0.6|2.5}}|| TTD version, 0=DOS, 1=Windows&lt;br /&gt;
|-&lt;br /&gt;
|0E||8E||8E||B||{{ottdp|0.6|2.5}}|| Y-Offset for train sprites&lt;br /&gt;
|-&lt;br /&gt;
|0F||8F||8F||3*B||{{ottdp|0.6|2.5}}|| Rail track type cost factors&lt;br /&gt;
|-&lt;br /&gt;
|10||  ||  ||D||{{ottdp|0.6|2.5}}|| Extra callback info 1, see [[#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|below]].&lt;br /&gt;
|-&lt;br /&gt;
|11||  ||  ||B||{{ottdp|no|2.5}}|| current rail tool type (for station callbacks)&lt;br /&gt;
|-&lt;br /&gt;
|12||92||  ||B||{{ottdp|0.6|2.5}}|| Game mode, 0 in title screen, 1 in game and 2 in editor&lt;br /&gt;
|-&lt;br /&gt;
|13||93||93||W||{{ottdp|no|2.5|ttdprev=2.0.1 alpha 39}}|| Tile refresh offset to left &amp;lt;ref name=&amp;quot;tilefresh&amp;quot;&amp;gt;See [[ActionD#Tile+refresh+offsets|Action D]] for more details on tile refresh offsets and their use.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|14||94||94||W||{{ottdp|no|2.5|ttdprev=2.0.1 alpha 39}}|| Tile refresh offset to right &amp;lt;ref name=&amp;quot;tilefresh&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|15||95||95||W||{{ottdp|no|2.5|ttdprev=2.0.1 alpha 39}}|| Tile refresh offset upwards &amp;lt;ref name=&amp;quot;tilefresh&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|16||96||96||W||{{ottdp|no|2.5|ttdprev=2.0.1 alpha 39}}|| Tile refresh offset downwards &amp;lt;ref name=&amp;quot;tilefresh&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|  ||97||97||B||{{ottdp|no|2.5}}|| Fixed snow line height &amp;lt;ref&amp;gt;This variable is a deprecated way to set the snow line height via NewGRFs using [[ActionD]]. It is superseded by the [[Action0/Global Settings#Snow_line_height_table_.2810.29 | Action 0 snow line height table]]. To read the current snow line with [[VariationalAction2 | VarAct2]] in a running game, use variable 20 instead.&amp;lt;/ref&amp;gt;&amp;lt;ref name=&amp;quot;heightlevel&amp;quot;&amp;gt;{{grfTill|7}} For GRF version 7 and below these variable are multiples of 8; {{grfFrom|8}} for GRF version 8 and above they directly state the heightlevel as multiple of 1.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|18||  ||  ||D||{{ottdp|0.6|2.5}}|| Extra callback info 2, see [[#Extra_callback_info_.2810_.2F_-.29_and_.2818_.2F_-.29|below]].&lt;br /&gt;
|-&lt;br /&gt;
|  ||99||99||D||{{ottdp|no|2.5}}|| Global ID offset&lt;br /&gt;
|-&lt;br /&gt;
|1A||9A||  ||D||{{ottdp|0.6|2.5}}|| Has always all bits set; you can use this to make unconditional jumps&lt;br /&gt;
|-&lt;br /&gt;
|1B||  ||  ||B||{{ottdp|no|2.5}}|| display options; bit 0=town names, 1=station names, 2=signs, 3=animation, 4=transparency, 5=full detail&lt;br /&gt;
|-&lt;br /&gt;
|1C||  ||  ||D||{{ottdp|0.6|2.5}}|| result from most recent VarAction2&lt;br /&gt;
|-&lt;br /&gt;
|1D||9D||  ||D||{{ottdp|0.6|2.5}}|| TTD Platform, 0=TTDPatch, 1=OpenTTD &amp;lt;ref name=&amp;quot;versionchecks&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|1E||9E||9E||D||{{ottdp|0.6|2.5}}|| Misc. GRF Features&lt;br /&gt;
|-&lt;br /&gt;
|  ||  ||9F||D||{{ottdp|no|2.5}}|| writable only: Locale-dependent settings&lt;br /&gt;
|-&lt;br /&gt;
|20||  ||  ||B||{{ottdp|0.6|2.5}}|| Current snow line height, FFh if snow isn&#039;t present at all &amp;lt;ref name=&amp;quot;heightlevel&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|21||A1||  ||D||{{ottdp|0.6|no}}|| [[Version_numbers#OpenTTD_version|OpenTTD version]], see [[#OpenTTD_Version_.2821_.2F_A1.29|below]]. &amp;lt;ref name=&amp;quot;versionchecks&amp;quot;/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|22||A2||  ||D||{{ottdp|0.7|2.6|ottdrev=r12499|ttdprev=r1857}}|| Difficulty level: 00= easy, 01=medium, 02=hard, 03=custom&lt;br /&gt;
|-&lt;br /&gt;
|23||A3||  ||D||{{ottdp|0.7|2.6|ottdrev=r13376|ttdpref=r2048}}|| Current date long format&lt;br /&gt;
|-&lt;br /&gt;
|24||A4||  ||D|||{{ottdp|0.7|2.6|ottdrev=r13376|ttdprev=r2048}}|| Current year zero based&lt;br /&gt;
|-&lt;br /&gt;
|25||  ||  ||D||{{ottdp|0.7|ottdrev=r15739}}|| GRFID of the grf that contains the corresponding Action3. Useful when accessing the &amp;quot;related&amp;quot; object. Currently only supported for vehicles.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
All other variable numbers are reserved and must not be used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Special variables ==&lt;br /&gt;
&lt;br /&gt;
=== GRF Loading stage (- / 84) ===&lt;br /&gt;
&lt;br /&gt;
Variable 84 is a BYTE variable up to TTDPatch 2.5r1220. Its lower byte (bits 0..7) are 0 for the post-load and GRF initialization stages and 01 for all other stages. The remaining bits are a bitmask, and including the lower byte have the following meaning:&lt;br /&gt;
{|&lt;br /&gt;
!Bit!!Version!!Meaning&lt;br /&gt;
|-&lt;br /&gt;
|0||{{ottdp|0.6|2.0}}||Set after the &amp;quot;Initialization&amp;quot; stage completes&lt;br /&gt;
|-&lt;br /&gt;
|1..7||{{ottdp|0.6|2.0}}||Always clear&lt;br /&gt;
|-&lt;br /&gt;
|8||{{ottdp|0.6|2.5|ttdprev=r1220}}||Set during the &amp;quot;Reserve&amp;quot; stage only&lt;br /&gt;
|-&lt;br /&gt;
|9||{{ottdp|0.6|2.5|ttdprev=r1220}}||Set during the &amp;quot;Activate&amp;quot; stage only&lt;br /&gt;
|-&lt;br /&gt;
|10||{{ottdp|0.6|2.5|ttdprev=r1220}}||Set during the &amp;quot;Test&amp;quot; stage only&lt;br /&gt;
|-&lt;br /&gt;
|11..15|| || Reserved. Do not test for them.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== TTDPatch Version (0B / 8B) ===&lt;br /&gt;
Variable 8B has the following format: MMmrbbbb (though encoded in little endian as bb bb mr MM)&lt;br /&gt;
{|&lt;br /&gt;
!Element!!Meaning!!Value&lt;br /&gt;
|-&lt;br /&gt;
|MM||major||First number of the [[Version_numbers#TTDPatch_version|TTDPatch version]]&lt;br /&gt;
|-&lt;br /&gt;
|m||minor||Second number of the TTDPatch version&lt;br /&gt;
|-&lt;br /&gt;
|r||revision||Third number of the TTDPatch version&amp;lt;ref name=&amp;quot;rev&amp;quot;&amp;gt;For TTDPatch 2.0, r=7 and for TTDPatch 2.0.1 series, r=10 due to an oversight which used r=1..4 for TTDPatch 2.0 beta 1..4.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|bbbb||build||Alpha/beta version number times ten (up to an including TTDPatch 2.5 beta 5), SVN revision (from TTDPatch 2.5 beta 5 r418 on)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
{|&lt;br /&gt;
!Version!!Variable 8B!!Elements&lt;br /&gt;
|-&lt;br /&gt;
|1.9.1 alpha 50||019101F4|| MM=01, m=9, r=1, bbbb=50*10=01F4&lt;br /&gt;
|-&lt;br /&gt;
|2.0 beta 4||02040028||MM=02, m=0, r=4&amp;lt;ref name=&amp;quot;rev&amp;quot;/&amp;gt;, bbbb=4*10=0028&lt;br /&gt;
|-&lt;br /&gt;
|2.0 final||02070046||MM=02, m=0, r=7&amp;lt;ref name=&amp;quot;rev&amp;quot;/&amp;gt;, bbbb=70=0046&lt;br /&gt;
|-&lt;br /&gt;
|2.0 rev 1||02070050||MM=02, m=0, r=7&amp;lt;ref name=&amp;quot;rev&amp;quot;/&amp;gt;, bbbb=80=0050&lt;br /&gt;
|-&lt;br /&gt;
|2.0.1 alpha 3||020A001E||MM=02, m=0, r=10&amp;lt;ref name=&amp;quot;rev&amp;quot;/&amp;gt;, bbbb=3*10=001E&lt;br /&gt;
|-&lt;br /&gt;
|2.5 beta 2||02500014||MM=02, m=5, r=0, bbbb=2*10=0014&lt;br /&gt;
|-&lt;br /&gt;
|2.5 rev631||02500631||MM=02, m=5, r=0, bbbb=631=0631&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To detect versions from TTDPatch 2.5 rev419 and up correctly, check that var. 8B is 02500419 or higher, or replace 0419 with the actual required revision (using the revision number as hex digits). Because SVN revisions are shared with other patch branches, it is important to check the actual patch version as well as the SVN revision.&lt;br /&gt;
&lt;br /&gt;
=== Y-Offset for train sprites (0E / 8E) ===&lt;br /&gt;
&lt;br /&gt;
Since train sprites must normally have the same offsets on the map and in the depot view, they will appear either too low on the map or too high in the depot view. This variable moves all vehicles in the depot view down by this many pixels.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.0|no|ottdrev=r16867}} Since OpenTTD r16867 this variable works per grf file, that is: It only affects trains defined in the same grf.&lt;br /&gt;
&lt;br /&gt;
=== Rail track type cost factors (0F / 8F) ===&lt;br /&gt;
&lt;br /&gt;
This variable is a collection of three bytes that are used as multipliers for track costs when the &amp;quot;trackcostdiff&amp;quot; switch is on. The value of 08 is the baseline value that is used by standard TTD.&lt;br /&gt;
&lt;br /&gt;
The defaults are the following:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Values!!Track types!!Electrified railways setting&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|08, 10, 18||Regular, Monorail, Maglev||off&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|08, 0D, 10||Regular, Electric, Monorail/Maglev||on&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Extra callback info (10 / -) and (18 / -) ===&lt;br /&gt;
These variables have callback specific meanings. They are described along the individual [[callbacks]].&lt;br /&gt;
&lt;br /&gt;
Additionally they are used outside of callbacks for these special purposes:&lt;br /&gt;
{| |-&lt;br /&gt;
! [[Features|Feature]] !! Usage&lt;br /&gt;
|-&lt;br /&gt;
| Vehicles || Used to distinguish drawing of vehicles in the GUI or on the map. See [[Action2/Vehicles#Introduction|Action2]].&lt;br /&gt;
|-&lt;br /&gt;
| Stations || Used to compose station tiles with sprites from different Action-1-2-3 chains, or to draw custom foundations. See [[Action0/Stations#General_Flags_.2813.29|General station flags]] and [[AdvancedSpriteLayout]].&lt;br /&gt;
|-&lt;br /&gt;
| Railtypes || Used to distinguish between the type of tunnel portal or signal requested. See [[Action3/Railtypes#Tunnel_portal_overlay_.280A.29|Railtype tunnel portal overlay]] or [[Action3/Railtypes#Signal_sprites_.280B.29|Railtype signal sprites]] for details, respectively.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Tile refresh offsets (13,14,15,16 / 93,94,95,96) ===&lt;br /&gt;
&lt;br /&gt;
These four variables belong to an experimental TTDPatch feature. However, their definition is based on an incomplete understanding of the drawing algorithm in TTD, so they actually do not achieve what they were meant to do. Consider this historic content.&lt;br /&gt;
&lt;br /&gt;
{{ottdp|no|2.5|ttdprev=2.0.1 alpha 39}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;These four offsets define the size and position of the rectangle refreshed when TTD decides to refresh a tile. The basis of the calculations is the pixel coordinate of the north corner of the tile.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;After calculating it, TTD subtracts offset_left from it to get the x coordinate of the left edge, adds offset_right to get the x coordinate of the right edge, subtracts offset_up to get the y coordinate of the top edge and adds offset_down to get the y coordinate of the bottom edge. This results in refreshing (offset_left+offset_right)*(offset_up+offset_down) pixels. The default values of these variables are 31, 36, 122 and 32, respectively.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Reading these values is not too useful, but you can modify them using action D as well, so your sprites that would exceed the original limits can still be redrawn and animated properly. Please note that TTD uses these values for every tile, so specifying too high values may slow the game down. Please also note that these variables are specified as dwords for technical reasons, but only the bottom word will be used.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Since these values are global to the entire game, you shouldn&#039;t just overwrite them with an action D. Instead, you should first check if they&#039;re big enough for you by using action 7, and skip your action D if they are. This way, the variables will be set to the maximal value needed, not just the value needed for the last grf in the list.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Snow line height (- / 97) ===&lt;br /&gt;
&lt;br /&gt;
This is only active if the tempsnowline switch is on. It defaults to FF (no snow) and 38 (GRF version &amp;lt; 8) resp. 07 (GRF version &amp;gt;= 8) in the temperate and arctic climates, respectively.&lt;br /&gt;
&lt;br /&gt;
{{grfTill|7}} For GRF version 7 and below it must be set to a multiple of 8, which is one level of height difference.&lt;br /&gt;
&lt;br /&gt;
{{grfFrom|8}} For GRF version 8 and above the heightlevel is set directly as multiple of 1.&lt;br /&gt;
&lt;br /&gt;
=== Global ID offset (- / 99) ===&lt;br /&gt;
&lt;br /&gt;
Setting this variable will add the given value to all the relevant IDs in subsequent action 0, action 3 (&#039;&#039;except&#039;&#039; livery overrides), action 4 (&#039;&#039;except&#039;&#039; generic texts) and action A entries. This is a more convenient way of applying the result of a GRF resource request. Setting this variable applies only to the current .grf file only.&lt;br /&gt;
&lt;br /&gt;
In detail, it affects the following elements:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Action!!Element modified&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0||&amp;lt;tt&amp;gt;&amp;lt;Id&amp;gt;&amp;lt;/tt&amp;gt; (i.e., not property numbers)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3||&amp;lt;tt&amp;gt;&amp;lt;Ids...&amp;gt;&amp;lt;/tt&amp;gt; (i.e., not cargo types or cargo IDs, also not for livery overrides)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4||&amp;lt;tt&amp;gt;&amp;lt;Offset&amp;gt;&amp;lt;/tt&amp;gt; (not for generic texts, though)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|A||&amp;lt;tt&amp;gt;&amp;lt;First-sprite&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Display options (1B / -) ===&lt;br /&gt;
The definition of variable 1B is slightly feature-dependent. For features that can be drawn transparently (stations, bridges, houses, industry tiles and objects) bit 4 is set if the current feature will be drawn normally, and clear if the current feature will be drawn transparently. For these purposes, airports are stations. For all other features, bit 4 is undefined.&lt;br /&gt;
&lt;br /&gt;
=== Misc. GRF Features (1E / 9E) ===&lt;br /&gt;
&lt;br /&gt;
This variable is a global bit mask of various patch features a grf file can enable. Please only set the bits using operation 08 (bitwise OR), or, if absolutely necessary, remove certain bits with operation 07 (bitwise AND). This ensures that you don&#039;t mess up the settings of other grf files.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Bit!!Value!!Version!!Feature&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0||1||{{ottdp|no|2.5}}||Allow trees and fields in the desert&lt;br /&gt;
|-&lt;br /&gt;
|1||2||{{ottdp|0.6|2.5}}||Show pavement and lights in desert towns&lt;br /&gt;
|-&lt;br /&gt;
|2||4||{{ottdp|no|2.5}}||Fields have a height, using a 3D bounding box&lt;br /&gt;
|-&lt;br /&gt;
|3||8||{{ottdp|0.6|2.5}}||Display train vehicles with full width of 32 pixels in depot window (instead of 29 pixels)&amp;lt;ref&amp;gt;Since {{ottdp|1.0|no|ottdrev=r16867}} this flag works per grf file, that is: It only affects trains defined in the same GRF.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|4||10||{{ottdp|1.2|2.6|ottdrev=r23114|ttdprev=r821}}||Enable ambient sound effect callback 144&lt;br /&gt;
|-&lt;br /&gt;
|5||20||{{ottdp|no|2.5/2.6|ttdprev=r1439, will be in yet unreleased 2.5 beta 10}}||Enable catenaries over the third track type (only with electrifiedrailway on)&lt;br /&gt;
|-&lt;br /&gt;
|6||40||{{ottdp|1.5|no|ottdrev=r27200}}||Enable usage of the second rocky tile set. (sprites 4042 to 4061)&lt;br /&gt;
|-&lt;br /&gt;
|31||80000000||{{ottdp|no|2.5}}||Only to be set by ttdpbase(w).grf for identification&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Remarks:&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example code for setting bit 3:&lt;br /&gt;
&lt;br /&gt;
   24 * 9     0D 9E 08 9E FF 08 00 00 00&lt;br /&gt;
&lt;br /&gt;
(Here, the first 08 indicates the bitwise OR operation, and 08 00 00 00 is the value to OR var.9E with.)&lt;br /&gt;
&lt;br /&gt;
=== Locale-dependent settings (1F / 9F) ===&lt;br /&gt;
&lt;br /&gt;
This variable is a doubleword in the format rrccmmll, where the meaning of the bytes is:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!Byte!!Meaning&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|rr||Reserved for future use, just put zero here for now&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|cc||Default currency to be used when the game is first started. It can be larger than 5 to select one of the currencies added via morecurrencies. If this value is larger than 5 while morecurrencies is disabled, US dollars will be used instead.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|mm||Default measurement system to be used when the game is first started. 00h means the imperial system (miles), 01h means the metric system (kilometers), other values are forbidden.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|ll||Language ID. By setting this byte, you can override the default language ID and allow other GRFs to supply correctly localized texts. (The other GRF can check for this value in action 4s)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Reading this variable isn&#039;t reliable, so you must only write to it. Please also note that the cc and mm parts are considered only while loading the title screen for the first time, changing them later is ignored.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE&#039;&#039;&#039;: This variable is reset after the initialization stage. Only changes during the activation stage are considered. This way, GRFs disabled in newgrf.cfg won&#039;t change the language and/or default settings. If you want to modify the cc or mm part, make sure the corresponding action D isn&#039;t skipped by an earlier action 7 or 9. In particular, if your GRF isn&#039;t available for the tropic climate, make sure you set variable 9F before the climate check, since the default title screen is tropic, and your climate check will fail on it.&lt;br /&gt;
&lt;br /&gt;
=== OpenTTD Version (21 / A1) ===&lt;br /&gt;
Variable A1 has the following format: Mmrbbbbb (though encoded in little endian as bb bb rb Mm). This variable has only a usefull meaning when variable 9D is 1 (OpenTTD). This variable can be used since OpenTTD r11330.&lt;br /&gt;
{|&lt;br /&gt;
!Element!!Meaning!!Value&lt;br /&gt;
|-&lt;br /&gt;
|M||major||First number of the [[Version_numbers#OpenTTD_version|OpenTTD version]]&lt;br /&gt;
|-&lt;br /&gt;
|m||minor||Second number of the OpenTTD version&lt;br /&gt;
|-&lt;br /&gt;
|r||revision||Third number of the OpenTTD version&lt;br /&gt;
|-&lt;br /&gt;
|bbbbb||build||Stable releases have 80000h set.&lt;br /&gt;
{{ottd|&amp;amp;le;1.8}} When OpenTTD was versioned using SVN the lower bits contained the SVN revision. Since OpenTTD 1.9 these bits are unused.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The presence of 80000h (bit 19 set) means that a release always has a higher version number than any builds leading to that release.&lt;br /&gt;
&lt;br /&gt;
Examples&lt;br /&gt;
{|&lt;br /&gt;
!Version!!Variable A1!!Elements&lt;br /&gt;
|-&lt;br /&gt;
|0.6.0 r11330||06002C42||M=0, m=6, r=0, bbbbb=11330=2C42&lt;br /&gt;
|-&lt;br /&gt;
|0.6.0 (release)||06080000||M=0, m=6, r=0, bbbbb=0=80000 (due to release)&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Railtypes&amp;diff=3925</id>
		<title>NML:Railtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Railtypes&amp;diff=3925"/>
		<updated>2019-12-22T12:40:48Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: updated for 64 railtypes and fixed a few typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Railtypes can only be defined in OpenTTD {{ottd|1.0|r18969}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Railtype IDs==&lt;br /&gt;
Railtype IDs are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other railtype GRFs are loaded, it may be that there are not enough railtype slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (railtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing railtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Railtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and railtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which railtype it is, and the railtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A railtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the railtype (train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another railtype is introduced, that references the railtype via the introduced railtype list (railtype propery &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_railtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required railtypes (railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_railtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_railtype_list&amp;lt;/code&amp;gt; multiple railtypes can be defined, which shall be considered equivalent to a railtype.&lt;br /&gt;
This affects the interpretation of train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If train property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined railtype, then&lt;br /&gt;
railtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_railtype_list&amp;lt;/code&amp;gt; is checked for all defined railtypes, whether the vehicle can be reassigned to some other railtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Railtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default rail types: &amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;, &amp;quot;MONO&amp;quot;, &amp;quot;MGLV&amp;quot;. See the [[RailtypeLabels|List of railtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21842}} Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this railtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| {{ottdp|1.2|no|ottdrev=23129}} Caption of the build rail toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all railtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;rail type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| compatible_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
| Provide a list of rail types that trains of this type can also run on. e.g. [&amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;, &amp;quot;MONO&amp;quot;]&lt;br /&gt;
|-&lt;br /&gt;
| powered_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
| Provide a list of rail types that trains of this type are powered on.&lt;br /&gt;
|-&lt;br /&gt;
| railtype_flags&lt;br /&gt;
| bitmask(RAILTYPE_FLAG_XXX, ...)&lt;br /&gt;
| XXX = [CATENARY &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; NO_LEVEL_CROSSING] Flags enable catenary and/or disable level crossings.&lt;br /&gt;
|-&lt;br /&gt;
| curve_speed_multiplier&lt;br /&gt;
| 0...255&lt;br /&gt;
| max curve speed is defined as multiple of the base curve speed (see below)&lt;br /&gt;
|-&lt;br /&gt;
| station_graphics&lt;br /&gt;
| RAILTYPE_STATION_NORMAL, RAILTYPE_STATION_MONORAIL, RAILTYPE_STATION_MAGLEV&lt;br /&gt;
| Type of station graphics to use for the default stations&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19307}} per piece of track as multiplier to PR_BUILD_RAIL base cost. Default cost factors are 8, 12, 16 and 24 for RAIL, ELRL, MONO and MGLV.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| acceleration_model&lt;br /&gt;
| ACC_MODEL_RAIL, ACC_MODEL_MONORAIL, ACC_MODEL_MAGLEV&lt;br /&gt;
| ACC_MODEL_RAIL and ACC_MODEL_MONORAIL behave the same currently&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r19307}} entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21842}} List of rail types on that need to be available to the company of the player for this rail type to be introduced at (or after) the introduction date. This limit does not apply when the rail type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21841}} List of rail types that get introduced when this rail type is introduced. For example, to make sure that when a fast rail type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.1|r21866}} number which defines the sort order among rail types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th railtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.2|r23415}} Maintenance cost factor for each piece of tracks of this railtype. Default cost factors are 8, 12, 16 and 24 for RAIL, ELRL, MONO and MGLV.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_railtype_list&lt;br /&gt;
| list of railtype labels&lt;br /&gt;
|&lt;br /&gt;
{{ottd|1.2|r23758}} List of rail types which this rail type will act as fallback for, if the corresponding rail type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with rail types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal rail&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified rail&lt;br /&gt;
|-&lt;br /&gt;
| 27&lt;br /&gt;
| monorail&lt;br /&gt;
|-&lt;br /&gt;
| 37&lt;br /&gt;
| maglev&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| railtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the rail type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
===Base speeds for curves===&lt;br /&gt;
&lt;br /&gt;
The base speeds relevant for the curve_speed_multiplier are:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! curve length&lt;br /&gt;
! base speed [km/h]&lt;br /&gt;
|-&lt;br /&gt;
| 0 (90 degree turn)&lt;br /&gt;
| 30&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| 44&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| 55&lt;br /&gt;
|-&lt;br /&gt;
| 3&lt;br /&gt;
| 66&lt;br /&gt;
|-&lt;br /&gt;
| 4&lt;br /&gt;
| 75&lt;br /&gt;
|-&lt;br /&gt;
| 5&lt;br /&gt;
| 84&lt;br /&gt;
|-&lt;br /&gt;
| 6&lt;br /&gt;
| 91&lt;br /&gt;
|-&lt;br /&gt;
| 7&lt;br /&gt;
| 98&lt;br /&gt;
|-&lt;br /&gt;
| 8&lt;br /&gt;
| 103&lt;br /&gt;
|-&lt;br /&gt;
| 9&lt;br /&gt;
| 108&lt;br /&gt;
|-&lt;br /&gt;
| 10&lt;br /&gt;
| 111&lt;br /&gt;
|-&lt;br /&gt;
| 11&lt;br /&gt;
| 114&lt;br /&gt;
|-&lt;br /&gt;
| 12+&lt;br /&gt;
| 115&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Railtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| enhanced_tunnels&lt;br /&gt;
| 0&lt;br /&gt;
| should custom tunnel entrances be modified other values than 0 might be returned&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile. (Only available for level crossings and depots.) &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Railtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For rail types a number of callbacks are used to define rail type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example railtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 16&lt;br /&gt;
| 4 rail directions, autorail, depot, tunnel and convert rail sprites for rail menu.&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 10&lt;br /&gt;
| 6 flat and 4 slope sprites. Track without landscape. Used in junctions, and also with path signals, if the &amp;quot;Show reserved tracks&amp;quot; option is enabled in the game settings.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 16&lt;br /&gt;
| 6 flat and 4 slope, one crossing WITH track, 5 junction pieces without track. Tracks with ballast but without landscape.&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for track in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a train and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_wire&lt;br /&gt;
| 28&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| catenary_pylons&lt;br /&gt;
| 8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossings&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 10&lt;br /&gt;
| For each direction: one track sprite and 4 sprites for road lights etc&lt;br /&gt;
|-&lt;br /&gt;
| depots&amp;lt;ref name=depotr22854&amp;gt;{{ottd|1.2|r22854}} In OpenTTD prior to r22854, depot sprites would not be used if the above &#039;all or none&#039; sprites were not supplied.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 sprites for each south-ish, 1 sprite for each north-ish depot. Like original depots.&lt;br /&gt;
|-&lt;br /&gt;
| fences&lt;br /&gt;
| 8 / 16&lt;br /&gt;
| x, y, vertical, horizontal, SW, SE, NE and NW slopes like original fences at sprite 1301. {{ottdp|1.6|no|ottdrev=r27343}} Since OpenTTD r27343 there is also a 16 sprites version, see below.&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this railtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, train sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
|-&lt;br /&gt;
| signals&lt;br /&gt;
| 8&lt;br /&gt;
| {{ottd|1.3|r24367}} 1 sprite for each direction, order is SW(-facing), NE, NW, SE, E, W, S, N. For more information, see [[#signals|below]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
If a callback is not implemented or fails, graphics from the fallback railtype (picked via the &amp;lt;code style=&amp;quot;color:darkgreen&amp;quot;&amp;gt;station_graphics&amp;lt;/code&amp;gt; property) will be used instead.&amp;lt;br /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot;-callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== track_overlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== level_crossings ====&lt;br /&gt;
&lt;br /&gt;
You can define a special track piece which crosses the road and for each of two directions and each of the corners of the tile a separate sprite for a light, sign, or whatever should go there.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Sprite number for X&lt;br /&gt;
!Sprite number for Y&lt;br /&gt;
!Useage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Rail overlay&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;North light&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;East light&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;7&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;West light&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;9&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;South light&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_levelcrossing.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== fences ====&lt;br /&gt;
&lt;br /&gt;
[[File:railtype_fences.png]]&lt;br /&gt;
&lt;br /&gt;
{{ottdp|1.6|no|ottdrev=r27343}} Since OpenTTD r27343 there is also a 16 sprites version, this allows to use different sprites resp. offsets for the fences on either track side.&lt;br /&gt;
&lt;br /&gt;
{| |-&lt;br /&gt;
! Sprite number !! Tile slope !! Track bit !! Fence position !! Version&lt;br /&gt;
|-&lt;br /&gt;
| 0 || flat || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || flat || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 2 || flat || left || E || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 3 || flat || upper || S || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 4 || SW || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 5 || SE || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 6 || NE || X || NW || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 7 || NW || Y || NE || {{ottdp|1.0|no|ottdrev=r19056}}&lt;br /&gt;
|-&lt;br /&gt;
| 8 || flat || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 9 || flat || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 10 || flat || left || W || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 11 || flat || upper || N || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 12 || SW || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 13 || SE || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 14 || NE || X || SE || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|-&lt;br /&gt;
| 15 || NW || Y || SW || {{ottdp|1.6|no|ottdrev=r27343}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this railtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, train sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the railtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RailtypeTunnelExample.png]]&lt;br /&gt;
&lt;br /&gt;
==== signals ====&lt;br /&gt;
&lt;br /&gt;
This callback can be used to supply custom signal graphics.&lt;br /&gt;
&lt;br /&gt;
The resulting sprite set must consist of 8 sprites, corresponding to the following signal directions: SW-facing, NE-facing, NW-facing, SE-facing, E-facing, W-facing, S-facing, N-facing. If resolving fails or results in an empty sprite group, the matching base set sprite will be used instead.&lt;br /&gt;
&lt;br /&gt;
Variable &amp;lt;code style:darkgreen&amp;gt;extra_callback_info2&amp;lt;/code&amp;gt; contains the state, variant and type of the signal. Use the builtin function &amp;lt;code style:darkgreen&amp;gt;getbits()&amp;lt;/code&amp;gt; in the following fashion to access the information:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal state: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 0, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Red signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Green signal&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal variant: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 8, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Light (electric) signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Semaphore&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
Signal type: &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info2, 16, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 00 || Normal block signal&lt;br /&gt;
|-&lt;br /&gt;
| 01 || Entry pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 02 || Exit pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 03 || Combo pre-signal&lt;br /&gt;
|-&lt;br /&gt;
| 04 || Two-way path signal&lt;br /&gt;
|-&lt;br /&gt;
| 05 || One-way path signal&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
Variable &amp;lt;code style:darkgreen&amp;gt;extra_callback_info1&amp;lt;/code&amp;gt; contains the drawing context.&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;:&lt;br /&gt;
{| |-&lt;br /&gt;
! Result !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 0 || Signal is drawn in a viewport, i.e. on the map.&lt;br /&gt;
|-&lt;br /&gt;
| 0x10 || Signal is drawn in the signal GUI. The returned sprite set must still have 8 sprites, but OpenTTD will only use the 7th sprite, so all other sprites can be empty.&lt;br /&gt;
|-&lt;br /&gt;
| all other values || Reserved&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for railtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_RAILTYPES, elrail, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;SHIN&amp;quot;;&lt;br /&gt;
         name:                       string(STR_EL_RAIL);&lt;br /&gt;
         menu_text:                  string(STR_EL_RAIL);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         compatile_railtype_list:    [&amp;quot;SHIN&amp;quot;,&amp;quot;RAIL&amp;quot;,&amp;quot;ELRL&amp;quot;];                   // Tracks of rail and electrified rail are compatible&lt;br /&gt;
         powered_railtype_list:      [&amp;quot;ELRL&amp;quot;,&amp;quot;SHIN&amp;quot;];                          // But we only have power when we have electricity&lt;br /&gt;
         railtype_flags:             bitmask(RAILTYPE_FLAG_NO_LEVEL_CROSSING); // High speed tracks should not have level crossings&lt;br /&gt;
         curve_speed_multiplier:     1;&lt;br /&gt;
         station_graphics:           RAILTYPE_STATION_MAGLEV;                  // We want the most modern stations&lt;br /&gt;
         construction_cost:          32;                                       // should be pretty steep&lt;br /&gt;
         speed_limit:                500 km/h;&lt;br /&gt;
         acceleration_model:         ACC_MODEL_RAIL;                           // This is still rail, though&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         track_overlay:   ground_switch_overlay;     // defines the sprites drawn as overlay for junctions and highlight&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual tracks and the underlay for junctions&lt;br /&gt;
         level_crossings: level_crossing_switch;     // defines level crossings including traffic lights and blocking bars&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the tracks drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch_electric;     // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges&lt;br /&gt;
         fences:          fences_set;                // defines the look of fences&lt;br /&gt;
         // we don&#039;t define catenary wire and pylons, thus we use the default which comes with the base graphics.&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Tramtypes&amp;diff=3924</id>
		<title>NML:Tramtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Tramtypes&amp;diff=3924"/>
		<updated>2019-12-22T12:25:03Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: added two tramtype_flags&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Tramtypes can only be defined in OpenTTD {{ottd|1.10}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tramtype IDs==&lt;br /&gt;
Tramtypes and Roadtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other tramtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (tramtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing tramtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Tramtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and tramtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which tramtype it is, and the tramtypes define the compatibility between each other.&lt;br /&gt;
* Remember that the road vehicle flag &#039;ROADVEH_FLAG_TRAM&#039; must be set in order for a road vehicle to be considered a tram.&lt;br /&gt;
* A vehicle exists, if its tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A tramtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another tramtype is introduced, that references the tramtype via the introduced tramtype list (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_tramtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required tramtypes (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_tramtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; multiple tramtypes can be defined, which shall be considered equivalent to a tramtype.&lt;br /&gt;
This affects the interpretation of tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined tramtype, then&lt;br /&gt;
tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; is checked for all defined tramtypes, whether the vehicle can be reassigned to some other tramtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Tramtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default tram types: &amp;quot;RAIL&amp;quot; and &amp;quot;ELRL&amp;quot;. See the [[TramtypeLabels|List of tramtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this tramtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build tram toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;tram type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| Provide a list of tram types that tram vehicles of this type are powered on, e.g. [&amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;]. Note that there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| tramtype_flags&lt;br /&gt;
| bitmask(TRAMTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
;HIDDEN&lt;br /&gt;
:Hides the tramtype from players, but remains available to towns&lt;br /&gt;
;TOWN_BUILD&lt;br /&gt;
:Towns don&#039;t build tramtracks...so what does this do???&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of track as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that need to be available to the company of the player for this tram type to be introduced at (or after) the introduction date. This limit does not apply when the tram type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that get introduced when this tram type is introduced. For example, to make sure that when a fast tram type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among tram types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th tramtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of tram of this tramtype. Default cost factors are 16 and 24 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types which this tram type will act as fallback for, if the corresponding tram type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with tram types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal tram&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified tram&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| tramtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the tram type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Tramtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Tramtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For tram types a number of callbacks are used to define tram type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example tramtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for tram in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a tram vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this tramtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot; callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== overlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this tramtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:TramtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for tramtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_TRAMTYPES, dctram, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;DCTM&amp;quot;;&lt;br /&gt;
         name:                       string(STR_DC_TRAM);&lt;br /&gt;
         menu_text:                  string(STR_DC_TRAM);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_tramtype_list:      [&amp;quot;DCTM&amp;quot;,&amp;quot;ELRL&amp;quot;];                          // These trams are compatible with other electric trams&lt;br /&gt;
         tramtype_flags:             bitmask(TRAMTYPE_FLAG_CATENARY);          // These tramways require catenary&lt;br /&gt;
         construction_cost:          24;                                       // Electric tramways are pricey&lt;br /&gt;
         speed_limit:                50 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the tramtrack underlay&lt;br /&gt;
         overlay:         track_overlay_switch;      // defines the tramtrack overlay&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the track drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Roadtypes&amp;diff=3923</id>
		<title>NML:Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Roadtypes&amp;diff=3923"/>
		<updated>2019-12-22T12:19:54Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: added two roadtype_flags&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Roadtypes can only be defined in OpenTTD {{ottd|1.10}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Roadtype IDs==&lt;br /&gt;
Roadtypes and Tramtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other roadtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (roadtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing roadtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Roadtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and roadtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which roadtype it is, and the roadtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A roadtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another roadtype is introduced, that references the roadtype via the introduced roadtype list (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_roadtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required roadtypes (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_roadtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_roadtype_list&amp;lt;/code&amp;gt; multiple roadtypes can be defined, which shall be considered equivalent to a roadtype.&lt;br /&gt;
This affects the interpretation of road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined roadtype, then&lt;br /&gt;
roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_roadtype_list&amp;lt;/code&amp;gt; is checked for all defined roadtypes, whether the vehicle can be reassigned to some other roadtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Roadtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default road types: &amp;quot;ROAD&amp;quot; and &amp;quot;ELRD&amp;quot;. See the [[RoadtypeLabels|List of roadtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this roadtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build road toolbar&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;road type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| Provide a list of road types that road vehicles of this type are powered on, e.g. [&amp;quot;ROAD&amp;quot;, &amp;quot;ELRD&amp;quot;]. Note that there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| roadtype_flags&lt;br /&gt;
| bitmask(ROADTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
;HIDDEN&lt;br /&gt;
:Hides the roadtype from players, but remains available to towns&lt;br /&gt;
;TOWN_BUILD&lt;br /&gt;
:Enables the roadtype to be built by towns, based on ???&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of road as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that need to be available to the company of the player for this road type to be introduced at (or after) the introduction date. This limit does not apply when the road type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that get introduced when this road type is introduced. For example, to make sure that when a fast road type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among road types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th roadtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of road of this roadtype. Default cost factors are 16 and 24 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types which this road type will act as fallback for, if the corresponding road type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with road types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal road&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified road&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| roadtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the road type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Roadtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Roadtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For road types a number of callbacks are used to define road type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example roadtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for road in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a road vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this roadtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| roadstops&lt;br /&gt;
| 4&lt;br /&gt;
| Overlays for drive-in road stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot; callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&lt;br /&gt;
==== roadstops ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_drivein.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this roadtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RoadtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for roadtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_ROADTYPES, highway, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;HWY_&amp;quot;;&lt;br /&gt;
         name:                       string(STR_HWY);&lt;br /&gt;
         menu_text:                  string(STR_HWY);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_roadtype_list:      [&amp;quot;HWY_&amp;quot;,&amp;quot;ROAD&amp;quot;];                          // Highways are compatible with other roads&lt;br /&gt;
         roadtype_flags:             bitmask(ROADTYPE_FLAG_NO_LEVEL_CROSSING, ROADTYPE_FLAG_NO_HOUSES); // Highways should not have level crossings or houses&lt;br /&gt;
         construction_cost:          32;                                       // Highways are expensive&lt;br /&gt;
         speed_limit:                100 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual roads&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the roads drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
         roadstops:       roadstops_switch;          // defines the look of roadstop pavement&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Roadtypes&amp;diff=3922</id>
		<title>NML:Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Roadtypes&amp;diff=3922"/>
		<updated>2019-12-22T11:30:16Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial roadtype spec (incomplete)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Roadtypes can only be defined in OpenTTD {{ottd|1.10}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Roadtype IDs==&lt;br /&gt;
Roadtypes and Tramtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other roadtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (roadtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing roadtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Roadtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and roadtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which roadtype it is, and the roadtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A roadtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another roadtype is introduced, that references the roadtype via the introduced roadtype list (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_roadtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required roadtypes (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_roadtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_roadtype_list&amp;lt;/code&amp;gt; multiple roadtypes can be defined, which shall be considered equivalent to a roadtype.&lt;br /&gt;
This affects the interpretation of road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined roadtype, then&lt;br /&gt;
roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_roadtype_list&amp;lt;/code&amp;gt; is checked for all defined roadtypes, whether the vehicle can be reassigned to some other roadtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Roadtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default road types: &amp;quot;ROAD&amp;quot; and &amp;quot;ELRD&amp;quot;. See the [[RoadtypeLabels|List of roadtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this roadtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build road toolbar&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;road type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| Provide a list of road types that road vehicles of this type are powered on, e.g. [&amp;quot;ROAD&amp;quot;, &amp;quot;ELRD&amp;quot;]. Note that there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| roadtype_flags&lt;br /&gt;
| bitmask(ROADTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of road as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that need to be available to the company of the player for this road type to be introduced at (or after) the introduction date. This limit does not apply when the road type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that get introduced when this road type is introduced. For example, to make sure that when a fast road type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among road types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th roadtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of road of this roadtype. Default cost factors are 16 and 24 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types which this road type will act as fallback for, if the corresponding road type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with road types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal road&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified road&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| roadtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the road type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Roadtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Roadtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For road types a number of callbacks are used to define road type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example roadtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for road in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a road vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this roadtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| roadstops&lt;br /&gt;
| 4&lt;br /&gt;
| Overlays for drive-in road stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot; callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&lt;br /&gt;
==== roadstops ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_drivein.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this roadtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RoadtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for roadtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_ROADTYPES, highway, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;HWY_&amp;quot;;&lt;br /&gt;
         name:                       string(STR_HWY);&lt;br /&gt;
         menu_text:                  string(STR_HWY);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_roadtype_list:      [&amp;quot;HWY_&amp;quot;,&amp;quot;ROAD&amp;quot;];                          // Highways are compatible with other roads&lt;br /&gt;
         roadtype_flags:             bitmask(ROADTYPE_FLAG_NO_LEVEL_CROSSING, ROADTYPE_FLAG_NO_HOUSES); // Highways should not have level crossings or houses&lt;br /&gt;
         construction_cost:          32;                                       // Highways are expensive&lt;br /&gt;
         speed_limit:                100 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual roads&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the roads drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
         roadstops:       roadstops_switch;          // defines the look of roadstop pavement&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=NML:Tramtypes&amp;diff=3921</id>
		<title>NML:Tramtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=NML:Tramtypes&amp;diff=3921"/>
		<updated>2019-12-22T11:29:20Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial tramtype spec (incomplete)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Tramtypes can only be defined in OpenTTD {{ottd|1.10}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tramtype IDs==&lt;br /&gt;
Tramtypes and Roadtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other tramtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (tramtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing tramtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Tramtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and tramtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which tramtype it is, and the tramtypes define the compatibility between each other.&lt;br /&gt;
* Remember that the road vehicle flag &#039;ROADVEH_FLAG_TRAM&#039; must be set in order for a road vehicle to be considered a tram.&lt;br /&gt;
* A vehicle exists, if its tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A tramtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another tramtype is introduced, that references the tramtype via the introduced tramtype list (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_tramtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required tramtypes (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_tramtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; multiple tramtypes can be defined, which shall be considered equivalent to a tramtype.&lt;br /&gt;
This affects the interpretation of tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined tramtype, then&lt;br /&gt;
tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; is checked for all defined tramtypes, whether the vehicle can be reassigned to some other tramtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Tramtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default tram types: &amp;quot;RAIL&amp;quot; and &amp;quot;ELRL&amp;quot;. See the [[TramtypeLabels|List of tramtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this tramtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build tram toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;tram type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| Provide a list of tram types that tram vehicles of this type are powered on, e.g. [&amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;]. Note that there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| tramtype_flags&lt;br /&gt;
| bitmask(TRAMTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of track as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that need to be available to the company of the player for this tram type to be introduced at (or after) the introduction date. This limit does not apply when the tram type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that get introduced when this tram type is introduced. For example, to make sure that when a fast tram type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among tram types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th tramtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of tram of this tramtype. Default cost factors are 16 and 24 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types which this tram type will act as fallback for, if the corresponding tram type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with tram types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal tram&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified tram&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| tramtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the tram type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Tramtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Tramtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For tram types a number of callbacks are used to define tram type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example tramtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for tram in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a tram vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this tramtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot; callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== overlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this tramtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:TramtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for tramtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_TRAMTYPES, dctram, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;DCTM&amp;quot;;&lt;br /&gt;
         name:                       string(STR_DC_TRAM);&lt;br /&gt;
         menu_text:                  string(STR_DC_TRAM);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_tramtype_list:      [&amp;quot;DCTM&amp;quot;,&amp;quot;ELRL&amp;quot;];                          // These trams are compatible with other electric trams&lt;br /&gt;
         tramtype_flags:             bitmask(TRAMTYPE_FLAG_CATENARY);          // These tramways require catenary&lt;br /&gt;
         construction_cost:          24;                                       // Electric tramways are pricey&lt;br /&gt;
         speed_limit:                50 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the tramtrack underlay&lt;br /&gt;
         overlay:         track_overlay_switch;      // defines the tramtrack overlay&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the track drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=User:Andrew350/NML:Tramtypes&amp;diff=3920</id>
		<title>User:Andrew350/NML:Tramtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=User:Andrew350/NML:Tramtypes&amp;diff=3920"/>
		<updated>2019-12-22T11:22:14Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: initial conversion to tramtypes (from roadtypes)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Tramtypes can only be defined in OpenTTD {{ottd|1.10}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tramtype IDs==&lt;br /&gt;
Tramtypes and Roadtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other tramtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (tramtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing tramtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Tramtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and tramtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which tramtype it is, and the tramtypes define the compatibility between each other.&lt;br /&gt;
* Remember that the road vehicle flag &#039;ROADVEH_FLAG_TRAM&#039; must be set in order for a road vehicle to be considered a tram.&lt;br /&gt;
* A vehicle exists, if its tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A tramtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the tramtype (tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another tramtype is introduced, that references the tramtype via the introduced tramtype list (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_tramtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required tramtypes (tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_tramtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; multiple tramtypes can be defined, which shall be considered equivalent to a tramtype.&lt;br /&gt;
This affects the interpretation of tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If tram vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined tramtype, then&lt;br /&gt;
tramtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;powered_tramtype_list&amp;lt;/code&amp;gt; is checked for all defined tramtypes, whether the vehicle can be reassigned to some other tramtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Tramtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default tram types: &amp;quot;RAIL&amp;quot; and &amp;quot;ELRL&amp;quot;. See the [[TramtypeLabels|List of tramtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this tramtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build tram toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;tram type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| Provide a list of tram types that tram vehicles of this type are powered on, e.g. [&amp;quot;RAIL&amp;quot;, &amp;quot;ELRL&amp;quot;]. Note that there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for tramtypes&lt;br /&gt;
|-&lt;br /&gt;
| tramtype_flags&lt;br /&gt;
| bitmask(TRAMTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of track as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that need to be available to the company of the player for this tram type to be introduced at (or after) the introduction date. This limit does not apply when the tram type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types that get introduced when this tram type is introduced. For example, to make sure that when a fast tram type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among tram types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th tramtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of tram of this tramtype. Default cost factors are 16 and 24 for RAIL and ELRL, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_tramtype_list&lt;br /&gt;
| list of tramtype labels&lt;br /&gt;
| List of tram types which this tram type will act as fallback for, if the corresponding tram type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with tram types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal tram&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified tram&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| tramtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the tram type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Tramtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Tramtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For tram types a number of callbacks are used to define tram type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example tramtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 track combinations, 4 slopes, and 4 dead ends. These sprites are required&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for tram in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a tram vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 track combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this tramtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot; callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== overlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_overlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this tramtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, tram vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the tramtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:TramtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for tramtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_TRAMTYPES, dctram, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;DCTM&amp;quot;;&lt;br /&gt;
         name:                       string(STR_DC_TRAM);&lt;br /&gt;
         menu_text:                  string(STR_DC_TRAM);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_tramtype_list:      [&amp;quot;DCTM&amp;quot;,&amp;quot;ELRL&amp;quot;];                          // These trams are compatible with other electric trams&lt;br /&gt;
         tramtype_flags:             bitmask(TRAMTYPE_FLAG_CATENARY);          // These tramways require catenary&lt;br /&gt;
         construction_cost:          24;                                       // Electric tramways are pricey&lt;br /&gt;
         speed_limit:                50 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the tramtrack underlay&lt;br /&gt;
         overlay:         track_overlay_switch;      // defines the tramtrack overlay&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the track drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=User:Andrew350/NML:Roadtypes&amp;diff=3919</id>
		<title>User:Andrew350/NML:Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=User:Andrew350/NML:Roadtypes&amp;diff=3919"/>
		<updated>2019-12-22T11:03:09Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: remove some unnecessary things&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Roadtypes can only be defined in OpenTTD {{ottd|1.10}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Roadtype IDs==&lt;br /&gt;
Roadtypes and Tramtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other roadtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (roadtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing roadtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Roadtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and roadtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which roadtype it is, and the roadtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A roadtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another roadtype is introduced, that references the roadtype via the introduced roadtype list (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_roadtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required roadtypes (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_roadtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_roadtype_list&amp;lt;/code&amp;gt; multiple roadtypes can be defined, which shall be considered equivalent to a roadtype.&lt;br /&gt;
This affects the interpretation of road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined roadtype, then&lt;br /&gt;
roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_roadtype_list&amp;lt;/code&amp;gt; is checked for all defined roadtypes, whether the vehicle can be reassigned to some other roadtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Roadtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default road types: &amp;quot;ROAD&amp;quot; and &amp;quot;ELRD&amp;quot;. See the [[RoadtypeLabels|List of roadtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this roadtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build road toolbar&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;road type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| Provide a list of road types that road vehicles of this type are powered on, e.g. [&amp;quot;ROAD&amp;quot;, &amp;quot;ELRD&amp;quot;]. Note that there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| roadtype_flags&lt;br /&gt;
| bitmask(ROADTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of road as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that need to be available to the company of the player for this road type to be introduced at (or after) the introduction date. This limit does not apply when the road type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that get introduced when this road type is introduced. For example, to make sure that when a fast road type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among road types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th roadtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of road of this roadtype. Default cost factors are 16 and 24 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types which this road type will act as fallback for, if the corresponding road type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with road types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal road&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified road&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| roadtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the road type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Roadtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Roadtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For road types a number of callbacks are used to define road type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example roadtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for road in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a road vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this roadtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| roadstops&lt;br /&gt;
| 4&lt;br /&gt;
| Overlays for drive-in road stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot; callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&lt;br /&gt;
==== roadstops ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_drivein.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this roadtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RoadtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for roadtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_ROADTYPES, highway, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;HWY_&amp;quot;;&lt;br /&gt;
         name:                       string(STR_HWY);&lt;br /&gt;
         menu_text:                  string(STR_HWY);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_roadtype_list:      [&amp;quot;HWY_&amp;quot;,&amp;quot;ROAD&amp;quot;];                          // Highways are compatible with other roads&lt;br /&gt;
         roadtype_flags:             bitmask(ROADTYPE_FLAG_NO_LEVEL_CROSSING, ROADTYPE_FLAG_NO_HOUSES); // Highways should not have level crossings or houses&lt;br /&gt;
         construction_cost:          32;                                       // Highways are expensive&lt;br /&gt;
         speed_limit:                100 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual roads&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the roads drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
         roadstops:       roadstops_switch;          // defines the look of roadstop pavement&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_underlay.png&amp;diff=3918</id>
		<title>File:Nrt underlay.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_underlay.png&amp;diff=3918"/>
		<updated>2019-12-22T09:41:48Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_overlay.png&amp;diff=3917</id>
		<title>File:Nrt overlay.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_overlay.png&amp;diff=3917"/>
		<updated>2019-12-22T09:41:37Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_gui.png&amp;diff=3916</id>
		<title>File:Nrt gui.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_gui.png&amp;diff=3916"/>
		<updated>2019-12-22T09:41:26Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_drivein.png&amp;diff=3915</id>
		<title>File:Nrt drivein.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_drivein.png&amp;diff=3915"/>
		<updated>2019-12-22T09:41:16Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_depot.png&amp;diff=3914</id>
		<title>File:Nrt depot.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_depot.png&amp;diff=3914"/>
		<updated>2019-12-22T09:41:02Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_catenary_front.png&amp;diff=3913</id>
		<title>File:Nrt catenary front.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_catenary_front.png&amp;diff=3913"/>
		<updated>2019-12-22T09:40:52Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_catenary_back.png&amp;diff=3912</id>
		<title>File:Nrt catenary back.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_catenary_back.png&amp;diff=3912"/>
		<updated>2019-12-22T09:40:41Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_bridge.png&amp;diff=3911</id>
		<title>File:Nrt bridge.png</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=File:Nrt_bridge.png&amp;diff=3911"/>
		<updated>2019-12-22T09:39:15Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
	<entry>
		<id>https://newgrf-specs.tt-wiki.net/index.php?title=User:Andrew350/NML:Roadtypes&amp;diff=3910</id>
		<title>User:Andrew350/NML:Roadtypes</title>
		<link rel="alternate" type="text/html" href="https://newgrf-specs.tt-wiki.net/index.php?title=User:Andrew350/NML:Roadtypes&amp;diff=3910"/>
		<updated>2019-12-22T09:35:12Z</updated>

		<summary type="html">&lt;p&gt;Andrew350: fine-tuned the specs for roadtypes, cross referenced from frosch&amp;#039;s draft specs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NMLNavPropVarCB}}&lt;br /&gt;
&lt;br /&gt;
Roadtypes can only be defined in OpenTTD {{ottd|1.10}} or later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Roadtype IDs==&lt;br /&gt;
Roadtypes and Tramtypes share a pool of 64 IDs. Either feature can use as many IDs as needed (i.e. it is not limited to 32 per type), but both features combined are limited to 64 in total. NewGRF-local IDs may freely be chosen, but must be in the 0..63 range. If other roadtype/tramtype GRFs are loaded, it may be that there are not enough slots available. To prevent your entire NewGRF from being deactivated with the &#039;Attempt to use invalid ID&#039;-error, you can use the following code:&lt;br /&gt;
&lt;br /&gt;
 if (roadtype_available(&amp;quot;LABL&amp;quot;) || loading_stage == LOADING_STAGE_RESERVE)&lt;br /&gt;
     ... item definition ...&lt;br /&gt;
 } else if (loading_stage == LOADING_STAGE_ACTIVATE) {&lt;br /&gt;
     ... warning / error ...&lt;br /&gt;
 }&lt;br /&gt;
The warning / error is optional, but can be used to inform the user about the missing roadtypes.&lt;br /&gt;
&lt;br /&gt;
== Vehicle and Roadtype availability ==&lt;br /&gt;
&lt;br /&gt;
Vehicle and roadtype availability and compatibility is influenced by multiple properties.&lt;br /&gt;
Generally, the vehicle defines which roadtype it is, and the roadtypes define the compatibility between each other.&lt;br /&gt;
* A vehicle exists, if its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;) is defined. Otherwise the vehicle is disabled.&lt;br /&gt;
* When a vehicle is introduced, it always introduces its roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
* A roadtype is introduced, if at least one of the following conditions is met:&lt;br /&gt;
** A vehicle is introduced, that references the roadtype (road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;).&lt;br /&gt;
** Another roadtype is introduced, that references the roadtype via the introduced roadtype list (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduces_roadtype_list&amp;lt;/code&amp;gt;).&lt;br /&gt;
** The introduction date (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;introduction_date&amp;lt;/code&amp;gt;) is passed and all required roadtypes (roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;requires_roadtype_list &amp;lt;/code&amp;gt;) are available.&lt;br /&gt;
&lt;br /&gt;
Via roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_roadtype_list&amp;lt;/code&amp;gt; multiple roadtypes can be defined, which shall be considered equivalent to a roadtype.&lt;br /&gt;
This affects the interpretation of road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt;. If road vehicle property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;track_type&amp;lt;/code&amp;gt; references an undefined roadtype, then&lt;br /&gt;
roadtype property &amp;lt;code style=&amp;quot;color:green&amp;quot;&amp;gt;compatible_roadtype_list&amp;lt;/code&amp;gt; is checked for all defined roadtypes, whether the vehicle can be reassigned to some other roadtype.&lt;br /&gt;
Otherwise the vehicle is disabled.&lt;br /&gt;
&lt;br /&gt;
==Roadtype properties==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! property&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| label&lt;br /&gt;
| 4-byte string&lt;br /&gt;
| names of default road types: &amp;quot;ROAD&amp;quot; and &amp;quot;ELRD&amp;quot;. See the [[RoadtypeLabels|List of roadtype labels]] in the NewGRF Specs for currently defined custom labels.&lt;br /&gt;
|-&lt;br /&gt;
| introduction_date&lt;br /&gt;
| date(yyyy,mm,dd)&lt;br /&gt;
| Valid range for yyyy is 0 ... 5000000.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| string&lt;br /&gt;
| Name of this roadtype&lt;br /&gt;
|-&lt;br /&gt;
| toolbar_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build road toolbar. In earlier versions this is the same as the &#039;name&#039;&lt;br /&gt;
|-&lt;br /&gt;
| menu_text&lt;br /&gt;
| string&lt;br /&gt;
| Shown in the dropdown menu for all roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| build_window_caption&lt;br /&gt;
| string&lt;br /&gt;
| Caption of the build vehicle window&lt;br /&gt;
|-&lt;br /&gt;
| autoreplace_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the autoreplace window&lt;br /&gt;
|-&lt;br /&gt;
| new_engine_text&lt;br /&gt;
| string&lt;br /&gt;
| String for the &amp;quot;We have invented a new &amp;amp;lt;road type&amp;amp;gt; engine&amp;quot; news message&lt;br /&gt;
|-&lt;br /&gt;
| powered_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| Provide a list of road types that road vehicles of this type are powered on, e.g. [&amp;quot;ROAD&amp;quot;, &amp;quot;ELRD&amp;quot;]. Note that there is no difference between &amp;quot;powered&amp;quot; and &amp;quot;compatible&amp;quot; for roadtypes&lt;br /&gt;
|-&lt;br /&gt;
| roadtype_flags&lt;br /&gt;
| bitmask(ROADTYPE_FLAG_XXX, ...)&lt;br /&gt;
|&lt;br /&gt;
;CATENARY&lt;br /&gt;
:Enable catenary&lt;br /&gt;
;NO_LEVEL_CROSSING&lt;br /&gt;
:Disable level crossings&lt;br /&gt;
;NO_HOUSES&lt;br /&gt;
:Disallows house construction&lt;br /&gt;
|-&lt;br /&gt;
| construction_cost&lt;br /&gt;
| 0 ... 65525&lt;br /&gt;
| Per piece of road as multiplier to PR_BUILD_ROAD base cost. Default cost factors are 8 and 16 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| speed_limit&lt;br /&gt;
| 0 ... 65525 km/h (speed units)&lt;br /&gt;
| A speed limit of 0 means unlimited speed&lt;br /&gt;
|-&lt;br /&gt;
| map_colour&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Entry in the colour palette.&lt;br /&gt;
|-&lt;br /&gt;
| requires_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that need to be available to the company of the player for this road type to be introduced at (or after) the introduction date. This limit does not apply when the road type is introduced by the introduction of a vehicle.&lt;br /&gt;
|-&lt;br /&gt;
| introduces_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types that get introduced when this road type is introduced. For example, to make sure that when a fast road type is introduced the slow variant exists.&lt;br /&gt;
|-&lt;br /&gt;
| sort_order&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Number which defines the sort order among road types. If this entry is not defined, it gets assigned sort order n*10+7 for the n-th roadtype.&lt;br /&gt;
|-&lt;br /&gt;
| maintenance_cost&lt;br /&gt;
| 0 ... 255&lt;br /&gt;
| Maintenance cost factor for each piece of road of this roadtype. Default cost factors are 16 and 24 for ROAD and ELRD, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| alternative_roadtype_list&lt;br /&gt;
| list of roadtype labels&lt;br /&gt;
| List of road types which this road type will act as fallback for, if the corresponding road type is not defined separately&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Sort order===&lt;br /&gt;
&lt;br /&gt;
The sort_order influences the sort order of the drop down lists with road types. Default values are as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! Value&lt;br /&gt;
! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| 07&lt;br /&gt;
| normal road&lt;br /&gt;
|-&lt;br /&gt;
| 17&lt;br /&gt;
| electrified road&lt;br /&gt;
|-&lt;br /&gt;
| n7&lt;br /&gt;
| roadtype #n&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Thus the road type that (internally) gets index 8 will get a default value of 87. These defaults are to keep the ordering when this property is not supported as they were.&lt;br /&gt;
&lt;br /&gt;
==Roadtype variables==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! name&lt;br /&gt;
! value range&lt;br /&gt;
! comment&lt;br /&gt;
|-&lt;br /&gt;
| terrain_type&lt;br /&gt;
| TILETYPE_NORMAL, TILETYPE_DESERT, TILETYPE_RAIN_FOREST, TILETYPE_SNOW&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| level_crossing_status&lt;br /&gt;
| LEVEL_CROSSING_CLOSED, LEVEL_CROSSING_OPEN&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| build_date&lt;br /&gt;
| 0 .. 5000000&lt;br /&gt;
| for depots only: build date of the depot in days since 0&lt;br /&gt;
|-&lt;br /&gt;
| town_zone&lt;br /&gt;
| [[NML:List of town zones|town zone]]&lt;br /&gt;
| Town zone of the tile. (Only available for level crossings and depots.)&lt;br /&gt;
|-&lt;br /&gt;
| random_bits&lt;br /&gt;
|&lt;br /&gt;
| 2 pseudo random bits&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Roadtype callbacks==&lt;br /&gt;
&lt;br /&gt;
For road types a number of callbacks are used to define road type graphics. Each should refer to a sprite set containing the relevant sprites. Refer to the [[#Example sprites|example sprites]] or the example roadtype grf in the NML repository, for an example on what sprites are needed in what order.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;t&amp;quot;&lt;br /&gt;
! callbacks&lt;br /&gt;
! number of sprites&lt;br /&gt;
! meaning&lt;br /&gt;
|-&lt;br /&gt;
| gui&lt;br /&gt;
| 12&lt;br /&gt;
| 6 gui icons, 6 cursors&lt;br /&gt;
|-&lt;br /&gt;
| track_overlay&amp;lt;ref name=leftout&amp;gt;Either all or none of these sprites should be provided.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are optional for roadtypes.&lt;br /&gt;
|-&lt;br /&gt;
| underlay&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 19&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, and 4 dead ends. These sprites are required.&lt;br /&gt;
|-&lt;br /&gt;
| tunnels&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| 1 sprite for each direction. Sprite is overlay for road in existing tunnel graphics. The original ground sprite is drawn, then the overlay, then possibly a road vehicle and the original tunnel head is drawn over the top. This keeps compatibility with different landscape types. Sprite order: SW, NW, NE, SE.&lt;br /&gt;
|-&lt;br /&gt;
| catenary_front&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels, 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| catenary_back&lt;br /&gt;
| 29&lt;br /&gt;
| 11 roadbit combinations, 4 slopes, 4 dead ends, 4 tunnels (unused), 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| bridge_surfaces&amp;lt;ref name=leftout /&amp;gt;&lt;br /&gt;
| 6&lt;br /&gt;
| 2 bridge middle, 4 bridge ramps&lt;br /&gt;
|-&lt;br /&gt;
| depots&lt;br /&gt;
| 6&lt;br /&gt;
| If not present, the default depot sprites (depending on catenary flag) plus track overlay are drawn.&lt;br /&gt;
If present, the depot sprites are expected to include track overlay graphics.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
|-&lt;br /&gt;
| tunnel_overlay&amp;lt;ref name=tunnel_overlay&amp;gt;Above &#039;all or none&#039; sprites must be supplied, if these sprites are to be used.&amp;lt;/ref&amp;gt;&lt;br /&gt;
| 4&lt;br /&gt;
| If this callback is defined, tunnels for this roadtype will be drawn differently. First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this type (tunnel_overlay). The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
* &amp;lt;code style:darkgreen&amp;gt;getbits(extra_callback_info1, 0, 8)&amp;lt;/code&amp;gt;: 0 for normal tunnels, without any extra features (like tracks above). All other values are reserved for future extensions.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| roadstops&lt;br /&gt;
| 4&lt;br /&gt;
| Overlays for drive-in road stops&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
Note that there is no &amp;quot;default graphics&amp;quot; callback.&lt;br /&gt;
&lt;br /&gt;
===Example sprites===&lt;br /&gt;
==== gui ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_gui.png]]&lt;br /&gt;
&lt;br /&gt;
==== underlay ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_underlay.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_front ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_front.png]]&lt;br /&gt;
&lt;br /&gt;
==== catenary_back ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_catenary_back.png]]&lt;br /&gt;
&lt;br /&gt;
==== depots ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_depot.png]]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&lt;br /&gt;
|-&lt;br /&gt;
!Sprite Number&lt;br /&gt;
!Usage&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NE wall for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;NW wall for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for SW-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NE-entry depot.&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;Depot building for NW-entry depot.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== bridge_surfaces ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_bridge.png]]&lt;br /&gt;
&lt;br /&gt;
==== roadstops ====&lt;br /&gt;
&lt;br /&gt;
[[File:Nrt_drivein.png]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
==== tunnel_overlay ====&lt;br /&gt;
&lt;br /&gt;
If this callback is defined, tunnels for this roadtype will be drawn differently.&lt;br /&gt;
&lt;br /&gt;
First, a grass underlay base sprite is drawn, then the &#039;tunnels&#039;-sprite. Next, road vehicle sprites if applicable and then a grass overlay and finally the sprite from this callback. The grass sprites are defined in the base set and do not contain any parts of the tracks or portal, so these have to be fully provided by the roadtype sprites.&lt;br /&gt;
&lt;br /&gt;
Illustration: [[File:RoadtypeTunnelExample.png]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example code===&lt;br /&gt;
&lt;br /&gt;
A typical implementation for roadtypes can look like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color:blue&amp;quot;&amp;gt;&lt;br /&gt;
 item(FEAT_ROADTYPES, highway, 0x01) {&lt;br /&gt;
     property {&lt;br /&gt;
         label:                      &amp;quot;HWY_&amp;quot;;&lt;br /&gt;
         name:                       string(STR_HWY);&lt;br /&gt;
         menu_text:                  string(STR_HWY);&lt;br /&gt;
         build_window_caption:       string(STR_BUILD_CAPTION);&lt;br /&gt;
         autoreplace_text:           string(STR_AUTOREPLACE);&lt;br /&gt;
         new_engine_text:            string(STR_NEW_ENGINE);&lt;br /&gt;
         powered_roadtype_list:      [&amp;quot;HWY_&amp;quot;,&amp;quot;ROAD&amp;quot;];                          // Highways are compatible with other roads&lt;br /&gt;
         roadtype_flags:             bitmask(ROADTYPE_FLAG_NO_LEVEL_CROSSING, ROADTYPE_FLAG_NO_HOUSES); // Highways should not have level crossings or houses&lt;br /&gt;
         construction_cost:          32;                                       // Highways are expensive&lt;br /&gt;
         speed_limit:                100 km/h;&lt;br /&gt;
     }&lt;br /&gt;
     graphics {&lt;br /&gt;
         underlay:        ground_switch_underlay;    // defines the usual roads&lt;br /&gt;
         tunnels:         tunnel_switch;             // defines the roads drawn on a tunnel tile&lt;br /&gt;
         depots:          depot_switch;              // defines the depot sprites&lt;br /&gt;
         bridge_surfaces: bridge_terrain_switch;     // defines the overlay drawn over bridges depending on climate&lt;br /&gt;
         roadstops:       roadstops_switch;          // defines the look of roadstop pavement&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The switches and graphics blocks are defined in the usual way as described in sections [[NML:Switch|switches]], [[NML:Random switch|random switches]] and [[NML:Graphics|graphics block]] sections.&lt;/div&gt;</summary>
		<author><name>Andrew350</name></author>
	</entry>
</feed>