equal
deleted
inserted
replaced
|
1 /* $Id$ */ |
|
2 |
|
3 #include "stdafx.h" |
|
4 #include "openttd.h" |
|
5 #include "road_map.h" |
|
6 #include "station.h" |
|
7 |
|
8 |
|
9 RoadBits GetAnyRoadBits(TileIndex tile) |
|
10 { |
|
11 switch (GetTileType(tile)) { |
|
12 case MP_STREET: |
|
13 switch (GetRoadType(tile)) { |
|
14 default: |
|
15 case ROAD_NORMAL: return GetRoadBits(tile); |
|
16 case ROAD_CROSSING: return GetCrossingRoadBits(tile); |
|
17 case ROAD_DEPOT: return DiagDirToRoadBits(GB(_m[tile].m5, 0, 2)); |
|
18 } |
|
19 |
|
20 case MP_STATION: |
|
21 if (!IsRoadStationTile(tile)) return 0; |
|
22 return DiagDirToRoadBits(GetRoadStationDir(tile)); |
|
23 |
|
24 case MP_TUNNELBRIDGE: |
|
25 if (_m[tile].m5 & 0x80) { |
|
26 // bridge |
|
27 if (_m[tile].m5 & 0x40) { |
|
28 // middle part |
|
29 if ((_m[tile].m5 & 0x38) != 0x28) return 0; // no road under bridge |
|
30 return _m[tile].m5 & 1 ? ROAD_X : ROAD_Y; |
|
31 } else { |
|
32 // ending |
|
33 if (GB(_m[tile].m5, 1, 2) != TRANSPORT_ROAD) return 0; // not a road bridge |
|
34 return _m[tile].m5 & 1 ? ROAD_Y : ROAD_X; |
|
35 } |
|
36 } else { |
|
37 // tunnel |
|
38 if (GB(_m[tile].m5, 2, 2) != TRANSPORT_ROAD) return 0; // not a road tunnel |
|
39 return DiagDirToRoadBits(ReverseDiagDir(GB(_m[tile].m5, 0, 2))); |
|
40 } |
|
41 |
|
42 default: return 0; |
|
43 } |
|
44 } |