author | tron |
Fri, 17 Mar 2006 10:10:31 +0000 | |
changeset 3242 | 1cefa03f0d5e |
parent 3239 | 45396b9950aa |
child 3258 | 94a915e7485f |
permissions | -rw-r--r-- |
3101
e2fdb8802c2f
(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$ */ |
e2fdb8802c2f
(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 |
|
e2fdb8802c2f
(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 |
e2fdb8802c2f
(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 |
e2fdb8802c2f
(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 |
|
3239
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
6 |
#include "direction.h" |
3101
e2fdb8802c2f
(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" |
3239
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
8 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
9 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
10 |
typedef enum RailTileType { |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
11 |
RAIL_TYPE_NORMAL = 0x0, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
12 |
RAIL_TYPE_SIGNALS = 0x40, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
13 |
RAIL_TYPE_UNUSED = 0x80, /* XXX: Maybe this could become waypoints? */ |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
14 |
RAIL_TYPE_DEPOT_WAYPOINT = 0xC0, /* Is really depots and waypoints... */ |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
15 |
RAIL_TILE_TYPE_MASK = 0xC0 |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
16 |
} RailTileType; |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
17 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
18 |
static inline RailTileType GetRailTileType(TileIndex t) |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
19 |
{ |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
20 |
assert(IsTileType(t, MP_RAILWAY)); |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
21 |
return _m[t].m5 & RAIL_TILE_TYPE_MASK; |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
22 |
} |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
23 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
24 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
25 |
/** These specify the subtype when the main rail type is |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
26 |
* RAIL_TYPE_DEPOT_WAYPOINT */ |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
27 |
typedef enum RailTileSubtypes { |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
28 |
RAIL_SUBTYPE_DEPOT = 0x00, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
29 |
RAIL_SUBTYPE_WAYPOINT = 0x04, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
30 |
RAIL_SUBTYPE_MASK = 0x3C |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
31 |
} RailTileSubtype; |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
32 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
33 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
34 |
typedef enum RailTypes { |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
35 |
RAILTYPE_RAIL = 0, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
36 |
RAILTYPE_MONO = 1, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
37 |
RAILTYPE_MAGLEV = 2, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
38 |
RAILTYPE_END, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
39 |
INVALID_RAILTYPE = 0xFF |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
40 |
} RailType; |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
41 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
42 |
static inline RailType GetRailType(TileIndex t) |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
43 |
{ |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
44 |
return (RailType)GB(_m[t].m3, 0, 4); |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
45 |
} |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
46 |
|
3242
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
47 |
// TODO remove this by moving to the same bits as GetRailType() |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
48 |
static inline RailType GetRailTypeCrossing(TileIndex t) |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
49 |
{ |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
50 |
return (RailType)GB(_m[t].m4, 0, 4); |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
51 |
} |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
52 |
|
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
53 |
static inline RailType GetRailTypeOnBridge(TileIndex t) |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
54 |
{ |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
55 |
return (RailType)GB(_m[t].m3, 4, 4); |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
56 |
} |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
57 |
|
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
58 |
static inline void SetRailType(TileIndex t, RailType r) |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
59 |
{ |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
60 |
SB(_m[t].m3, 0, 4, r); |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
61 |
} |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
62 |
|
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
63 |
// TODO remove this by moving to the same bits as SetRailType() |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
64 |
static inline void SetRailTypeCrossing(TileIndex t, RailType r) |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
65 |
{ |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
66 |
SB(_m[t].m4, 0, 4, r); |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
67 |
} |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
68 |
|
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
69 |
static inline void SetRailTypeOnBridge(TileIndex t, RailType r) |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
70 |
{ |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
71 |
SB(_m[t].m3, 4, 4, r); |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
72 |
} |
1cefa03f0d5e
(svn r3916) Get/Set the rail type by [GS]etRailType{Crossing,OnBridge,}()
tron
parents:
3239
diff
changeset
|
73 |
|
3239
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
74 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
75 |
/** These are used to specify a single track. |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
76 |
* Can be translated to a trackbit with TrackToTrackbit */ |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
77 |
typedef enum Track { |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
78 |
TRACK_X = 0, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
79 |
TRACK_Y = 1, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
80 |
TRACK_UPPER = 2, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
81 |
TRACK_LOWER = 3, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
82 |
TRACK_LEFT = 4, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
83 |
TRACK_RIGHT = 5, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
84 |
TRACK_END, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
85 |
INVALID_TRACK = 0xFF |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
86 |
} Track; |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
87 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
88 |
|
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
89 |
/** Bitfield corresponding to Track */ |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
90 |
typedef enum TrackBits { |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
91 |
TRACK_BIT_X = 1U << TRACK_X, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
92 |
TRACK_BIT_Y = 1U << TRACK_Y, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
93 |
TRACK_BIT_UPPER = 1U << TRACK_UPPER, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
94 |
TRACK_BIT_LOWER = 1U << TRACK_LOWER, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
95 |
TRACK_BIT_LEFT = 1U << TRACK_LEFT, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
96 |
TRACK_BIT_RIGHT = 1U << TRACK_RIGHT, |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
97 |
TRACK_BIT_MASK = 0x3FU |
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
98 |
} TrackBits; |
3101
e2fdb8802c2f
(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
|
99 |
|
e2fdb8802c2f
(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
|
100 |
|
3185 | 101 |
static inline DiagDirection GetRailDepotDirection(TileIndex t) |
102 |
{ |
|
103 |
return (DiagDirection)GB(_m[t].m5, 0, 2); |
|
104 |
} |
|
105 |
||
106 |
||
3101
e2fdb8802c2f
(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
|
107 |
static inline TrackBits GetRailWaypointBits(TileIndex t) |
e2fdb8802c2f
(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
|
108 |
{ |
3239
45396b9950aa
(svn r3913) Move declarations to rail_map.h so rail.h is dependent on rail_map.h and not the other way round
tron
parents:
3238
diff
changeset
|
109 |
return _m[t].m5 & 1 ? TRACK_BIT_Y : TRACK_BIT_X; |
3101
e2fdb8802c2f
(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
|
110 |
} |
e2fdb8802c2f
(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
|
111 |
|
e2fdb8802c2f
(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
|
112 |
|
3238
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
113 |
typedef enum SignalType { |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
114 |
SIGTYPE_NORMAL = 0, // normal signal |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
115 |
SIGTYPE_ENTRY = 1, // presignal block entry |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
116 |
SIGTYPE_EXIT = 2, // presignal block exit |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
117 |
SIGTYPE_COMBO = 3 // presignal inter-block |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
118 |
} SignalType; |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
119 |
|
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
120 |
static inline SignalType GetSignalType(TileIndex t) |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
121 |
{ |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
122 |
assert(GetRailTileType(t) == RAIL_TYPE_SIGNALS); |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
123 |
return (SignalType)GB(_m[t].m4, 0, 2); |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
124 |
} |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
125 |
|
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
126 |
static inline void SetSignalType(TileIndex t, SignalType s) |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
127 |
{ |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
128 |
assert(GetRailTileType(t) == RAIL_TYPE_SIGNALS); |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
129 |
SB(_m[t].m4, 0, 2, s); |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
130 |
} |
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
131 |
|
a100405fe221
(svn r3912) Move the signal type enum and GetSignalType() to rail_map.h; also add SetSignalType() and use the functions
tron
parents:
3237
diff
changeset
|
132 |
|
3237
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
133 |
typedef enum SignalVariant { |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
134 |
SIG_ELECTRIC = 0, |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
135 |
SIG_SEMAPHORE = 1 |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
136 |
} SignalVariant; |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
137 |
|
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
138 |
static inline SignalVariant GetSignalVariant(TileIndex t) |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
139 |
{ |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
140 |
return (SignalVariant)GB(_m[t].m4, 2, 1); |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
141 |
} |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
142 |
|
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
143 |
static inline void SetSignalVariant(TileIndex t, SignalVariant v) |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
144 |
{ |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
145 |
SB(_m[t].m4, 2, 1, v); |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
146 |
} |
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
147 |
|
985399d4099d
(svn r3911) Add functions to retrieve/set the signal variant (electric/semaphore)
tron
parents:
3185
diff
changeset
|
148 |
|
3101
e2fdb8802c2f
(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
|
149 |
static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r) |
e2fdb8802c2f
(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
|
150 |
{ |
e2fdb8802c2f
(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
|
151 |
SetTileType(t, MP_RAILWAY); |
e2fdb8802c2f
(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
|
152 |
SetTileOwner(t, o); |
e2fdb8802c2f
(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
|
153 |
_m[t].m2 = 0; |
e2fdb8802c2f
(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
|
154 |
_m[t].m3 = r; |
e2fdb8802c2f
(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
|
155 |
_m[t].m4 = 0; |
e2fdb8802c2f
(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
|
156 |
_m[t].m5 = RAIL_TYPE_NORMAL | b; |
e2fdb8802c2f
(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
|
157 |
} |
e2fdb8802c2f
(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
|
158 |
|
e2fdb8802c2f
(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
|
159 |
|
e2fdb8802c2f
(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
|
160 |
static inline void MakeRailDepot(TileIndex t, Owner o, DiagDirection d, RailType r) |
e2fdb8802c2f
(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
|
161 |
{ |
e2fdb8802c2f
(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
|
162 |
SetTileType(t, MP_RAILWAY); |
e2fdb8802c2f
(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
|
163 |
SetTileOwner(t, o); |
e2fdb8802c2f
(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
|
164 |
_m[t].m2 = 0; |
e2fdb8802c2f
(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
|
165 |
_m[t].m3 = r; |
e2fdb8802c2f
(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
|
166 |
_m[t].m4 = 0; |
e2fdb8802c2f
(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
|
167 |
_m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_DEPOT | d; |
e2fdb8802c2f
(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
|
168 |
} |
e2fdb8802c2f
(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
|
169 |
|
e2fdb8802c2f
(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
|
170 |
|
e2fdb8802c2f
(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
|
171 |
static inline void MakeRailWaypoint(TileIndex t, Owner o, Axis a, RailType r, uint index) |
e2fdb8802c2f
(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
|
172 |
{ |
e2fdb8802c2f
(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
|
173 |
SetTileType(t, MP_RAILWAY); |
e2fdb8802c2f
(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
|
174 |
SetTileOwner(t, o); |
e2fdb8802c2f
(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
|
175 |
_m[t].m2 = index; |
e2fdb8802c2f
(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
|
176 |
_m[t].m3 = r; |
e2fdb8802c2f
(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
|
177 |
_m[t].m4 = 0; |
e2fdb8802c2f
(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
|
178 |
_m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_WAYPOINT | a; |
e2fdb8802c2f
(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
|
179 |
} |
e2fdb8802c2f
(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
|
180 |
|
e2fdb8802c2f
(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
|
181 |
#endif |