src/train_cmd.cpp
changeset 8753 33e297b1595d
parent 8752 421a7d8e3aba
child 8754 5dae65402806
equal deleted inserted replaced
8752:421a7d8e3aba 8753:33e297b1595d
  3129 	TrackBits track = v->u.rail.track;
  3129 	TrackBits track = v->u.rail.track;
  3130 	TileIndex tile = v->tile;
  3130 	TileIndex tile = v->tile;
  3131 
  3131 
  3132 	delete v;
  3132 	delete v;
  3133 
  3133 
  3134 	if (track != TRACK_BIT_DEPOT && track != TRACK_BIT_WORMHOLE)
       
  3135 		SetSignalsOnBothDir(tile, (Track)(FIND_FIRST_BIT(track)));
       
  3136 
       
  3137 	/* Check if the wagon was on a road/rail-crossing and disable it if no
  3134 	/* Check if the wagon was on a road/rail-crossing and disable it if no
  3138 	 * others are on it */
  3135 	 * others are on it */
  3139 	DisableTrainCrossing(tile);
  3136 	DisableTrainCrossing(tile);
  3140 
  3137 
  3141 	if (track == TRACK_BIT_WORMHOLE) { // inside a tunnel / bridge
  3138 	/* Update signals */
  3142 		TileIndex endtile = GetOtherTunnelBridgeEnd(tile);
  3139 	if (IsTileType(tile, MP_TUNNELBRIDGE) || IsTileDepotType(tile, TRANSPORT_RAIL)) {
  3143 
       
  3144 		if (GetVehicleTunnelBridge(tile, endtile) != NULL) return; // tunnel / bridge is busy
       
  3145 
       
  3146 		/* v->direction is "random", so it cannot be used to determine the direction of the track */
       
  3147 		UpdateSignalsOnSegment(tile, INVALID_DIAGDIR);
  3140 		UpdateSignalsOnSegment(tile, INVALID_DIAGDIR);
       
  3141 	} else {
       
  3142 		SetSignalsOnBothDir(tile, (Track)(FIND_FIRST_BIT(track)));
  3148 	}
  3143 	}
  3149 }
  3144 }
  3150 
  3145 
  3151 static void ChangeTrainDirRandomly(Vehicle *v)
  3146 static void ChangeTrainDirRandomly(Vehicle *v)
  3152 {
  3147 {