rail.c
changeset 3184 118a520164e4
parent 3147 fc76d566a68e
child 3232 a6555c187ab5
equal deleted inserted replaced
3183:90c676e6a50d 3184:118a520164e4
     2 
     2 
     3 #include "stdafx.h"
     3 #include "stdafx.h"
     4 #include "openttd.h"
     4 #include "openttd.h"
     5 #include "rail.h"
     5 #include "rail.h"
     6 #include "station.h"
     6 #include "station.h"
       
     7 #include "tunnel_map.h"
     7 
     8 
     8 /* XXX: Below 3 tables store duplicate data. Maybe remove some? */
     9 /* XXX: Below 3 tables store duplicate data. Maybe remove some? */
     9 /* Maps a trackdir to the bit that stores its status in the map arrays, in the
    10 /* Maps a trackdir to the bit that stores its status in the map arrays, in the
    10  * direction along with the trackdir */
    11  * direction along with the trackdir */
    11 const byte _signal_along_trackdir[] = {
    12 const byte _signal_along_trackdir[] = {
   121 		case MP_STATION:
   122 		case MP_STATION:
   122 			if (IsTrainStationTile(tile))
   123 			if (IsTrainStationTile(tile))
   123 				type = _m[tile].m3 & RAILTYPE_MASK;
   124 				type = _m[tile].m3 & RAILTYPE_MASK;
   124 			break;
   125 			break;
   125 		case MP_TUNNELBRIDGE:
   126 		case MP_TUNNELBRIDGE:
   126 			/* railway tunnel */
   127 			if (IsTunnel(tile) && GetTunnelTransportType(tile) == TRANSPORT_RAIL) {
   127 			if ((_m[tile].m5 & 0xFC) == 0) type = _m[tile].m3 & RAILTYPE_MASK;
   128 				return _m[tile].m3 & RAILTYPE_MASK;
       
   129 			}
   128 			/* railway bridge ending */
   130 			/* railway bridge ending */
   129 			if ((_m[tile].m5 & 0xC6) == 0x80) type = _m[tile].m3 & RAILTYPE_MASK;
   131 			if ((_m[tile].m5 & 0xC6) == 0x80) type = _m[tile].m3 & RAILTYPE_MASK;
   130 			/* on railway bridge */
   132 			/* on railway bridge */
   131 			if ((_m[tile].m5 & 0xC6) == 0xC0 && ((DiagDirection)(_m[tile].m5 & 0x1)) == (exitdir & 0x1))
   133 			if ((_m[tile].m5 & 0xC6) == 0xC0 && ((DiagDirection)(_m[tile].m5 & 0x1)) == (exitdir & 0x1))
   132 				type = (_m[tile].m3 >> 4) & RAILTYPE_MASK;
   134 				type = (_m[tile].m3 >> 4) & RAILTYPE_MASK;