NML:Setting base costs

From GRFSpecs
Revision as of 11:45, 21 August 2011 by FooBar (talk | contribs) (content of nml r1625)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

A number of base costs define how much everything costs in (O)TTD(P). Each cost in-game is determined by a fixed factor multiplied by a base cost. Setting base cost to 0 leaves this cost unchanged. Incrementing it by one doubles the cost, so e.g. a setting of 3 results in a cost that is 8x higher. Setting a negative value reduces the cost in the same manner, e.g. a value of -4 results in 1/16th of the cost. The minimum and maximum values are -8 (1/256th) and 16 (65536x), respectively. Some example code:

 basecost {
 	PR_BUILD_TUNNEL: 2;   // tunnel cost x4
 	PR_BUILD_BRIDGE: -3;  // bridge cost x1/8
 	PR_RUNNING: param[1]; // all running costs are set by the factor in grf parameter 1
 	param[2]: param[3];   // base cost with the number given by param 2 is set to the factor in param 3.
 }

This table lists all base costs that can be set. They can be referred to using either the number in the first or the identifier in the second column. Using an identifier from the third column, it is possible to set an entire category of base costs at once.

Note that all costs are subject to modification by the game difficulty settings. Inflation (if enabled) will increase all costs over time. Recent versions of OpenTTD have affected the behaviour of many base costs, refer to the notes below the cost table for more information.