src/bridge_map.h
branchnoai
changeset 9722 ebf0ece7d8f6
parent 9694 e72987579514
child 9723 eee46cb39750
equal deleted inserted replaced
9721:9a27928bcd5e 9722:ebf0ece7d8f6
    20  * @return true if the structure is a bridge one
    20  * @return true if the structure is a bridge one
    21  */
    21  */
    22 static inline bool IsBridge(TileIndex t)
    22 static inline bool IsBridge(TileIndex t)
    23 {
    23 {
    24 	assert(IsTileType(t, MP_TUNNELBRIDGE));
    24 	assert(IsTileType(t, MP_TUNNELBRIDGE));
    25 	return HASBIT(_m[t].m5, 7);
    25 	return HasBit(_m[t].m5, 7);
    26 }
    26 }
    27 
    27 
    28 /**
    28 /**
    29  * checks if there is a bridge on this tile
    29  * checks if there is a bridge on this tile
    30  * @param t The tile to analyze
    30  * @param t The tile to analyze
   124  * @return true if and only if in a snow or desert area
   124  * @return true if and only if in a snow or desert area
   125  */
   125  */
   126 static inline bool HasBridgeSnowOrDesert(TileIndex t)
   126 static inline bool HasBridgeSnowOrDesert(TileIndex t)
   127 {
   127 {
   128 	assert(IsBridgeTile(t));
   128 	assert(IsBridgeTile(t));
   129 	return HASBIT(_m[t].m4, 7);
   129 	return HasBit(_m[t].m4, 7);
   130 }
   130 }
   131 
   131 
   132 
   132 
   133 /**
   133 /**
   134  * Sets whether the bridge ramp lies in a snow or desert area.
   134  * Sets whether the bridge ramp lies in a snow or desert area.
   182  * @pre MayHaveBridgeAbove(t)
   182  * @pre MayHaveBridgeAbove(t)
   183  */
   183  */
   184 static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a)
   184 static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a)
   185 {
   185 {
   186 	assert(MayHaveBridgeAbove(t));
   186 	assert(MayHaveBridgeAbove(t));
   187 	CLRBIT(_m[t].m6, 6 + a);
   187 	ClrBit(_m[t].m6, 6 + a);
   188 }
   188 }
   189 
   189 
   190 
   190 
   191 /**
   191 /**
   192  * Removes bridges from the given, that is bridges along the X and Y axis.
   192  * Removes bridges from the given, that is bridges along the X and Y axis.
   206  * @pre MayHaveBridgeAbove(t)
   206  * @pre MayHaveBridgeAbove(t)
   207  */
   207  */
   208 static inline void SetBridgeMiddle(TileIndex t, Axis a)
   208 static inline void SetBridgeMiddle(TileIndex t, Axis a)
   209 {
   209 {
   210 	assert(MayHaveBridgeAbove(t));
   210 	assert(MayHaveBridgeAbove(t));
   211 	SETBIT(_m[t].m6, 6 + a);
   211 	SetBit(_m[t].m6, 6 + a);
   212 }
   212 }
   213 
   213 
   214 /**
   214 /**
   215  * Generic part to make a bridge ramp for both roads and rails.
   215  * Generic part to make a bridge ramp for both roads and rails.
   216  * @param t          the tile to make a bridge ramp
   216  * @param t          the tile to make a bridge ramp