(svn r5101) Add a function to convert an axis and a flag for north/south into a DiagDirection. Use it for bridge ramps and ship depots

This commit is contained in:
tron
2006-06-04 16:04:15 +00:00
parent 479317b1eb
commit fa74002356
5 changed files with 23 additions and 19 deletions

View File

@@ -78,10 +78,7 @@ static inline uint GetBridgeType(TileIndex t)
*/
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);
return ReverseDiagDir(XYNSToDiagDir((Axis)GB(_m[t].m5, 0, 1), GB(_m[t].m5, 5, 1)));
}