OpenTTD Source 20260311-master-g511d3794ce
autorail.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
9
10/* Rail selection types (directions):
11 * / \ / \ / \ / \ / \ / \
12 * / /\ /\ \ /===\ / \ /| \ / |\
13 * \/ / \ \/ \ / \===/ \| / \ |/
14 * \ / \ / \ / \ / \ / \ /
15 * 0 1 2 3 4 5
16 */
17
19#define RED(c) -c
20
25static const int _AutorailTilehSprite[][6] = {
26/* type 0 1 2 3 4 5 */
27 { 0, 8, 16, 25, 34, 42 }, // tileh = 0
28 { 5, 13, RED(22), RED(31), 35, 42 }, // tileh = 1
29 { 5, 10, 16, 26, RED(38), RED(46) }, // tileh = 2
30 { 5, 9, RED(23), 26, 35, RED(46) }, // tileh = 3
31 { 2, 10, RED(19), RED(28), 34, 43 }, // tileh = 4
32 { 1, 9, 17, 26, 35, 43 }, // tileh = 5
33 { 1, 10, RED(20), 26, RED(38), 43 }, // tileh = 6
34 { 1, 9, 17, 26, 35, 43 }, // tileh = 7
35 { 2, 13, 17, 25, RED(40), RED(48) }, // tileh = 8
36 { 1, 13, 17, RED(32), 35, RED(48) }, // tileh = 9
37 { 1, 9, 17, 26, 35, 43 }, // tileh = 10
38 { 1, 9, 17, 26, 35, 43 }, // tileh = 11
39 { 2, 9, 17, RED(29), RED(40), 43 }, // tileh = 12
40 { 1, 9, 17, 26, 35, 43 }, // tileh = 13
41 { 1, 9, 17, 26, 35, 43 }, // tileh = 14
42 { 0, 1, 2, 3, 4, 5 }, // invalid (15)
43 { 0, 1, 2, 3, 4, 5 }, // invalid (16)
44 { 0, 1, 2, 3, 4, 5 }, // invalid (17)
45 { 0, 1, 2, 3, 4, 5 }, // invalid (18)
46 { 0, 1, 2, 3, 4, 5 }, // invalid (19)
47 { 0, 1, 2, 3, 4, 5 }, // invalid (20)
48 { 0, 1, 2, 3, 4, 5 }, // invalid (21)
49 { 0, 1, 2, 3, 4, 5 }, // invalid (22)
50 { 6, 11, 17, 27, RED(39), RED(47) }, // tileh = 23
51 { 0, 1, 2, 3, 4, 5 }, // invalid (24)
52 { 0, 1, 2, 3, 4, 5 }, // invalid (25)
53 { 0, 1, 2, 3, 4, 5 }, // invalid (26)
54 { 7, 15, RED(24), RED(33), 36, 44 }, // tileh = 27
55 { 0, 1, 2, 3, 4, 5 }, // invalid (28)
56 { 3, 14, 18, 26, RED(41), RED(49) }, // tileh = 29
57 { 4, 12, RED(21), RED(30), 37, 45 } // tileh = 30
58};
59#undef RED
60
61
63static const HighLightStyle _autorail_piece[][16] = {
80};
static const int _AutorailTilehSprite[][6]
Table maps each of the six rail directions and tileh combinations to a sprite.
Definition autorail.h:25
static const HighLightStyle _autorail_piece[][16]
Maps each pixel of a tile (16x16) to a selection type (0,0) is the top corner, (16,...
Definition autorail.h:63
#define RED(c)
Mark invalid tiles red.
Definition autorail.h:19
HighLightStyle
Highlighting draw styles.
@ HT_DIR_HL
horizontal lower
@ HT_DIR_HU
horizontal upper
@ HT_DIR_X
X direction.
@ HT_DIR_VL
vertical left
@ HT_DIR_VR
vertical right
@ HT_DIR_Y
Y direction.