table/autorail.h
author bjarni
Mon, 14 Aug 2006 15:03:01 +0000
changeset 4262 4657d940a84c
parent 4253 6fadea8a8043
child 4549 60410aa1aa88
permissions -rw-r--r--
(svn r5888) -Fix: [autoreplace] if vehicles breakdowns and service are turned off, the vehicles failed to enter any depots
now they will quickly go to a depot if set to be replaced
the tradeoff is that a vehicle set to be replaced and without a depot in the orders will forget about the orders and head for a depot. If the replace fails (lack of money), it will exit and try to head for the depot again
also all vehicles of that type will rush to the depots at once, risking causing traffic jams. This is because there is no way to even it out like normal depot visits offers
Tip: add a depot to the orders of all vehicles, set it to service only and it will always be skipped unless the vehicle is set to be replaced. This should help on the jam issue and if the replace fails, the vehicle will go though a whole round of the orders and make more money before trying again
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2023
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2023
diff changeset
     2
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     3
/* Rail selection types (directions):
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     4
 / \    / \    / \    / \   / \   / \
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     5
/  /\  /\  \  /===\  /   \ /|  \ /  |\
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     6
\/  /  \  \/  \   /  \===/ \|  / \  |/
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     7
 \ /    \ /    \ /    \ /   \ /   \ /
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     8
  0      1      2      3     4     5
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
     9
*/
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    10
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    11
// mark invalid tiles red
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    12
#define RED(c) c | PALETTE_SEL_TILE_RED
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    13
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    14
// table maps each of the six rail directions and tileh combinations to a sprite
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    15
// invalid entries are required to make sure that this array can be quickly accessed
2752
b5fe5a7e6282 (svn r3297) Staticise
tron
parents: 2710
diff changeset
    16
static const int _AutorailTilehSprite[][6] = {
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    17
// type   0        1        2        3        4        5
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    18
	{       0,       8,      16,      25,      34,      42 }, // tileh = 0
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    19
	{       5,      13, RED(22), RED(31),      35,      42 }, // tileh = 1
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    20
	{       5,      10,      16,      26, RED(38), RED(46) }, // tileh = 2
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    21
	{       5,       9, RED(23),      26,      35, RED(46) }, // tileh = 3
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    22
	{       2,      10, RED(19), RED(28),      34,      43 }, // tileh = 4
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    23
	{       1,       9,      17,      26,      35,      43 }, // tileh = 5
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    24
	{       1,      10, RED(20),      26, RED(38),      43 }, // tileh = 6
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    25
	{       1,       9,      17,      26,      35,      43 }, // tileh = 7
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    26
	{       2,      13,      17,      25, RED(40), RED(48) }, // tileh = 8
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    27
	{       1,      13,      17, RED(32),      35, RED(48) }, // tileh = 9
2710
e144188c1fdb (svn r3254) - Fix: graphical glitch with autorail tool on a certain tile-type.
Darkvater
parents: 2186
diff changeset
    28
	{       1,       9,      17,      26,      35,      43 }, // tileh = 10
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    29
	{       1,       9,      17,      26,      35,      43 }, // tileh = 11
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    30
	{       2,       9,      17, RED(29), RED(40),      43 }, // tileh = 12
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    31
	{       1,       9,      17,      26,      35,      43 }, // tileh = 13
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    32
	{       1,       9,      17,      26,      35,      43 }, // tileh = 14
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    33
	{       0,       1,       2,       3,       4,       5 }, // invalid (15)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    34
	{       0,       1,       2,       3,       4,       5 }, // invalid (16)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    35
	{       0,       1,       2,       3,       4,       5 }, // invalid (17)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    36
	{       0,       1,       2,       3,       4,       5 }, // invalid (18)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    37
	{       0,       1,       2,       3,       4,       5 }, // invalid (19)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    38
	{       0,       1,       2,       3,       4,       5 }, // invalid (20)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    39
	{       0,       1,       2,       3,       4,       5 }, // invalid (21)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    40
	{       0,       1,       2,       3,       4,       5 }, // invalid (22)
4253
6fadea8a8043 (svn r5864) -Feature: Also allow horizontal and vertical rails on steep slopes
tron
parents: 4246
diff changeset
    41
	{       6,      11,      17,      27, RED(39), RED(47) }, // tileh = 23
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    42
	{       0,       1,       2,       3,       4,       5 }, // invalid (24)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    43
	{       0,       1,       2,       3,       4,       5 }, // invalid (25)
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    44
	{       0,       1,       2,       3,       4,       5 }, // invalid (26)
4253
6fadea8a8043 (svn r5864) -Feature: Also allow horizontal and vertical rails on steep slopes
tron
parents: 4246
diff changeset
    45
	{       7,      15, RED(24), RED(33),      36,      44 }, // tileh = 27
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    46
	{       0,       1,       2,       3,       4,       5 }, // invalid (28)
4253
6fadea8a8043 (svn r5864) -Feature: Also allow horizontal and vertical rails on steep slopes
tron
parents: 4246
diff changeset
    47
	{       3,      14,      18,      26, RED(41), RED(49) }, // tileh = 29
6fadea8a8043 (svn r5864) -Feature: Also allow horizontal and vertical rails on steep slopes
tron
parents: 4246
diff changeset
    48
	{       4,      12, RED(21), RED(30),      37,      45 }  // tileh = 30
1070
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    49
};
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    50
#undef RED
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    51
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    52
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    53
// maps each pixel of a tile (16x16) to a selection type
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    54
// (0,0) is the top corner, (16,16) the bottom corner
2752
b5fe5a7e6282 (svn r3297) Staticise
tron
parents: 2710
diff changeset
    55
static const byte _AutorailPiece[][16] = {
1070
bef634a62323 (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 },
bef634a62323 (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 },
bef634a62323 (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 },
bef634a62323 (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 },
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    60
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    61
	{ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5 },
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    62
	{ 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1 },
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    63
	{ 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    64
	{ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1 },
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    65
	{ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1 },
bef634a62323 (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 },
bef634a62323 (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 },
bef634a62323 (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 },
bef634a62323 (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 },
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    70
	{ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 },
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    71
	{ 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3 }
bef634a62323 (svn r1571) Feature: Visually enhanced autorail placing
dominik
parents:
diff changeset
    72
};