forked from mirror/OpenTTD
(svn r3857) Add and use GetBridgeRampDirection()
Note: This slightly changes the behavior of GetAnyRoadBits() to only return a road piece for the start of the bridge ramp instead of a full ROAD_[XY]
This commit is contained in:
13
bridge_map.h
13
bridge_map.h
@@ -3,12 +3,25 @@
|
||||
#ifndef BRIDGE_MAP_H
|
||||
#define BRIDGE_MAP_H
|
||||
|
||||
#include "direction.h"
|
||||
#include "macros.h"
|
||||
#include "map.h"
|
||||
#include "rail.h"
|
||||
#include "tile.h"
|
||||
|
||||
|
||||
/**
|
||||
* Get the direction pointing onto the bridge
|
||||
*/
|
||||
static inline DiagDirection GetBridgeRampDirection(TileIndex t)
|
||||
{
|
||||
/* Heavy wizardry to convert the X/Y (bit 0) + N/S (bit 5) encoding of
|
||||
* bridges to a DiagDirection
|
||||
*/
|
||||
return (DiagDirection)((6 - (_m[t].m5 >> 4 & 2) - (_m[t].m5 & 1)) % 4);
|
||||
}
|
||||
|
||||
|
||||
static inline void SetClearUnderBridge(TileIndex t)
|
||||
{
|
||||
SetTileOwner(t, OWNER_NONE);
|
||||
|
Reference in New Issue
Block a user