Difference between revisions of "Action0/Global Settings"

From GRFSpecs
Jump to navigationJump to search
(add property 16/17 to summary table)
 
(20 intermediate revisions by 9 users not shown)
Line 1: Line 1:
  +
== Introduction ==
   
'''''Action 0 properties for general variables'''''
 
   
=Action 0 - Properties for general variables=
 
   
  +
Global variables can be set in one of two ways. (This) action 0 using feature 8, or [[ActionD|Action D]]. Variables in arrays will usually be set using an action 0, whereas action D will most commonly set single variables.
{maketoc}
 
 
Global variables can be set in one of two ways.  (This) action 0 using feature 8, or [[ActionD|Action D]].  Variables in arrays will usually be set using an action 0, whereas action D will most commonly set single variables.
 
   
 
In addition to global variables, this action can also set some general grf-specific variables.
 
In addition to global variables, this action can also set some general grf-specific variables.
   
-=Properties=-
+
== Properties ==
   
  +
{| |-
||Number|Version|Size|Description
 
  +
!Number!![[GRFActionsDetailed|Size]]!!Version!!Description
  +
|-
  +
|08||B||{{ottdp|0.6|2.5|ttdprev=alpha 40}}||Cost base multipliers
  +
|-
  +
|09||D||{{ottdp|0.6|2.5|ttdprev=alpha 66}}||Cargo translation table
  +
|-
  +
|0A||W||{{ottdp|0.6|2.5|ttdprev=alpha 69}}||Currency display names
  +
|-
  +
|0B||D||{{ottdp|0.6|2.5|ttdprev=alpha 69}}||Currency multipliers
  +
|-
  +
|0C||W||{{ottdp|0.6|2.5|ttdprev=alpha 69}}||Currency options
  +
|-
  +
|0D,0E||D||{{ottdp|0.6|2.5|ttdprev=alpha 69}}||Currency symbols
  +
|-
  +
|0F||W||{{ottdp|0.6|2.5|ttdprev=alpha 69}}||Euro introduction dates
  +
|-
  +
|10||12*32*B||{{ottdp|0.6|2.5|ttdprev=alpha 74}}||Snow line height table
  +
|-
  +
|11||2*D||{{ottdp|0.7|no|ottdrev=r12924}}||GRFID overrides for engines
  +
|-
  +
|12||D||{{ottdp|0.7|no|ottdrev=r15417}}||Railtype translation table
  +
|-
  +
|13,14||V||{{ottdp|1.1|no|ottdrev=r21208}} {{grfFrom|7}}||Gender/case translation table
  +
|-
  +
|15||B||{{ottdp|1.1|no|ottdrev=r21216}} {{grfFrom|7}}||Plural form
  +
|-
  +
|16,17||D||{{ottdp|1.10|no}}||Road-/tramtype translation table
  +
|}
   
  +
== Descriptions ==
08|2.0.1 alpha 40|B|Cost base multipliers
 
   
  +
=== Cost base multipliers (08) ===
09|2.0.1 alpha 66|D|Cargo translation table
 
   
  +
TTD has 49 [[BaseCosts|base costs]] (66 in OpenTTD currently) which govern how much everything costs. Each cost is calculated from a (fixed) factor times the base cost, which is adjusted by inflation every month.
0A|2.0.1 alpha 69|W|Currency display names
 
   
  +
Setting this property allows changing these base costs by factors of two. The default value of the property is 08 which leaves the base cost unchanged. Adding one to the property doubles the base cost, subtracting one halves it.
0B|2.0.1 alpha 69|D|Currency multipliers
 
   
  +
Using math: NewBaseCost = OldBaseCost * 2^(n-8), where n is the value of property 08.
0C|2.0.1 alpha 69|W|Currency options
 
   
  +
Modifying the base costs incurs a small rounding error every time the game is saved, because the costs have to be set back to the default in the savegame. However, this error is unnoticable until many years of inflation have passed and should therefore be of little concern.
0D,0E|2.0.1 alpha 69|D|Currency symbols
 
   
  +
{{ottdp|1.0|no}} In OpenTTD rounding happens towards 1 or -1 depending on the old base cost; i.e. if the old base cost is positive round towards 1, if negative round towards -1. This prevents the base cost to be zero.
0F|2.0.1 alpha 69|W|Euro introduction dates
 
   
  +
=== Cargo translation table (09) ===
10|2.0.1 alpha 74|12*32*B|Snow line height table
 
 
11|OpenTTD (r12924)|2*D|GRF ID overrides for engines
 
 
12|OpenTTD (r15417)|D|Rail type translation table
 
 
13,14|OpenTTD (r21208)|V|Gender/case translation table||
 
 
-=Comments=-
 
 
==Cost base multipliers (08)==
 
 
TTD has 49 [[BaseCosts|base costs]] (66 in OTTD currently) which govern how much everything costs.  Each cost is calculated from a (fixed) factor times the base cost, which is adjusted by inflation every month.
 
 
Setting this property allows changing these base costs by factors of two.  The default value of the property is 08 which leaves the base cost unchanged. Adding one to the property doubles the base cost, subtracting one halves it.
 
 
Using math: ))NewBaseCost[[]]NewBaseCost[[ = ))OldBaseCost[[]]OldBaseCost[[ * 2<nowiki><nowiki><pre></nowiki></nowiki>(n-8), where n is the value of property 08.
 
 
Modifying the base costs incurs a small rounding error every time the game is saved, because the costs have to be set back to the default in the savegame. &nbsp;However, this error is unnoticable until many years of inflation have passed and should therefore be of little concern.
 
 
Note: in OpenTTD rounding happens towards 1 or -1 depending on the old base cost; i.e. if the old base cost is positive round towards 1, if negative round towards -1. This prevents the base cost to be zero.
 
 
==Cargo translation table (09)==
 
   
 
To aid with coding vehicle grf files that wish to support more than the standard cargo types, the easiest way is to install a cargo translation table using this property.
 
To aid with coding vehicle grf files that wish to support more than the standard cargo types, the easiest way is to install a cargo translation table using this property.
   
The cargo translation table is a list of [[Action0Cargos#Cargo_label_17_|cargo labels]]. Each entry means that the corresponding cargo is meant when using this ID in an [[Action3|action 3]] or for a bit in the vehicle's refit mask.
+
The cargo translation table is a list of [[Action0Cargos#Cargo label 17|cargo labels]]. Each entry means that the corresponding cargo is meant when using this ID in an [[Action3|action 3]] or for a bit in the vehicle's refit mask.
   
In other words, if for example the fourth entry (number 03) in the list is &quot;MAIL&quot;, then defining graphics for cargo 03 will define graphics for mail, and bit 3 in the refit mask will be for mail as well.
+
In other words, if for example the fourth entry (number 03) in the list is "MAIL", then defining graphics for cargo 03 will define graphics for mail, and bit 3 in the refit mask will be for mail as well.
   
 
This way, the vehicle grf file doesn't need to know or care which cargo slot and cargo bit a certain cargo type uses, it can define its own ID for each cargo that it wishes to support, and thus be independent of both what cargo types are really available in the game and what slots/bits they use.
 
This way, the vehicle grf file doesn't need to know or care which cargo slot and cargo bit a certain cargo type uses, it can define its own ID for each cargo that it wishes to support, and thus be independent of both what cargo types are really available in the game and what slots/bits they use.
Line 66: Line 69:
 
See below for an example.
 
See below for an example.
   
-=Example=-
+
==== Example ====
   
</pre>~pp~// Cargo translation table
+
// Cargo translation table
  +
1 * 169 00 08 01 29 00 09
  +
"COAL" "WATR" "RUBB" "MAIL" "OIL_" // 0-4
  +
"LVST" "GOOD" "CERE" "GRAN" "WHET" // 5-9
  +
"MAIZ" "WOOD" "WODT" "IORE" "CORE" // 10-14
  +
"STEL" "PLAS" "VALU" "GOLD" "DIAM" // 15-19
  +
"PAPR" "FOOD" "FRUT" "FISH" "WOOL" // 20-24
  +
"POTA" "SAND" "GLAS" "WDPR" "DYES" // 25-29
  +
"FERT" "OLSD" "RFPR" "VEHI" "PETR" // 30-34
  +
"BRCK" "SULP" "CMNT" "FICR" "LIME" // 35-39
  +
"MILK" // 40
  +
// Train wagon that has special graphics for grain (8),
  +
// wheat (9), maize (10) and cereals (7)
  +
2 * 29 03 00 01 1B 04
  +
08 <grain-cid> 09 <wheat-cid> 0A <maize-cid>
  +
07 <cereals-cid> <default-cid>
  +
// Train wagon that has graphics for water (1), rubber (2),
  +
// oil (4), petrol (34) and milk (40)
  +
3 * 31 03 00 01 1C 05
  +
01 <water-cid> 02 <rubber-cid> 04 <oil-cid>
  +
22 <petrol-cid> 28 <milk-cid> <default-cid>
   
&nbsp; &nbsp;1 * 169 &nbsp; &nbsp; &nbsp;00 08 01 29 00 09
 
   
  +
=== Currency display names (0A) ===
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;COAL&quot; &quot;WATR&quot; &quot;RUBB&quot; &quot;MAIL&quot; &quot;OIL_&quot; // 0-4
 
  +
This and the following properties can be used to modify currencies. Each of them can have IDs 0-18 (decimal), the IDs being ordered the same as in the Currency drop-down list.
   
  +
This property allows changing currency names that are displayed in the Currency drop-down in the Game Options window. This property is a textID, and if you need to supply your own text, it must be a DCxx one.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;LVST&quot; &quot;GOOD&quot; &quot;CERE&quot; &quot;GRAN&quot; &quot;WHET&quot; // 5-9
 
   
  +
=== Currency multipliers (0B) ===
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;MAIZ&quot; &quot;WOOD&quot; &quot;WODT&quot; &quot;IORE&quot; &quot;CORE&quot; // 10-14
 
   
  +
The equivalent of 1 British pound in this currency, multiplied by 1000. For example, 1 GBP=2 USD, so this should be 2000 for US dollars. The multiplication by 1000 allows you to have decimals in the multiplier without requiring floating-point calculations. This value is used for display purposes only, TTD always uses British pounds for internal calculations.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;STEL&quot; &quot;PLAS&quot; &quot;VALU&quot; &quot;GOLD&quot; &quot;DIAM&quot; // 15-19
 
   
  +
=== Currency options (0C) ===
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;PAPR&quot; &quot;FOOD&quot; &quot;FRUT&quot; &quot;FISH&quot; &quot;WOOL&quot; // 20-24
 
   
  +
The low byte of this word specifies the thousands separator to be used for this currency ( usually dot "." or comma ","). The high byte should be zero if the currency symbol should be in front of the number ($123,456) and should be 1 if the currency symbol should be shown after the number (123,456$). The symbol placement can be overridden by the TTDPatch settings.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;POTA&quot; &quot;SAND&quot; &quot;GLAS&quot; &quot;WDPR&quot; &quot;DYES&quot; // 25-29
 
   
  +
=== Currency symbols (0D,0E) ===
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;FERT&quot; &quot;OLSD&quot; &quot;RFPR&quot; &quot;VEHI&quot; &quot;PETR&quot; // 30-34
 
   
  +
These doublewords are interpreted as a string of up to 4 characters. If you need fewer characters, the remaining bytes should be zero. Property 0D is printed before the number, property 0E is printed after the number. These two usually differ only if the symbol is separated by a space from the number (for example, "$ " vs. " $"). You should specify both properties since the player can override your preferred symbol placement.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;BRCK&quot; &quot;SULP&quot; &quot;CMNT&quot; &quot;FICR&quot; &quot;LIME&quot; // 35-39
 
   
  +
=== Euro introduction dates (0F) ===
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot;MILK&quot; // 40
 
   
  +
This value allows you to have Euro introduced instead the currency at a given time. If this value is zero, the currency is never substituted with the Euro (USD, for example). If it's nonzero, it gives the year when the currency is replaced by Euro (for example, 2002 for DM).
// Train wagon that has special graphics for grain (8),
 
   
  +
=== Snow line height table (10) ===
// wheat (9), maize (10) and cereals (7)
 
   
  +
This property allows you to specify the snow line height for every day of the year. The only ID you can set is 0, and the value must be 12*32=384 bytes long. To simplify things for the patch, every month has 32 entries, and the impossible combinations (like 32th January or 31th April) will never be read.
&nbsp; &nbsp;2 * 29 &nbsp; &nbsp; &nbsp; 03 00 01 1B 04
 
   
  +
{{grfTill|7}} For GRF version 7 and below: The values should be multiple of 8 between 10h and 88h.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;08 &lt;grain-cid&gt; 09 &lt;wheat-cid&gt; 0A &lt;maize-cid&gt;
 
  +
Values below 10h and above EFh may result in overflow and should not be used. Since the highest possible land is 78h high, giving 88h or above will effectively disable the snow line.
   
  +
{{grfFrom|8}} For GRF version 8 and above: The values can be any value between 0 and FFh.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;07 &lt;cereals-cid&gt; &lt;default-cid&gt;
 
  +
FF means 'no snow'; other values are scaled to the number of possible heightlevels of the map.
   
  +
{{ottdp|no|2.5}} If the temperate snow line is enabled, this table applies on temperate as well.
// Train wagon that has graphics for water (1), rubber (2),
 
   
  +
'''WARNING:''' Some code in TTD assumes that the snow line will remain constant: Some industries are built only above/below snowline and assume that the snow line won't move when they're already built. Similarly, snowy houses on arctic will still appear snowy even when the snow disappears around them. If you want to use this feature, make sure to counter these effects by overriding arctic houses and industries with snow-aware versions.
// oil (4), petrol (34) and milk (40)
 
   
  +
=== GRFID overrides for engines (11) ===
&nbsp; &nbsp;3 * 31 &nbsp; &nbsp; &nbsp; 03 00 01 1C 05
 
   
  +
Allows you to provide a list of 'source' and 'target' GRFIDs to let vehicles in the source GRF override those in the target GRF, when dynamic engines is enabled. Each entry is 8 bytes, containing two GRFIDs. Multiple entries can be used, and different GRFs can be set to override the same 'target' GRF, but only the last instance of a 'source' GRF is active. GRFIDs that are not present will have no effect.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;01 &lt;water-cid&gt; 02 &lt;rubber-cid&gt; 04 &lt;oil-cid&gt;
 
   
  +
The scope of this feature is quite limited and it should be used only for sets that modify data of another set, for example the DBSetXL ECS addon for DBSetXL, or the censored version of LV4.
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;22 &lt;petrol-cid&gt; 28 &lt;milk-cid&gt; &lt;default-cid&gt;
 
   
  +
=== Railtype translation table (12) ===
~/pp~<pre>
 
   
  +
Provides ability to specify railtypes via a translation table, similar to using a cargo translation table. Each railtype label is a DWord. The default labels are RAIL, ELRL, MONO and MGLV. If a table is installed, then changing engine traction type will not affect the railtype.
'''The following properties can be used to modify currencies. Each of them can have IDs 0-18 (decimal), the IDs being ordered the same as in the Currency drop-down list.'''
 
   
  +
Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label "RAIL" can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.
==Currency display names (0A)==
 
   
  +
=== Gender/case translation table (13,14) ===
This property allows changing currency names that are displayed in the Currency drop-down in the Game Options window. This property is a textID, and if you need to supply your own text, it must be a DCxx one.
 
   
  +
Provides ability to specify genders or cases via a translation table. These map NewGRF internal IDs for the genders or cases to the genders or cases as defined in OpenTTD's language files so NewGRF strings and OpenTTD strings can interact on eachother's gender or cases. Property 13 is for mapping genders whereas property 14 is for mapping cases.
==Currency multipliers (0B)==
 
   
  +
The ID used for these translation tables is the Action 4 (GRF version 7 or higher) language-id, i.e. this mapping only works with GRF version 7 or higher. Language-id 7F (any) is not allowed. You can can define an ID multiple times in which case the new mappings are simply appended to the already known mappings.
The equivalent of 1 British pound in this currency, multiplied by 1000. For example, 1 GBP=2 USD, so this should be 2000 for US dollars. The multiplication by 1000 allows you to have decimals in the multiplier without requiring floating-point calculations. This value is used for display purposes only, TTD always uses British pounds for internal calculations.
 
   
  +
The format is simply a 00 terminated list of mappings:
==Currency options (0C)==
 
   
  +
(<id> <name>)+ 00
The low byte of this word specifies the thousands separator to be used for this currency ( usually dot &quot;.&quot; or comma &quot;,&quot;). The high byte should be zero if the currency symbol should be in front of the number ($123,456) and should be 1 if the currency symbol should be shown after the number (123,456$). The symbol placement can be overridden by the TTDPatch settings.
 
   
  +
{| |-
==Currency symbols (0D,0E)==
 
  +
!Size!!Name!!Meaning
  +
|-
  +
|B||id||NewGRF internal ID for the gender or case name, may not be 00
  +
|-
  +
|V||name||A 00 terminated string with the gender or case name as in OpenTTD's translation
  +
|}
   
  +
An NewGRF internal ID may be mapped multiple times for the same language as may an OpenTTD gender or case name be (reverse) mapped multiple times. This can be used for coping with OpenTTD translators adding or removing genders or cases over time. The NewGRF internal ID may not be 00 as this ID will be used in the Action 4 strings which may not contain 00 except for terminating the string.
These doublewords are interpreted as a string of up to 4 characters. If you need fewer characters, the remaining bytes should be zero. Property 0D is printed before the number, property 0E is printed after the number. These two usually differ only if the symbol is separated by a space from the number (for example, &quot;$ &quot; vs. &quot; $&quot;). You should specify both properties since the player can override your preferred symbol placement.
 
   
  +
These mappings are used for [[StringCodes]] 9A 0E, 9A 0F, 9A 13 and 9A 14. How the mapping is used precisely can be found there.
==Euro introduction dates (0F)==
 
   
  +
=== Plural form (15) ===
This value allows you to have Euro introduced instead the currency at a given time. If this value is zero, the currency is never substituted with the Euro (USD, for example). If it's nonzero, it gives the year when the currency is replaced by Euro (for example, 2002 for DM).
 
   
  +
Defines the plural form for a language. The ID used is the Action 4 (GRF version 7 or higher) language-id, i.e. this only works with GRF version 7 or higher. Language-id 7F (any) is not allowed. More information about the different valid plural forms can be found on the [[StringCodes]] page. This property is used for [[StringCodes|StringCode]] 9A 15.
==Snow line height table (10)==
 
   
  +
=== Roadtype translation table (16) ===
This property allows you to specify the snow line height for every day of the year. The only ID you can set is 0, and the value must be 12*32=384 bytes long. To simplify things for the patch, every month has 32 entries, and the impossible combinations (like 32th January or 31th April) will never be read. The entries should be a multiply of 8 or else some visual glitches may appear. Values below 10h and above EFh may result in overflow and should not be used. Since the highest possible land is 78h high, giving 88h or above will effectively disable the snow line.
 
   
  +
Provides ability to specify roadtypes via a translation table, similar to using a cargo translation table. Each roadtype label is a DWord. The default labels are ROAD and ELRD.
If the temperate snow line is enabled, this table applies on temperate as well.
 
   
  +
Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label "RAIL" can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.
'''WARNING:''' Some code in TTD assumes that the snow line will remain constant: Some industries are built only above/below snowline and assume that the snow line won't move when they're already built. Similarly, snowy houses on arctic will still appear snowy even when the snow disappears around them. If you want to use this feature, make sure to counter these effects by overriding arctic houses and industries with snow-aware versions.
 
   
==GRF ID overrides for engines (11)==
+
=== Tramtype translation table (17) ===
   
  +
Provides ability to specify tramtypes via a translation table, similar to using a cargo translation table. Each tramtype label is a DWord. The default labels are RAIL and ELRL.
(OpenTTD only) Allows you to provide a list of 'source' and 'target' GRF IDs to let engines in the source GRF override those in the target GRF, when dynamic engines is enabled. Each entry is 8 bytes, containing two GRF IDs. Multiple entries can be used, and different GRFs can be set to override the same 'target' GRF, but only the last instance of a 'source' GRF is active. GRF IDs that are not present will have no effect.
 
   
  +
Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label "RAIL" can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.
The scope of this feature is quite limited and it should be used only for sets that modify data of another set, for example the DBSetXL ECS addon for DBSetXL, or the censored version of LV4.
 
 
==Rail type translation table (12)==
 
 
(OpenTTD only) Provides ability to specify rail types via a translation table, similar to using a cargo translation table. Each rail type label is a DWord. The default labels are RAIL, ELRL, MONO and MGLV. If a table is installed, then changing engine traction type will not affect the rail type.
 
 
==Gender/case translation table (13,14)==
 
 
(OpenTTD only) Provides ability to specify genders or cases via a translation table. These map NewGRF internal IDs for the genders or cases to the genders or cases as defined in OpenTTD's language files so NewGRF strings and OpenTTD strings can interact on eachother's gender or cases. Property 13 is for mapping genders whereas property 14 is for mapping cases.
 
 
The ID used for these translation tables is the Action 4 (GRF version 7 or higher) language-id, i.e. this mapping only works with GRF version 7 or higher. Language-id 7F (any) is not allowed. You can can define an ID multiple times in which case the new mappings are simply appended to the already known mappings.
 
 
The format is simply a 00 terminated list of mappings:
 
 
</pre>-+(&lt;id&gt; &lt;name&gt;)+ 00+-<pre>
 
 
||Size|Name|Meaning
 
 
B|id|NewGRF internal ID for the gender or case name, may not be 00
 
 
V|name|A 00 terminated string with the gender or case name as in OpenTTD's translation||
 
 
An NewGRF internal ID may be mapped multiple times for the same language as may an OpenTTD gender or case name be (reverse) mapped multiple times. This can be used for coping with OpenTTD translators adding or removing genders or cases over time. The NewGRF internal ID may not be 00 as this ID will be used in the Action 4 strings which may not contain 00 except for terminating the string.
 
 
These mappings are used for [[StringCodes]] 9A 0E, 9A 0F, 9A 13 and 9A 14. How the mapping is used precisely can be found there.
 

Latest revision as of 19:00, 20 February 2020

Introduction

Global variables can be set in one of two ways. (This) action 0 using feature 8, or Action D. Variables in arrays will usually be set using an action 0, whereas action D will most commonly set single variables.

In addition to global variables, this action can also set some general grf-specific variables.

Properties

Number Size Version Description
08 B Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (alpha 40)2.5 Cost base multipliers
09 D Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (alpha 66)2.5 Cargo translation table
0A W Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (alpha 69)2.5 Currency display names
0B D Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (alpha 69)2.5 Currency multipliers
0C W Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (alpha 69)2.5 Currency options
0D,0E D Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (alpha 69)2.5 Currency symbols
0F W Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (alpha 69)2.5 Euro introduction dates
10 12*32*B Supported by OpenTTD 0.60.6 Supported by TTDPatch 2.5 (alpha 74)2.5 Snow line height table
11 2*D Supported by OpenTTD 0.7 (r12924)0.7 Not supported by TTDPatch GRFID overrides for engines
12 D Supported by OpenTTD 0.7 (r15417)0.7 Not supported by TTDPatch Railtype translation table
13,14 V Supported by OpenTTD 1.1 (r21208)1.1 Not supported by TTDPatch GRFv≥7 Gender/case translation table
15 B Supported by OpenTTD 1.1 (r21216)1.1 Not supported by TTDPatch GRFv≥7 Plural form
16,17 D Supported by OpenTTD 1.101.10 Not supported by TTDPatch Road-/tramtype translation table

Descriptions

Cost base multipliers (08)

TTD has 49 base costs (66 in OpenTTD currently) which govern how much everything costs. Each cost is calculated from a (fixed) factor times the base cost, which is adjusted by inflation every month.

Setting this property allows changing these base costs by factors of two. The default value of the property is 08 which leaves the base cost unchanged. Adding one to the property doubles the base cost, subtracting one halves it.

Using math: NewBaseCost = OldBaseCost * 2^(n-8), where n is the value of property 08.

Modifying the base costs incurs a small rounding error every time the game is saved, because the costs have to be set back to the default in the savegame. However, this error is unnoticable until many years of inflation have passed and should therefore be of little concern.

Supported by OpenTTD 1.01.0 Not supported by TTDPatch In OpenTTD rounding happens towards 1 or -1 depending on the old base cost; i.e. if the old base cost is positive round towards 1, if negative round towards -1. This prevents the base cost to be zero.

Cargo translation table (09)

To aid with coding vehicle grf files that wish to support more than the standard cargo types, the easiest way is to install a cargo translation table using this property.

The cargo translation table is a list of cargo labels. Each entry means that the corresponding cargo is meant when using this ID in an action 3 or for a bit in the vehicle's refit mask.

In other words, if for example the fourth entry (number 03) in the list is "MAIL", then defining graphics for cargo 03 will define graphics for mail, and bit 3 in the refit mask will be for mail as well.

This way, the vehicle grf file doesn't need to know or care which cargo slot and cargo bit a certain cargo type uses, it can define its own ID for each cargo that it wishes to support, and thus be independent of both what cargo types are really available in the game and what slots/bits they use.

Because the refit mask contains only 32 bits, only the first 32 entries in the translation table can make use of the refit mask. Other cargo types have to be added via the cargo classes, so put the cargos that need exceptions to the cargo class based refitting first so that they can go in the refit mask.

Note that this property cannot be set incrementally, you must set all types in a single action 0 starting from ID 0.

See below for an example.

Example

// Cargo translation table
  1 * 169      00 08 01 29 00 09
          "COAL" "WATR" "RUBB" "MAIL" "OIL_" // 0-4
          "LVST" "GOOD" "CERE" "GRAN" "WHET" // 5-9
          "MAIZ" "WOOD" "WODT" "IORE" "CORE" // 10-14
          "STEL" "PLAS" "VALU" "GOLD" "DIAM" // 15-19
          "PAPR" "FOOD" "FRUT" "FISH" "WOOL" // 20-24
          "POTA" "SAND" "GLAS" "WDPR" "DYES" // 25-29
          "FERT" "OLSD" "RFPR" "VEHI" "PETR" // 30-34
          "BRCK" "SULP" "CMNT" "FICR" "LIME" // 35-39
          "MILK" // 40
// Train wagon that has special graphics for grain (8),
// wheat (9), maize (10) and cereals (7)
  2 * 29       03 00 01 1B 04
          08 <grain-cid> 09 <wheat-cid> 0A <maize-cid>
          07 <cereals-cid> <default-cid>
// Train wagon that has graphics for water (1), rubber (2),
// oil (4), petrol (34) and milk (40)
  3 * 31       03 00 01 1C 05
          01 <water-cid> 02 <rubber-cid> 04 <oil-cid>
          22 <petrol-cid> 28 <milk-cid> <default-cid>


Currency display names (0A)

This and the following properties can be used to modify currencies. Each of them can have IDs 0-18 (decimal), the IDs being ordered the same as in the Currency drop-down list.

This property allows changing currency names that are displayed in the Currency drop-down in the Game Options window. This property is a textID, and if you need to supply your own text, it must be a DCxx one.

Currency multipliers (0B)

The equivalent of 1 British pound in this currency, multiplied by 1000. For example, 1 GBP=2 USD, so this should be 2000 for US dollars. The multiplication by 1000 allows you to have decimals in the multiplier without requiring floating-point calculations. This value is used for display purposes only, TTD always uses British pounds for internal calculations.

Currency options (0C)

The low byte of this word specifies the thousands separator to be used for this currency ( usually dot "." or comma ","). The high byte should be zero if the currency symbol should be in front of the number ($123,456) and should be 1 if the currency symbol should be shown after the number (123,456$). The symbol placement can be overridden by the TTDPatch settings.

Currency symbols (0D,0E)

These doublewords are interpreted as a string of up to 4 characters. If you need fewer characters, the remaining bytes should be zero. Property 0D is printed before the number, property 0E is printed after the number. These two usually differ only if the symbol is separated by a space from the number (for example, "$ " vs. " $"). You should specify both properties since the player can override your preferred symbol placement.

Euro introduction dates (0F)

This value allows you to have Euro introduced instead the currency at a given time. If this value is zero, the currency is never substituted with the Euro (USD, for example). If it's nonzero, it gives the year when the currency is replaced by Euro (for example, 2002 for DM).

Snow line height table (10)

This property allows you to specify the snow line height for every day of the year. The only ID you can set is 0, and the value must be 12*32=384 bytes long. To simplify things for the patch, every month has 32 entries, and the impossible combinations (like 32th January or 31th April) will never be read.

GRFv≤7 For GRF version 7 and below: The values should be multiple of 8 between 10h and 88h. Values below 10h and above EFh may result in overflow and should not be used. Since the highest possible land is 78h high, giving 88h or above will effectively disable the snow line.

GRFv≥8 For GRF version 8 and above: The values can be any value between 0 and FFh. FF means 'no snow'; other values are scaled to the number of possible heightlevels of the map.

Not supported by OpenTTD Supported by TTDPatch 2.52.5 If the temperate snow line is enabled, this table applies on temperate as well.

WARNING: Some code in TTD assumes that the snow line will remain constant: Some industries are built only above/below snowline and assume that the snow line won't move when they're already built. Similarly, snowy houses on arctic will still appear snowy even when the snow disappears around them. If you want to use this feature, make sure to counter these effects by overriding arctic houses and industries with snow-aware versions.

GRFID overrides for engines (11)

Allows you to provide a list of 'source' and 'target' GRFIDs to let vehicles in the source GRF override those in the target GRF, when dynamic engines is enabled. Each entry is 8 bytes, containing two GRFIDs. Multiple entries can be used, and different GRFs can be set to override the same 'target' GRF, but only the last instance of a 'source' GRF is active. GRFIDs that are not present will have no effect.

The scope of this feature is quite limited and it should be used only for sets that modify data of another set, for example the DBSetXL ECS addon for DBSetXL, or the censored version of LV4.

Railtype translation table (12)

Provides ability to specify railtypes via a translation table, similar to using a cargo translation table. Each railtype label is a DWord. The default labels are RAIL, ELRL, MONO and MGLV. If a table is installed, then changing engine traction type will not affect the railtype.

Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label "RAIL" can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.

Gender/case translation table (13,14)

Provides ability to specify genders or cases via a translation table. These map NewGRF internal IDs for the genders or cases to the genders or cases as defined in OpenTTD's language files so NewGRF strings and OpenTTD strings can interact on eachother's gender or cases. Property 13 is for mapping genders whereas property 14 is for mapping cases.

The ID used for these translation tables is the Action 4 (GRF version 7 or higher) language-id, i.e. this mapping only works with GRF version 7 or higher. Language-id 7F (any) is not allowed. You can can define an ID multiple times in which case the new mappings are simply appended to the already known mappings.

The format is simply a 00 terminated list of mappings:

(<id> <name>)+ 00
Size Name Meaning
B id NewGRF internal ID for the gender or case name, may not be 00
V name A 00 terminated string with the gender or case name as in OpenTTD's translation

An NewGRF internal ID may be mapped multiple times for the same language as may an OpenTTD gender or case name be (reverse) mapped multiple times. This can be used for coping with OpenTTD translators adding or removing genders or cases over time. The NewGRF internal ID may not be 00 as this ID will be used in the Action 4 strings which may not contain 00 except for terminating the string.

These mappings are used for StringCodes 9A 0E, 9A 0F, 9A 13 and 9A 14. How the mapping is used precisely can be found there.

Plural form (15)

Defines the plural form for a language. The ID used is the Action 4 (GRF version 7 or higher) language-id, i.e. this only works with GRF version 7 or higher. Language-id 7F (any) is not allowed. More information about the different valid plural forms can be found on the StringCodes page. This property is used for StringCode 9A 15.

Roadtype translation table (16)

Provides ability to specify roadtypes via a translation table, similar to using a cargo translation table. Each roadtype label is a DWord. The default labels are ROAD and ELRD.

Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label "RAIL" can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.

Tramtype translation table (17)

Provides ability to specify tramtypes via a translation table, similar to using a cargo translation table. Each tramtype label is a DWord. The default labels are RAIL and ELRL.

Note that labels are not shared between features, so the same label can be used for multiple items. For example, the label "RAIL" can be used for a railtype, roadtype, tramtype, and cargotype simultaneously without conflict.