author | truelight |
Tue, 14 Mar 2006 20:59:03 +0000 | |
changeset 3202 | ee43c4501036 |
parent 3196 | 29717e930f9a |
child 3209 | e0b7d48351a3 |
permissions | -rw-r--r-- |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
2 |
|
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
3 |
#ifndef BRIDGE_MAP_H |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
4 |
#define BRIDGE_MAP_H |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
5 |
|
3196 | 6 |
#include "direction.h" |
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
7 |
#include "macros.h" |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
8 |
#include "map.h" |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
9 |
#include "rail.h" |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
10 |
#include "tile.h" |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
11 |
|
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
12 |
|
3196 | 13 |
/** |
14 |
* Get the direction pointing onto the bridge |
|
15 |
*/ |
|
16 |
static inline DiagDirection GetBridgeRampDirection(TileIndex t) |
|
17 |
{ |
|
18 |
/* Heavy wizardry to convert the X/Y (bit 0) + N/S (bit 5) encoding of |
|
19 |
* bridges to a DiagDirection |
|
20 |
*/ |
|
21 |
return (DiagDirection)((6 - (_m[t].m5 >> 4 & 2) - (_m[t].m5 & 1)) % 4); |
|
22 |
} |
|
23 |
||
24 |
||
3189
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
25 |
static inline void SetClearUnderBridge(TileIndex t) |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
26 |
{ |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
27 |
SetTileOwner(t, OWNER_NONE); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
28 |
SB(_m[t].m5, 3, 3, 0 << 2 | 0); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
29 |
} |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
30 |
|
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
31 |
static inline void SetWaterUnderBridge(TileIndex t) |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
32 |
{ |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
33 |
SetTileOwner(t, OWNER_WATER); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
34 |
SB(_m[t].m5, 3, 3, 0 << 2 | 1); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
35 |
} |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
36 |
|
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
37 |
static inline void SetRailUnderBridge(TileIndex t, Owner o, RailType r) |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
38 |
{ |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
39 |
SetTileOwner(t, o); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
40 |
SB(_m[t].m5, 3, 3, 1 << 2 | TRANSPORT_RAIL); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
41 |
SB(_m[t].m3, 0, 4, r); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
42 |
} |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
43 |
|
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
44 |
static inline void SetRoadUnderBridge(TileIndex t, Owner o) |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
45 |
{ |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
46 |
SetTileOwner(t, o); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
47 |
SB(_m[t].m5, 3, 3, 1 << 2 | TRANSPORT_ROAD); |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
48 |
} |
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
49 |
|
1af302c5abd0
(svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff
changeset
|
50 |
#endif |