OpenTTD Source: src/table/control_codes.h Source File

OpenTTD Source 15.3

control_codes.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
10#ifndef CONTROL_CODES_H
11#define CONTROL_CODES_H
12
17 enum StringControlCode : uint16_t {
18 SCC_RECORD_SEPARATOR = 0x1E,
19
20 SCC_CONTROL_START = 0xE000,
21 SCC_CONTROL_END = 0xE1FF,
22
23 SCC_SPRITE_START = 0xE200,
24 SCC_SPRITE_END = SCC_SPRITE_START + 0xFF,
25
26 /* All SCC_ENCODED* control codes must have stable ids are they are stored in strings that are saved in savegames. */
27 SCC_ENCODED = SCC_CONTROL_START,
28 SCC_ENCODED_INTERNAL,
29 SCC_ENCODED_NUMERIC,
30 SCC_ENCODED_STRING,
31
32 /* Font selection codes, must be in same order as FontSize enum */
33 SCC_FIRST_FONT,
34 SCC_NORMALFONT = SCC_FIRST_FONT,
35 SCC_TINYFONT,
36 SCC_BIGFONT,
37 SCC_MONOFONT,
38 SCC_LAST_FONT = SCC_MONOFONT,
39
40 /* Formatting control codes */
41 SCC_REVISION,
42 SCC_COMPANY_NUM,
43 SCC_STATION_FEATURES,
44 SCC_INDUSTRY_NAME,
45 SCC_WAYPOINT_NAME,
46 SCC_STATION_NAME,
47 SCC_DEPOT_NAME,
48 SCC_TOWN_NAME,
49 SCC_GROUP_NAME,
50 SCC_VEHICLE_NAME,
51 SCC_SIGN_NAME,
52 SCC_COMPANY_NAME,
53 SCC_PRESIDENT_NAME,
54 SCC_ENGINE_NAME,
55
56 SCC_CURRENCY_SHORT,
57 SCC_CURRENCY_LONG,
58
59 SCC_CARGO_LONG,
60 SCC_CARGO_SHORT,
61 SCC_CARGO_TINY,
62 SCC_CARGO_LIST,
63 SCC_POWER,
64 SCC_POWER_TO_WEIGHT,
65 SCC_VOLUME_LONG,
66 SCC_VOLUME_SHORT,
67 SCC_WEIGHT_LONG,
68 SCC_WEIGHT_SHORT,
69 SCC_FORCE,
70 SCC_VELOCITY,
71 SCC_HEIGHT,
72
73 SCC_UNITS_DAYS_OR_SECONDS,
74 SCC_UNITS_MONTHS_OR_MINUTES,
75 SCC_UNITS_YEARS_OR_PERIODS,
76 SCC_UNITS_YEARS_OR_MINUTES,
77
78 SCC_DATE_TINY,
79 SCC_DATE_SHORT,
80 SCC_DATE_LONG,
81 SCC_DATE_ISO,
82
83 /* Must be consecutive */
84 SCC_STRING1,
85 SCC_STRING2,
86 SCC_STRING3,
87 SCC_STRING4,
88 SCC_STRING5,
89 SCC_STRING6,
90 SCC_STRING7,
91
92
93 SCC_STRING,
94 SCC_COMMA,
95 SCC_DECIMAL,
96 SCC_NUM,
97 SCC_ZEROFILL_NUM,
98 SCC_HEX,
99 SCC_BYTES,
100
101 SCC_RAW_STRING_POINTER,
102 SCC_PLURAL_LIST,
103 SCC_GENDER_LIST,
104 SCC_GENDER_INDEX,
105 SCC_ARG_INDEX,
106 SCC_SET_CASE,
107 SCC_SWITCH_CASE,
108
109 /* Colour codes */
110 SCC_BLUE,
111 SCC_SILVER,
112 SCC_GOLD,
113 SCC_RED,
114 SCC_PURPLE,
115 SCC_LTBROWN,
116 SCC_ORANGE,
117 SCC_GREEN,
118 SCC_YELLOW,
119 SCC_DKGREEN,
120 SCC_CREAM,
121 SCC_BROWN,
122 SCC_WHITE,
123 SCC_LTBLUE,
124 SCC_GRAY,
125 SCC_DKBLUE,
126 SCC_BLACK,
127 SCC_COLOUR,
128 SCC_PUSH_COLOUR,
129 SCC_POP_COLOUR,
130
135 SCC_NEWGRF_FIRST,
136 SCC_NEWGRF_PRINT_DWORD_SIGNED = SCC_NEWGRF_FIRST,
137 SCC_NEWGRF_PRINT_WORD_SIGNED,
138 SCC_NEWGRF_PRINT_BYTE_SIGNED,
139 SCC_NEWGRF_PRINT_WORD_UNSIGNED,
140 SCC_NEWGRF_PRINT_DWORD_CURRENCY,
141 SCC_NEWGRF_PRINT_WORD_STRING_ID,
142 SCC_NEWGRF_PRINT_WORD_DATE_LONG,
143 SCC_NEWGRF_PRINT_WORD_DATE_SHORT,
144 SCC_NEWGRF_PRINT_WORD_SPEED,
145 SCC_NEWGRF_PRINT_WORD_VOLUME_LONG,
146 SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG,
147 SCC_NEWGRF_PRINT_WORD_STATION_NAME,
148 SCC_NEWGRF_PRINT_QWORD_CURRENCY,
149 SCC_NEWGRF_PRINT_BYTE_HEX,
150 SCC_NEWGRF_PRINT_WORD_HEX,
151 SCC_NEWGRF_PRINT_DWORD_HEX,
152 SCC_NEWGRF_PRINT_QWORD_HEX,
153 SCC_NEWGRF_PRINT_DWORD_DATE_LONG,
154 SCC_NEWGRF_PRINT_DWORD_DATE_SHORT,
155 SCC_NEWGRF_PRINT_WORD_POWER,
156 SCC_NEWGRF_PRINT_WORD_VOLUME_SHORT,
157 SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT,
158 SCC_NEWGRF_PRINT_WORD_CARGO_LONG,
159 SCC_NEWGRF_PRINT_WORD_CARGO_SHORT,
160 SCC_NEWGRF_PRINT_WORD_CARGO_TINY,
161 SCC_NEWGRF_PRINT_WORD_CARGO_NAME,
162 SCC_NEWGRF_PRINT_DWORD_FORCE,
163 SCC_NEWGRF_PUSH_WORD,
164 SCC_NEWGRF_DISCARD_WORD,
165 SCC_NEWGRF_ROTATE_TOP_4_WORDS,
166 SCC_NEWGRF_LAST = SCC_NEWGRF_ROTATE_TOP_4_WORDS,
167
168 SCC_NEWGRF_STRINL,
169
170 /* Special printable symbols.
171 * These are mapped to the original glyphs */
172 SCC_LESS_THAN = SCC_SPRITE_START + 0x3C,
173 SCC_GREATER_THAN = SCC_SPRITE_START + 0x3E,
174 SCC_TOWN = SCC_SPRITE_START + 0x9B,
175 SCC_CITY = SCC_SPRITE_START + 0x9C,
176 SCC_LEFT_ARROW = SCC_SPRITE_START + 0x9D,
177 SCC_UP_ARROW = SCC_SPRITE_START + 0xA0,
178 SCC_DOWN_ARROW = SCC_SPRITE_START + 0xAA,
179 SCC_CHECKMARK = SCC_SPRITE_START + 0xAC,
180 SCC_CROSS = SCC_SPRITE_START + 0xAD,
181 SCC_RIGHT_ARROW = SCC_SPRITE_START + 0xAF,
182 SCC_TRAIN = SCC_SPRITE_START + 0xB4,
183 SCC_LORRY = SCC_SPRITE_START + 0xB5,
184 SCC_BUS = SCC_SPRITE_START + 0xB6,
185 SCC_PLANE = SCC_SPRITE_START + 0xB7,
186 SCC_SHIP = SCC_SPRITE_START + 0xB8,
187 SCC_SUPERSCRIPT_M1 = SCC_SPRITE_START + 0xB9,
188 SCC_SMALL_UP_ARROW = SCC_SPRITE_START + 0xBC,
189 SCC_SMALL_DOWN_ARROW = SCC_SPRITE_START + 0xBD,
190};
191
192#endif /* CONTROL_CODES_H */
StringControlCode
StringControlCode
List of string control codes used for string formatting, displaying, and by strgen to generate the la...
Definition control_codes.h:17
SCC_NEWGRF_PRINT_WORD_VOLUME_SHORT
@ SCC_NEWGRF_PRINT_WORD_VOLUME_SHORT
9A 19: Read 2 bytes from the stack as short signed volume
Definition control_codes.h:156
SCC_NEWGRF_PRINT_DWORD_CURRENCY
@ SCC_NEWGRF_PRINT_DWORD_CURRENCY
8F: Read 4 bytes from the stack as currency
Definition control_codes.h:140
SCC_NEWGRF_PRINT_WORD_HEX
@ SCC_NEWGRF_PRINT_WORD_HEX
9A 07: Read 2 bytes from the stack and print it as hex
Definition control_codes.h:150
SCC_ENCODED
@ SCC_ENCODED
Encoded string marker and sub-string parameter.
Definition control_codes.h:27
SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT
@ SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT
9A 1A: Read 2 bytes from the stack as short unsigned weight
Definition control_codes.h:157
SCC_NEWGRF_ROTATE_TOP_4_WORDS
@ SCC_NEWGRF_ROTATE_TOP_4_WORDS
86: Rotate the top 4 words of the stack (W4 W1 W2 W3)
Definition control_codes.h:165
SCC_TINYFONT
@ SCC_TINYFONT
Switch to small font.
Definition control_codes.h:35
SCC_NEWGRF_PRINT_DWORD_DATE_LONG
@ SCC_NEWGRF_PRINT_DWORD_DATE_LONG
9A 16: Read 4 bytes from the stack as base 0 date
Definition control_codes.h:153
SCC_NORMALFONT
@ SCC_NORMALFONT
Switch to normal size font.
Definition control_codes.h:34
SCC_ENCODED_NUMERIC
@ SCC_ENCODED_NUMERIC
Encoded numeric parameter.
Definition control_codes.h:29
SCC_ENCODED_STRING
@ SCC_ENCODED_STRING
Encoded string parameter.
Definition control_codes.h:30
SCC_NEWGRF_PRINT_DWORD_HEX
@ SCC_NEWGRF_PRINT_DWORD_HEX
9A 08: Read 4 bytes from the stack and print it as hex
Definition control_codes.h:151
SCC_NEWGRF_PRINT_WORD_DATE_SHORT
@ SCC_NEWGRF_PRINT_WORD_DATE_SHORT
83: Read 2 bytes from the stack as base 1920 date
Definition control_codes.h:143
SCC_BIGFONT
@ SCC_BIGFONT
Switch to large font.
Definition control_codes.h:36
SCC_NEWGRF_PRINT_BYTE_HEX
@ SCC_NEWGRF_PRINT_BYTE_HEX
9A 06: Read 1 byte from the stack and print it as hex
Definition control_codes.h:149
SCC_NEWGRF_PRINT_WORD_UNSIGNED
@ SCC_NEWGRF_PRINT_WORD_UNSIGNED
7E: Read 2 bytes from the stack as unsigned value
Definition control_codes.h:139
SCC_NEWGRF_PRINT_BYTE_SIGNED
@ SCC_NEWGRF_PRINT_BYTE_SIGNED
7D: Read 1 byte from the stack as signed value
Definition control_codes.h:138
SCC_NEWGRF_PRINT_WORD_CARGO_NAME
@ SCC_NEWGRF_PRINT_WORD_CARGO_NAME
9A 1E: Read 2 bytes from the stack as cargo name
Definition control_codes.h:161
SCC_NEWGRF_PRINT_DWORD_SIGNED
@ SCC_NEWGRF_PRINT_DWORD_SIGNED
7B: Read 4 bytes from the stack
Definition control_codes.h:136
SCC_NEWGRF_STRINL
@ SCC_NEWGRF_STRINL
Inline another string at the current position, StringID is encoded in the string.
Definition control_codes.h:168
SCC_NEWGRF_PRINT_WORD_CARGO_SHORT
@ SCC_NEWGRF_PRINT_WORD_CARGO_SHORT
9A 1C: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
Definition control_codes.h:159
SCC_NEWGRF_PRINT_WORD_STATION_NAME
@ SCC_NEWGRF_PRINT_WORD_STATION_NAME
9A 0C: Read 2 bytes from the stack as station name
Definition control_codes.h:147
SCC_NEWGRF_PRINT_WORD_DATE_LONG
@ SCC_NEWGRF_PRINT_WORD_DATE_LONG
82: Read 2 bytes from the stack as base 1920 date
Definition control_codes.h:142
SCC_NEWGRF_FIRST
@ SCC_NEWGRF_FIRST
The next variables are part of a NewGRF subsystem for creating text strings.
Definition control_codes.h:135
SCC_NEWGRF_PRINT_WORD_SIGNED
@ SCC_NEWGRF_PRINT_WORD_SIGNED
7C: Read 2 bytes from the stack as signed value
Definition control_codes.h:137
SCC_MONOFONT
@ SCC_MONOFONT
Switch to monospaced font.
Definition control_codes.h:37
SCC_NEWGRF_PRINT_WORD_POWER
@ SCC_NEWGRF_PRINT_WORD_POWER
9A 18: Read 2 bytes from the stack as unsigned power
Definition control_codes.h:155
SCC_NEWGRF_PUSH_WORD
@ SCC_NEWGRF_PUSH_WORD
9A 03: Pushes 2 bytes onto the stack
Definition control_codes.h:163
SCC_NEWGRF_PRINT_WORD_STRING_ID
@ SCC_NEWGRF_PRINT_WORD_STRING_ID
81: Read 2 bytes from the stack as String ID
Definition control_codes.h:141
SCC_NEWGRF_PRINT_WORD_VOLUME_LONG
@ SCC_NEWGRF_PRINT_WORD_VOLUME_LONG
87: Read 2 bytes from the stack as long signed volume
Definition control_codes.h:145
SCC_NEWGRF_DISCARD_WORD
@ SCC_NEWGRF_DISCARD_WORD
85: Discard the next two bytes
Definition control_codes.h:164
SCC_NEWGRF_PRINT_DWORD_FORCE
@ SCC_NEWGRF_PRINT_DWORD_FORCE
9A 21: Read 4 bytes from the stack as unsigned force
Definition control_codes.h:162
SCC_NEWGRF_PRINT_WORD_CARGO_TINY
@ SCC_NEWGRF_PRINT_WORD_CARGO_TINY
9A 1D: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
Definition control_codes.h:160
SCC_NEWGRF_PRINT_QWORD_HEX
@ SCC_NEWGRF_PRINT_QWORD_HEX
9A 0B: Read 8 bytes from the stack and print it as hex
Definition control_codes.h:152
SCC_ENCODED_INTERNAL
@ SCC_ENCODED_INTERNAL
Encoded text from OpenTTD.
Definition control_codes.h:28
SCC_NEWGRF_PRINT_WORD_CARGO_LONG
@ SCC_NEWGRF_PRINT_WORD_CARGO_LONG
9A 1B: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
Definition control_codes.h:158
SCC_NEWGRF_PRINT_WORD_SPEED
@ SCC_NEWGRF_PRINT_WORD_SPEED
84: Read 2 bytes from the stack as signed speed
Definition control_codes.h:144
SCC_NEWGRF_PRINT_DWORD_DATE_SHORT
@ SCC_NEWGRF_PRINT_DWORD_DATE_SHORT
9A 17: Read 4 bytes from the stack as base 0 date
Definition control_codes.h:154
SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG
@ SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG
9A 0D: Read 2 bytes from the stack as long unsigned weight
Definition control_codes.h:146
SCC_NEWGRF_PRINT_QWORD_CURRENCY
@ SCC_NEWGRF_PRINT_QWORD_CURRENCY
9A 01: Read 8 bytes from the stack as currency
Definition control_codes.h:148