author | bjarni |
Wed, 15 Mar 2006 14:11:17 +0000 | |
changeset 3212 | 39c32be8404c |
parent 3185 | a9d0cdff7b84 |
child 3237 | 2cf19f9603b2 |
permissions | -rw-r--r-- |
3101
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
2 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
3 |
#ifndef RAIL_MAP_H |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
4 |
#define RAIL_MAP_H |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
5 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
6 |
#include "rail.h" |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
7 |
#include "tile.h" |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
8 |
#include "waypoint.h" |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
9 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
10 |
|
3185 | 11 |
static inline DiagDirection GetRailDepotDirection(TileIndex t) |
12 |
{ |
|
13 |
return (DiagDirection)GB(_m[t].m5, 0, 2); |
|
14 |
} |
|
15 |
||
16 |
||
3101
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
17 |
static inline TrackBits GetRailWaypointBits(TileIndex t) |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
18 |
{ |
3102
f9ca4379db9d
(svn r3697) Rename DIAG1/DIAG2 to X resp. Y as this conveys a bit better in which direction a pieces of rail goes
tron
parents:
3101
diff
changeset
|
19 |
return _m[t].m5 & RAIL_WAYPOINT_TRACK_MASK ? TRACK_BIT_Y : TRACK_BIT_X; |
3101
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
20 |
} |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
21 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
22 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
23 |
static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r) |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
24 |
{ |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
25 |
SetTileType(t, MP_RAILWAY); |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
26 |
SetTileOwner(t, o); |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
27 |
_m[t].m2 = 0; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
28 |
_m[t].m3 = r; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
29 |
_m[t].m4 = 0; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
30 |
_m[t].m5 = RAIL_TYPE_NORMAL | b; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
31 |
} |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
32 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
33 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
34 |
static inline void MakeRailDepot(TileIndex t, Owner o, DiagDirection d, RailType r) |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
35 |
{ |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
36 |
SetTileType(t, MP_RAILWAY); |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
37 |
SetTileOwner(t, o); |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
38 |
_m[t].m2 = 0; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
39 |
_m[t].m3 = r; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
40 |
_m[t].m4 = 0; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
41 |
_m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_DEPOT | d; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
42 |
} |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
43 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
44 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
45 |
static inline void MakeRailWaypoint(TileIndex t, Owner o, Axis a, RailType r, uint index) |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
46 |
{ |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
47 |
SetTileType(t, MP_RAILWAY); |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
48 |
SetTileOwner(t, o); |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
49 |
_m[t].m2 = index; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
50 |
_m[t].m3 = r; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
51 |
_m[t].m4 = 0; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
52 |
_m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_WAYPOINT | a; |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
53 |
} |
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
54 |
|
a44fdf9faef1
(svn r3696) Add functions to turn a tile into a normal rail tile/depot/waypoint. This is just a tiny step, the rail code needs way more love and caring
tron
parents:
diff
changeset
|
55 |
#endif |