From f45e579923773e05dfc5a35915eee81f6da50914 Mon Sep 17 00:00:00 2001 From: frosch Date: Tue, 23 Mar 2010 20:29:52 +0000 Subject: (svn r19506) -Fix: Tunnels, bridges and roadstops are build with only one roadtype. --- src/road_func.h | 10 ---------- src/station_cmd.cpp | 2 +- src/tunnelbridge_cmd.cpp | 4 ++-- 3 files changed, 3 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/road_func.h b/src/road_func.h index 151ae4e9f..7303ebff3 100644 --- a/src/road_func.h +++ b/src/road_func.h @@ -28,16 +28,6 @@ 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 * diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index b871b49cd..9e3e70cfa 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1697,7 +1697,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin 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; diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index be686c05c..4bfbf9b1b 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -207,7 +207,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u 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: @@ -487,7 +487,7 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, 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; -- cgit v1.2.3-70-g09d2