90 if (IsArticulatedPart(u)) continue; |
90 if (IsArticulatedPart(u)) continue; |
91 |
91 |
92 if (IsBridgeTile(u->tile) && IsBridgeMiddle(u->tile) && DiagDirToAxis(DirToDiagDir(u->direction)) == GetBridgeAxis(u->tile)) { |
92 if (IsBridgeTile(u->tile) && IsBridgeMiddle(u->tile) && DiagDirToAxis(DirToDiagDir(u->direction)) == GetBridgeAxis(u->tile)) { |
93 if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeOnBridge(u->tile))) engine_has_power = false; |
93 if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeOnBridge(u->tile))) engine_has_power = false; |
94 if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeOnBridge(u->tile))) wagon_has_power = false; |
94 if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeOnBridge(u->tile))) wagon_has_power = false; |
95 } else if (IsTileType(u->tile, MP_STREET) && IsLevelCrossing(u->tile)) { |
95 } else if (IsLevelCrossingTile(u->tile)) { |
96 if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeCrossing(u->tile))) engine_has_power = false; |
96 if (!HasPowerOnRail(u->u.rail.railtype, GetRailTypeCrossing(u->tile))) engine_has_power = false; |
97 if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeCrossing(u->tile))) wagon_has_power = false; |
97 if (!HasPowerOnRail(v->u.rail.railtype, GetRailTypeCrossing(u->tile))) wagon_has_power = false; |
98 } else { |
98 } else { |
99 if (!HasPowerOnRail(u->u.rail.railtype, GetRailType(u->tile))) engine_has_power = false; |
99 if (!HasPowerOnRail(u->u.rail.railtype, GetRailType(u->tile))) engine_has_power = false; |
100 if (!HasPowerOnRail(v->u.rail.railtype, GetRailType(u->tile))) wagon_has_power = false; |
100 if (!HasPowerOnRail(v->u.rail.railtype, GetRailType(u->tile))) wagon_has_power = false; |
1527 return v; |
1527 return v; |
1528 } |
1528 } |
1529 |
1529 |
1530 static void DisableTrainCrossing(TileIndex tile) |
1530 static void DisableTrainCrossing(TileIndex tile) |
1531 { |
1531 { |
1532 if (IsTileType(tile, MP_STREET) && |
1532 if (IsLevelCrossingTile(tile) && |
1533 IsLevelCrossing(tile) && |
|
1534 VehicleFromPos(tile, &tile, TestTrainOnCrossing) == NULL && // empty? |
1533 VehicleFromPos(tile, &tile, TestTrainOnCrossing) == NULL && // empty? |
1535 IsCrossingBarred(tile)) { |
1534 IsCrossingBarred(tile)) { |
1536 UnbarCrossing(tile); |
1535 UnbarCrossing(tile); |
1537 MarkTileDirtyByTile(tile); |
1536 MarkTileDirtyByTile(tile); |
1538 } |
1537 } |
3233 ReverseTrainDirection(v); |
3232 ReverseTrainDirection(v); |
3234 return false; |
3233 return false; |
3235 } |
3234 } |
3236 if ((ts &= (ts >> 16)) == 0) { |
3235 if ((ts &= (ts >> 16)) == 0) { |
3237 // make a rail/road crossing red |
3236 // make a rail/road crossing red |
3238 if (IsTileType(tile, MP_STREET) && IsLevelCrossing(tile)) { |
3237 if (IsLevelCrossingTile(tile)) { |
3239 if (!IsCrossingBarred(tile)) { |
3238 if (!IsCrossingBarred(tile)) { |
3240 BarCrossing(tile); |
3239 BarCrossing(tile); |
3241 SndPlayVehicleFx(SND_0E_LEVEL_CROSSING, v); |
3240 SndPlayVehicleFx(SND_0E_LEVEL_CROSSING, v); |
3242 MarkTileDirtyByTile(tile); |
3241 MarkTileDirtyByTile(tile); |
3243 } |
3242 } |