summaryrefslogtreecommitdiff
path: root/rail_map.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-01 08:56:38 +0000
committertron <tron@openttd.org>2006-03-01 08:56:38 +0000
commit28fc670fe2e053cf37784bac0e85812e5509eb15 (patch)
treec9a6270610c574618ee43157834cb8fe59329fe0 /rail_map.h
parent7a3a9e626290220ee3cc37898a989e3b6811d8fa (diff)
downloadopenttd-28fc670fe2e053cf37784bac0e85812e5509eb15.tar.xz
(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
Diffstat (limited to 'rail_map.h')
-rw-r--r--rail_map.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/rail_map.h b/rail_map.h
new file mode 100644
index 000000000..35a0ddfd3
--- /dev/null
+++ b/rail_map.h
@@ -0,0 +1,49 @@
+/* $Id$ */
+
+#ifndef RAIL_MAP_H
+#define RAIL_MAP_H
+
+#include "rail.h"
+#include "tile.h"
+#include "waypoint.h"
+
+
+static inline TrackBits GetRailWaypointBits(TileIndex t)
+{
+ return _m[t].m5 & RAIL_WAYPOINT_TRACK_MASK ? TRACK_BIT_DIAG2 : TRACK_BIT_DIAG1;
+}
+
+
+static inline void MakeRailNormal(TileIndex t, Owner o, TrackBits b, RailType r)
+{
+ SetTileType(t, MP_RAILWAY);
+ SetTileOwner(t, o);
+ _m[t].m2 = 0;
+ _m[t].m3 = r;
+ _m[t].m4 = 0;
+ _m[t].m5 = RAIL_TYPE_NORMAL | b;
+}
+
+
+static inline void MakeRailDepot(TileIndex t, Owner o, DiagDirection d, RailType r)
+{
+ SetTileType(t, MP_RAILWAY);
+ SetTileOwner(t, o);
+ _m[t].m2 = 0;
+ _m[t].m3 = r;
+ _m[t].m4 = 0;
+ _m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_DEPOT | d;
+}
+
+
+static inline void MakeRailWaypoint(TileIndex t, Owner o, Axis a, RailType r, uint index)
+{
+ SetTileType(t, MP_RAILWAY);
+ SetTileOwner(t, o);
+ _m[t].m2 = index;
+ _m[t].m3 = r;
+ _m[t].m4 = 0;
+ _m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_WAYPOINT | a;
+}
+
+#endif