summaryrefslogtreecommitdiff
path: root/road.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-28 21:19:50 +0000
committertron <tron@openttd.org>2006-02-28 21:19:50 +0000
commit0d044cabca9a1dcae15892de613dd418bfe093f7 (patch)
treef0429fb414017152fbcad0a79e27238992e53f6d /road.h
parent530a44436ceb6095c37c7d45eaa65a78cd45e428 (diff)
downloadopenttd-0d044cabca9a1dcae15892de613dd418bfe093f7.tar.xz
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
Diffstat (limited to 'road.h')
-rw-r--r--road.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/road.h b/road.h
index e72cbb37e..92e9742d2 100644
--- a/road.h
+++ b/road.h
@@ -4,6 +4,8 @@
#define ROAD_H
#include "macros.h"
+#include "rail.h"
+#include "tile.h"
typedef enum RoadBits {
ROAD_NW = 1,
@@ -36,4 +38,37 @@ static inline RoadType GetRoadType(TileIndex tile)
return GB(_m[tile].m5, 4, 4);
}
+
+static inline void MakeRoadNormal(TileIndex t, Owner owner, RoadBits bits, uint town)
+{
+ SetTileType(t, MP_STREET);
+ SetTileOwner(t, owner);
+ _m[t].m2 = town;
+ _m[t].m3 = 0;
+ _m[t].m4 = 0 << 7 | 0 << 4 | 0;
+ _m[t].m5 = ROAD_NORMAL << 4 | bits;
+}
+
+
+static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner rail, Axis roaddir, RailType rt, uint town)
+{
+ SetTileType(t, MP_STREET);
+ SetTileOwner(t, rail);
+ _m[t].m2 = town;
+ _m[t].m3 = road;
+ _m[t].m4 = 0 << 7 | 0 << 4 | rt;
+ _m[t].m5 = ROAD_CROSSING << 4 | roaddir << 3 | 0 << 2;
+}
+
+
+static inline void MakeRoadDepot(TileIndex t, Owner owner, DiagDirection dir)
+{
+ SetTileType(t, MP_STREET);
+ SetTileOwner(t, owner);
+ _m[t].m2 = 0;
+ _m[t].m3 = 0;
+ _m[t].m4 = 0;
+ _m[t].m5 = ROAD_DEPOT << 4 | dir;
+}
+
#endif