Configuration file

From TTWiki
(Redirected from ConfigurationFile)
Jump to navigationJump to search

The configuration file tells TTDPatch which of the patches you want to be enabled, and how. It is simply a list of the patches, followed by what you want it to do with this switch.

If no configuration file is specified at the command line, that is, if there is no -C option, TTDPatch will read the default ttdpatch.cfg. You can specify several configuration files, and they will be read in the order you give them, but if you want TTDPatch to read ttdpatch.cfg and your file, you have to specify both.

To change the configuration, simply open the file in any text editor, like Notepad under Windows or Edit under DOS.

The syntax of the configuration file is simple: all lines starting with a letter define the value of an option, all others are ignored. The line defining the option should have one of the following formats:

servint 16000
servint = 16000

You can add more spaces, or in the second case take them out.

There are three kinds of switches: on/off switches, switches with a value, and switches with bit settings.

On/off switches
For on/off switches (for example trainrefit), you can set them to any of on, yes, y, 1 to turn them on, or off, no, n, 0 to turn them off.
Switches with values
Switches with values, for example servint, can be set to a value within the allowable range, or any of the above on/off values. If a switch should have a value but doesn't, the value is set to the default for that switch; if the given value is out of range, it is set to the nearest allowable value. You can turn a switch off by setting it to any of off, no, n, but not 0 (unless 0 is not in the range for this particular switch). For example, servint on sets the new service interval to the default value of 16000 days, servint 240 sets it to 240 days, and servint off turns the servint feature off.
Finally, switches with bit settings allow you to choose various settings of that switch. Please see the BitSwitches page for a description of how these work.

You can also have TTDPatch write a customised configuration file with the -W switch. This useful for example to create a configuration file in your language, if it is supported. To convert ttdpatch.cfg, simply run TTDPatch with

ttdpatch -W ttdpatch.cfg

Alternatively, put

writecfg ttdpatch.cfg

in your ttdpatch.cfg.

The result of this is that the configuration file will be in the selected language (see Language Selection), and you can read and edit it easily. It will also automatically add options that were missing or misspelt in the original file.

Since 1.8, the Windows version of TTDPatch converts all comments in the configuration file to the local Windows code page. If that code page does not support all characters used in the selected language, parts of the text may look wrong. To override this behavior, set the environment variable ACP ("ANSI Code Page") to the number of the code page you want. If you specify a code page that is not supported by the Windows installation you're using, no conversion will take place and thus comments will be written in the native DOS code page of the selected language.

For example, to rewrite ttdpatch.cfg as new.cfg in Russian using the Windows Cyryllic code page, run the following three commands in order, from the command line:

SET LANG=russian
SET ACP=1251
ttdpatchw -W new.cfg

(A simpler way to do it in Windows is to put these commands in a batch file and run it.)

The DOS version of TTDPatch does not perform any code page conversions.