elrail.c
changeset 3367 a995838e8d85
parent 3355 e414a0b104a6
child 3368 d57156668a59
equal deleted inserted replaced
3366:49ff3eb617f8 3367:a995838e8d85
    43 
    43 
    44   */
    44   */
    45 
    45 
    46 #include "stdafx.h"
    46 #include "stdafx.h"
    47 #include "openttd.h"
    47 #include "openttd.h"
       
    48 #include "station_map.h"
    48 #include "tile.h"
    49 #include "tile.h"
    49 #include "viewport.h"
    50 #include "viewport.h"
    50 #include "functions.h" /* We should REALLY get rid of this goddamn file, as it is butt-ugly */
    51 #include "functions.h" /* We should REALLY get rid of this goddamn file, as it is butt-ugly */
    51 #include "variables.h" /* ... same here */
    52 #include "variables.h" /* ... same here */
    52 #include "rail.h"
    53 #include "rail.h"
    81 			break;
    82 			break;
    82 		case MP_TUNNELBRIDGE:
    83 		case MP_TUNNELBRIDGE:
    83 			if (IsTunnel(t)) {
    84 			if (IsTunnel(t)) {
    84 				if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
    85 				if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
    85 				if (override != NULL) *override = 1 << GetTunnelDirection(t);
    86 				if (override != NULL) *override = 1 << GetTunnelDirection(t);
    86 				return (_m[t].m5 & 1) ? TRACK_BIT_Y : TRACK_BIT_X;
    87 				return DiagDirToAxis(GetTunnelDirection(t)) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y;
    87 			} else {
    88 			} else {
    88 				if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
    89 				if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
    89 				if (
    90 				if (
    90 					IsBridgeMiddle(t) &&
    91 					IsBridgeMiddle(t) &&
    91 					IsTransportUnderBridge(t) &&
    92 					IsTransportUnderBridge(t) &&
    96 
    97 
    97 					return GetBridgeAxis(t) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y;
    98 					return GetBridgeAxis(t) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y;
    98 				}
    99 				}
    99 			}
   100 			}
   100 		case MP_STREET:
   101 		case MP_STREET:
   101 			if ((_m[t].m4 & 0xF) != RAILTYPE_ELECTRIC) return 0;
   102 			if (GetRailTypeCrossing(t) != RAILTYPE_ELECTRIC) return 0;
   102 			return GetCrossingRailBits(t);
   103 			return GetCrossingRailBits(t);
   103 		case MP_STATION:
   104 		case MP_STATION:
   104 			if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
   105 			if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
   105 			return _m[t].m5 & 1 ? TRACK_BIT_Y : TRACK_BIT_X;
   106 			return GetRailStationTrack(t);
   106 		default:
   107 		default:
   107 			return 0;
   108 			return 0;
   108 	}
   109 	}
   109 }
   110 }
   110 
   111