table/autorail.h
author Darkvater
Thu, 12 May 2005 00:11:37 +0000
changeset 1793 b9a37c98b468
parent 1070 bd31ed783fd3
child 2023 a21e221c65f9
permissions -rw-r--r--
(svn r2297) - CodeChange: server-check the next batch of commands.
- CodeChange: since only the server will be able to modify difficulty settings, leave the checking of correct values besides, and trust users will join legit servers.
- CodeChange: for renaming signs, only check if GetDParam(); eg _decode_parameters is empty ('\0') or not, instead of the extra check of players, etc. That basically does the same thing. Also dirty sign two times when renaming, once before, once after the action. Because if the name becomes shorter and you update only after, garbage remains on the screen.
- CodeChange: made GetMaskOfTownActions() available to the town-cmd to double-check if the action was available to the player. For this purpose the hardcoded _local_player has been removed from the function and is now passed as a parameter.
1070
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     1
/* Rail selection types (directions):
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     2
 / \    / \    / \    / \   / \   / \
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     3
/  /\  /\  \  /===\  /   \ /|  \ /  |\
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     4
\/  /  \  \/  \   /  \===/ \|  / \  |/
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     5
 \ /    \ /    \ /    \ /   \ /   \ /
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     6
  0      1      2      3     4     5
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     7
*/
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     8
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     9
// mark invalid tiles red
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    10
#define RED(c) c | PALETTE_SEL_TILE_RED
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    11
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    12
// table maps each of the six rail directions and tileh combinations to a sprite
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    13
// invalid entries are required to make sure that this array can be quickly accessed
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    14
const int AutorailTilehSprite[31][6] = {
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    15
// type   0        1        2        3        4        5
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    16
	{       0,       8,      16,      25,      34,      42 }, // tileh = 0
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    17
	{       5,      13, RED(22), RED(31),      35,      42 }, // tileh = 1
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    18
	{       5,      10,      16,      26, RED(38), RED(46) }, // tileh = 2
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    19
	{       5,       9, RED(23),      26,      35, RED(46) }, // tileh = 3
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    20
	{       2,      10, RED(19), RED(28),      34,      43 }, // tileh = 4
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    21
	{       1,       9,      17,      26,      35,      43 }, // tileh = 5
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    22
	{       1,      10, RED(20),      26, RED(38),      43 }, // tileh = 6
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    23
	{       1,       9,      17,      26,      35,      43 }, // tileh = 7
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    24
	{       2,      13,      17,      25, RED(40), RED(48) }, // tileh = 8
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    25
	{       1,      13,      17, RED(32),      35, RED(48) }, // tileh = 9
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    26
	{       2,       9,      17,      26,      35,      43 }, // tileh = 10
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    27
	{       1,       9,      17,      26,      35,      43 }, // tileh = 11
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    28
	{       2,       9,      17, RED(29), RED(40),      43 }, // tileh = 12
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    29
	{       1,       9,      17,      26,      35,      43 }, // tileh = 13
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    30
	{       1,       9,      17,      26,      35,      43 }, // tileh = 14
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    31
	{       0,       1,       2,       3,       4,       5 }, // invalid (15)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    32
	{       0,       1,       2,       3,       4,       5 }, // invalid (16)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    33
	{       0,       1,       2,       3,       4,       5 }, // invalid (17)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    34
	{       0,       1,       2,       3,       4,       5 }, // invalid (18)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    35
	{       0,       1,       2,       3,       4,       5 }, // invalid (19)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    36
	{       0,       1,       2,       3,       4,       5 }, // invalid (20)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    37
	{       0,       1,       2,       3,       4,       5 }, // invalid (21)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    38
	{       0,       1,       2,       3,       4,       5 }, // invalid (22)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    39
	{  RED(6), RED(11), RED(17), RED(27), RED(39), RED(47) }, // tileh = 23
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    40
	{       0,       1,       2,       3,       4,       5 }, // invalid (24)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    41
	{       0,       1,       2,       3,       4,       5 }, // invalid (25)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    42
	{       0,       1,       2,       3,       4,       5 }, // invalid (26)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    43
	{  RED(7), RED(15), RED(24), RED(33), RED(36), RED(44) }, // tileh = 27
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    44
	{       0,       1,       2,       3,       4,       5 }, // invalid (28)
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    45
	{  RED(3), RED(14), RED(18), RED(26), RED(41), RED(49) }, // tileh = 29
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    46
	{  RED(4), RED(12), RED(21), RED(30), RED(37), RED(45) }, // tileh = 30
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    47
};
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    48
#undef RED
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    49
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    50
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    51
// maps each pixel of a tile (16x16) to a selection type
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    52
// (0,0) is the top corner, (16,16) the bottom corner
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    53
const int AutorailPiece[16][16] = {
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    54
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    55
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    56
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    57
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    58
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    59
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    60
	{ 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    61
	{ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    62
	{ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    63
	{ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    64
	{ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    65
	{ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    66
	{ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    67
	{ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    68
	{ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 },
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    69
	{ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 }
bd31ed783fd3 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    70
};