Bit switches

From TTWiki
Jump to: navigation, search

Switches with bit settings allow you to choose various settings of that switch. An example is the `morebuildoptions' switch. It has the following options, labeled (a) to (f):

Bit Value Name Meaning
(a) 0 1 ctunnel Tunnels may cross
(b) 1 2 oilrefinery Oil rigs and refineries may be built everywhere, not only near edges of map
(c) 2 4 moreindustries Allow multiple industries of the same type in one city
(d) 3 8 removeobjects Removal of statues, lighthouses and transmitters
(e) 4 16 removeindustry Removal of industries
(f) 5 32 closeindustries Allow identical industries very close together
(g) 6 64 enhancedbuoys Build buoys that accept and distribute cargo (like docks) with Ctrl
(h) 7 128 bulldozesignals Automatically remove signals when removing track with the bulldozer tool

To find out how you specify the value for the `morebuildoptions' switch, you have two choices (three since alpha 38):

  • Use the "#101001" notation. Each number represents a bit, 1 meaning it is turned on, 0 meaning it is turned off. Note that it starts from the highest bit. For morebuildoptions, it would be "#fedcba" for the six options (f) down to (a). For example, to turn on (a), (d) and (e), you would use morebuildoptions #011001. The leading 0 is optional.
  • Add all the values you want, and use that for the option. For example, for having morebuildoptions bits (a), (d) and (e), you add their values: 1+8+16=25. Therefore, you would use morebuildoptions 25.
  • As of TTDPatch 2.0.1 alpha 38, you also have a third option; the bit names. These work like on/off switches except that 1 and 0 may not be used. on/yes/y and off/no/n are all acceptable. For example, to turn on morebuildoptions bits (a), (d), and (e), you would use
morebuildoptions.ctunnel on
morebuildoptions.removeobjects on
morebuildoptions.removeindustry on

Note, some switches may have so-called "reserved" bits. These are bits that are unused at the moment. It is best to not set them, and leave them at zero (off) instead.