Changeset - r9952:9c0d3f3bcba8
[Not reviewed]
master
0 1 0
smatz - 16 years ago 2008-08-20 15:21:03
smatz@openttd.org
(svn r14107) -Codechange: marking reserved tile dirty twice (and even when patch option is off) is not needed
1 file changed with 0 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/pbs.cpp
Show inline comments
 
@@ -71,67 +71,65 @@ void SetRailwayStationPlatformReservatio
 
	} while (IsCompatibleTrainStationTile(tile, start));
 
}
 

	
 
/**
 
 * Try to reserve a specific track on a tile
 
 * @param tile the tile
 
 * @param t the track
 
 * @return true if reservation was successfull, i.e. the track was
 
 *     free and didn't cross any other reserved tracks.
 
 */
 
bool TryReserveRailTrack(TileIndex tile, Track t)
 
{
 
	assert((GetTileTrackStatus(tile, TRANSPORT_RAIL, 0) & TrackToTrackBits(t)) != 0);
 

	
 
	if (_settings_client.gui.show_track_reservation) {
 
		MarkTileDirtyByTile(tile);
 
	}
 

	
 
	switch (GetTileType(tile)) {
 
		case MP_RAILWAY:
 
			if (IsPlainRailTile(tile)) return TryReserveTrack(tile, t);
 
			if (IsRailWaypoint(tile) || IsRailDepot(tile)) {
 
				if (!GetDepotWaypointReservation(tile)) {
 
					SetDepotWaypointReservation(tile, true);
 
					MarkTileDirtyByTile(tile);
 
					return true;
 
				}
 
			}
 
			break;
 

	
 
		case MP_ROAD:
 
			if (IsLevelCrossing(tile) && !GetCrossingReservation(tile)) {
 
				SetCrossingReservation(tile, true);
 
				BarCrossing(tile);
 
				MarkTileDirtyByTile(tile);
 
				return true;
 
			}
 
			break;
 

	
 
		case MP_STATION:
 
			if (IsRailwayStation(tile) && !GetRailwayStationReservation(tile)) {
 
				SetRailwayStationReservation(tile, true);
 
				MarkTileDirtyByTile(tile);
 
				return true;
 
			}
 
			break;
 

	
 
		case MP_TUNNELBRIDGE:
 
			if (GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL && !GetRailTunnelBridgeReservation(tile)) {
 
				SetTunnelBridgeReservation(tile, true);
 
				return true;
 
			}
 
			break;
 

	
 
		default:
 
			break;
 
	}
 
	return false;
 
}
 

	
 
/**
 
 * Lift the reservation of a specific track on a tile
 
 * @param tile the tile
 
 * @param t the track
 
 */
 
 void UnreserveRailTrack(TileIndex tile, Track t)
 
{
0 comments (0 inline, 0 general)