(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:
tron
2006-03-14 12:00:11 +00:00
parent b2412f7472
commit 42d1731cc1
5 changed files with 27 additions and 13 deletions

View File

@@ -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);