Changeset - r14899:98b2af7e18b1
[Not reviewed]
master
0 3 0
frosch - 14 years ago 2010-03-23 20:29:52
frosch@openttd.org
(svn r19506) -Fix: Tunnels, bridges and roadstops are build with only one roadtype.
3 files changed with 3 insertions and 13 deletions:
0 comments (0 inline, 0 general)
src/road_func.h
Show inline comments
 
@@ -26,22 +26,12 @@
 
static inline bool IsValidRoadType(RoadType rt)
 
{
 
	return rt == ROADTYPE_ROAD || rt == ROADTYPE_TRAM;
 
}
 

	
 
/**
 
 * Are the given bits pointing to valid roadtypes?
 
 * @param rts the roadtypes to check for validness
 
 * @return true if and only if valid
 
 */
 
static inline bool AreValidRoadTypes(RoadTypes rts)
 
{
 
	return HasBit(rts, ROADTYPE_ROAD) || HasBit(rts, ROADTYPE_TRAM);
 
}
 

	
 
/**
 
 * Maps a RoadType to the corresponding RoadTypes value
 
 *
 
 * @param rt the roadtype to get the roadtypes from
 
 * @return the roadtypes with the given roadtype
 
 */
 
static inline RoadTypes RoadTypeToRoadTypes(RoadType rt)
src/station_cmd.cpp
Show inline comments
 
@@ -1694,13 +1694,13 @@ CommandCost CmdBuildRoadStop(TileIndex t
 
	if (!IsValidTile(tile) || TileAddWrap(tile, width - 1, lenght - 1) == INVALID_TILE) return CMD_ERROR;
 

	
 
	TileArea roadstop_area(tile, width, lenght);
 

	
 
	if (distant_join && (!_settings_game.station.distant_join_stations || !Station::IsValidID(station_to_join))) return CMD_ERROR;
 

	
 
	if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_company, rts)) return CMD_ERROR;
 
	if (!HasExactlyOneBit(rts) || !HasRoadTypesAvail(_current_company, rts)) return CMD_ERROR;
 

	
 
	/* Trams only have drive through stops */
 
	if (!is_drive_through && HasBit(rts, ROADTYPE_TRAM)) return CMD_ERROR;
 

	
 
	DiagDirection ddir = (DiagDirection)GB(p2, 6, 2);
 

	
src/tunnelbridge_cmd.cpp
Show inline comments
 
@@ -204,13 +204,13 @@ CommandCost CmdBuildBridge(TileIndex end
 
	TransportType transport_type = (TransportType)GB(p2, 15, 2);
 

	
 
	/* type of bridge */
 
	switch (transport_type) {
 
		case TRANSPORT_ROAD:
 
			roadtypes = (RoadTypes)GB(p2, 8, 2);
 
			if (!AreValidRoadTypes(roadtypes) || !HasRoadTypesAvail(_current_company, roadtypes)) return CMD_ERROR;
 
			if (!HasExactlyOneBit(roadtypes) || !HasRoadTypesAvail(_current_company, roadtypes)) return CMD_ERROR;
 
			break;
 

	
 
		case TRANSPORT_RAIL:
 
			railtype = (RailType)GB(p2, 8, 7);
 
			if (!ValParamRailtype(railtype)) return CMD_ERROR;
 
			break;
 
@@ -484,13 +484,13 @@ CommandCost CmdBuildTunnel(TileIndex sta
 

	
 
	_build_tunnel_endtile = 0;
 
	if (transport_type == TRANSPORT_RAIL) {
 
		if (!ValParamRailtype((RailType)p1)) return CMD_ERROR;
 
	} else {
 
		const RoadTypes rts = (RoadTypes)GB(p1, 0, 2);
 
		if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_company, rts)) return CMD_ERROR;
 
		if (!HasExactlyOneBit(rts) || !HasRoadTypesAvail(_current_company, rts)) return CMD_ERROR;
 
	}
 

	
 
	uint start_z;
 
	uint end_z;
 
	Slope start_tileh = GetTileSlope(start_tile, &start_z);
 
	DiagDirection direction = GetInclinedSlopeDirection(start_tileh);
0 comments (0 inline, 0 general)