rail.c
changeset 5573 afa6f92a71fd
parent 3977 edb5b94e2094
child 5590 dc34c43fc3eb
equal deleted inserted replaced
5572:220d67208783 5573:afa6f92a71fd
   102 };
   102 };
   103 
   103 
   104 
   104 
   105 RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
   105 RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
   106 {
   106 {
   107 	DiagDirection exitdir = TrackdirToExitdir(trackdir);
       
   108 	switch (GetTileType(tile)) {
   107 	switch (GetTileType(tile)) {
   109 		case MP_RAILWAY:
   108 		case MP_RAILWAY:
   110 			return GetRailType(tile);
   109 			return GetRailType(tile);
   111 
   110 
   112 		case MP_STREET:
   111 		case MP_STREET:
   118 			if (IsRailwayStationTile(tile)) return GetRailType(tile);
   117 			if (IsRailwayStationTile(tile)) return GetRailType(tile);
   119 			break;
   118 			break;
   120 
   119 
   121 		case MP_TUNNELBRIDGE:
   120 		case MP_TUNNELBRIDGE:
   122 			if (IsTunnel(tile)) {
   121 			if (IsTunnel(tile)) {
   123 				if (GetTunnelTransportType(tile) == TRANSPORT_RAIL) {
   122 				if (GetTunnelTransportType(tile) == TRANSPORT_RAIL) return GetRailType(tile);
   124 					return GetRailType(tile);
       
   125 				}
       
   126 			} else {
   123 			} else {
   127 				if (IsBridgeRamp(tile)) {
   124 				if (GetBridgeTransportType(tile) == TRANSPORT_RAIL) return GetRailType(tile);
   128 					if (GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
       
   129 						return GetRailType(tile);
       
   130 					}
       
   131 				} else {
       
   132 					if (GetBridgeAxis(tile) == DiagDirToAxis(exitdir)) {
       
   133 						if (GetBridgeTransportType(tile) == TRANSPORT_RAIL) {
       
   134 							return GetRailTypeOnBridge(tile);
       
   135 						}
       
   136 					} else {
       
   137 						if (IsTransportUnderBridge(tile) &&
       
   138 								GetTransportTypeUnderBridge(tile) == TRANSPORT_RAIL) {
       
   139 							return GetRailType(tile);
       
   140 						}
       
   141 					}
       
   142 				}
       
   143 			}
   125 			}
   144 			break;
   126 			break;
   145 
   127 
   146 		default:
   128 		default:
   147 			break;
   129 			break;