src/road_map.h
branchnoai
changeset 9826 9707ad4c9b60
parent 9732 f8eb3e208514
child 10455 22c441f5adf9
--- a/src/road_map.h	Thu Mar 27 05:15:06 2008 +0000
+++ b/src/road_map.h	Fri Mar 28 10:32:55 2008 +0000
@@ -65,6 +65,26 @@
 	}
 }
 
+/**
+ * Get all RoadBits set on a tile except from the given RoadType
+ *
+ * @param t The tile from which we want to get the RoadBits
+ * @param rt The RoadType which we exclude from the querry
+ * @return all set RoadBits of the tile which are not from the given RoadType
+ */
+static inline RoadBits GetOtherRoadBits(TileIndex t, RoadType rt)
+{
+	return ((rt == ROADTYPE_ROAD) ? ROAD_NONE : GetRoadBits(t, ROADTYPE_ROAD)) |
+		((rt == ROADTYPE_TRAM) ? ROAD_NONE : GetRoadBits(t, ROADTYPE_TRAM)) |
+		((rt == ROADTYPE_HWAY) ? ROAD_NONE : GetRoadBits(t, ROADTYPE_HWAY));
+}
+
+/**
+ * Get all set RoadBits on the given tile
+ *
+ * @param tile The tile from which we want to get the RoadBits
+ * @return all set RoadBits of the tile
+ */
 static inline RoadBits GetAllRoadBits(TileIndex tile)
 {
 	return GetRoadBits(tile, ROADTYPE_ROAD) | GetRoadBits(tile, ROADTYPE_TRAM) | GetRoadBits(tile, ROADTYPE_HWAY);
@@ -328,11 +348,16 @@
  * - road tunnels: entrance is treated as road piece
  * - bridge ramps: start of the ramp is treated as road piece
  * - bridge middle parts: bridge itself is ignored
+ *
+ * If straight_tunnel_bridge_entrance is set a ROAD_X or ROAD_Y
+ * for bridge ramps and tunnel entrances is returned depending
+ * on the orientation of the tunnel or bridge.
  * @param tile the tile to get the road bits for
  * @param rt   the road type to get the road bits form
+ * @param stbe whether to return straight road bits for tunnels/bridges.
  * @return the road bits of the given tile
  */
-RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt);
+RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance = false);
 
 /**
  * Get the accessible track bits for the given tile.