bridge_map.h
author tron
Thu, 16 Mar 2006 13:35:35 +0000
changeset 3233 03f24ab40946
parent 3231 eb74c2e361f9
child 3234 986c30171e92
permissions -rw-r--r--
(svn r3906) Before removing a rail/setting the owner of a road to none check if there's a transport route at all under the bridge
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
     1
/* $Id$ */
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
     2
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
     3
#ifndef BRIDGE_MAP_H
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
     4
#define BRIDGE_MAP_H
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
     5
3196
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
     6
#include "direction.h"
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
     7
#include "macros.h"
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
     8
#include "map.h"
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
     9
#include "rail.h"
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
    10
#include "tile.h"
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
    11
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
    12
3214
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    13
static inline bool IsBridgeRamp(TileIndex t)
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    14
{
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    15
	return !HASBIT(_m[t].m5, 6);
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    16
}
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    17
3225
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    18
static inline bool IsBridgeMiddle(TileIndex t)
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    19
{
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    20
	return HASBIT(_m[t].m5, 6);
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    21
}
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    22
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    23
3231
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    24
/**
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    25
 * Determines which piece of a bridge is contained in the current tile
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    26
 * @param tile The tile to analyze
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    27
 * @return the piece
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    28
 */
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    29
static inline uint GetBridgePiece(TileIndex tile)
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    30
{
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    31
	return GB(_m[tile].m2, 0, 4);
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    32
}
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    33
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    34
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    35
/**
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    36
 * Determines the type of bridge on a tile
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    37
 * @param tile The tile to analyze
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    38
 * @return The bridge type
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    39
 */
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    40
static inline uint GetBridgeType(TileIndex tile)
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    41
{
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    42
	return GB(_m[tile].m2, 4, 4);
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    43
}
eb74c2e361f9 (svn r3904) Move GetBridgePiece() and GetBridgeType() to bridge_map.h and make the only place which still extracted that info diretly use the wrapper
tron
parents: 3226
diff changeset
    44
3214
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    45
3196
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    46
/**
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    47
 * Get the direction pointing onto the bridge
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    48
 */
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    49
static inline DiagDirection GetBridgeRampDirection(TileIndex t)
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    50
{
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    51
	/* Heavy wizardry to convert the X/Y (bit 0) + N/S (bit 5) encoding of
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    52
	 * bridges to a DiagDirection
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    53
	 */
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    54
	return (DiagDirection)((6 - (_m[t].m5 >> 4 & 2) - (_m[t].m5 & 1)) % 4);
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    55
}
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    56
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    57
3225
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    58
static inline Axis GetBridgeAxis(TileIndex t)
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    59
{
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    60
	return (Axis)GB(_m[t].m5, 0, 1);
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    61
}
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    62
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    63
3216
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    64
static inline bool IsClearUnderBridge(TileIndex t)
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    65
{
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    66
	return GB(_m[t].m5, 3, 3) == 0;
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    67
}
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    68
3226
6e2613e33234 (svn r3899) Use wrapper functions to make more clear how deleting stuff under bridges works; also remove an unnecessary local variable
tron
parents: 3225
diff changeset
    69
static inline bool IsWaterUnderBridge(TileIndex t)
6e2613e33234 (svn r3899) Use wrapper functions to make more clear how deleting stuff under bridges works; also remove an unnecessary local variable
tron
parents: 3225
diff changeset
    70
{
6e2613e33234 (svn r3899) Use wrapper functions to make more clear how deleting stuff under bridges works; also remove an unnecessary local variable
tron
parents: 3225
diff changeset
    71
	return GB(_m[t].m5, 3, 3) == 1;
6e2613e33234 (svn r3899) Use wrapper functions to make more clear how deleting stuff under bridges works; also remove an unnecessary local variable
tron
parents: 3225
diff changeset
    72
}
6e2613e33234 (svn r3899) Use wrapper functions to make more clear how deleting stuff under bridges works; also remove an unnecessary local variable
tron
parents: 3225
diff changeset
    73
3216
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    74
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    75
static inline bool IsTransportUnderBridge(TileIndex t)
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    76
{
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    77
	return HASBIT(_m[t].m5, 5);
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    78
}
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    79
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    80
static inline TransportType GetTransportTypeUnderBridge(TileIndex t)
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    81
{
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    82
	return (TransportType)GB(_m[t].m5, 3, 2);
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    83
}
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    84
ac69372a0833 (svn r3889) Change a part of the bridge drawing code to make it more comprehensible and add the needed accessors
tron
parents: 3214
diff changeset
    85
3214
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    86
/**
3225
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    87
 * Finds the end of a bridge in the specified direction starting at a middle tile
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    88
 */
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    89
TileIndex GetBridgeEnd(TileIndex, DiagDirection);
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    90
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    91
/**
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    92
 * Finds the southern end of a bridge starting at a middle tile
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    93
 */
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    94
TileIndex GetSouthernBridgeEnd(TileIndex t);
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    95
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    96
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    97
/**
3214
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    98
 * Starting at one bridge end finds the other bridge end
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
    99
 */
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
   100
TileIndex GetOtherBridgeEnd(TileIndex);
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
   101
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
   102
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   103
static inline void SetClearUnderBridge(TileIndex t)
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   104
{
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   105
	SetTileOwner(t, OWNER_NONE);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   106
	SB(_m[t].m5, 3, 3, 0 << 2 | 0);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   107
}
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   108
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   109
static inline void SetWaterUnderBridge(TileIndex t)
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   110
{
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   111
	SetTileOwner(t, OWNER_WATER);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   112
	SB(_m[t].m5, 3, 3, 0 << 2 | 1);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   113
}
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   114
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   115
static inline void SetRailUnderBridge(TileIndex t, Owner o, RailType r)
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   116
{
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   117
	SetTileOwner(t, o);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   118
	SB(_m[t].m5, 3, 3, 1 << 2 | TRANSPORT_RAIL);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   119
	SB(_m[t].m3, 0, 4, r);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   120
}
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   121
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   122
static inline void SetRoadUnderBridge(TileIndex t, Owner o)
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   123
{
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   124
	SetTileOwner(t, o);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   125
	SB(_m[t].m5, 3, 3, 1 << 2 | TRANSPORT_ROAD);
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   126
}
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   127
3209
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   128
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   129
static inline void MakeBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, TransportType tt)
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   130
{
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   131
	uint northsouth = (d == DIAGDIR_NE || d == DIAGDIR_NW);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   132
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   133
	SetTileType(t, MP_TUNNELBRIDGE);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   134
	SetTileOwner(t, o);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   135
	_m[t].m2 = bridgetype << 4;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   136
	_m[t].m4 = 0;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   137
	_m[t].m5 = 1 << 7 | 0 << 6 | northsouth << 5 | tt << 1 | DiagDirToAxis(d);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   138
}
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   139
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   140
static inline void MakeRoadBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d)
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   141
{
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   142
	MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_ROAD);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   143
	_m[t].m3 = 0;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   144
}
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   145
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   146
static inline void MakeRailBridgeRamp(TileIndex t, Owner o, uint bridgetype, DiagDirection d, RailType r)
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   147
{
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   148
	MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   149
	_m[t].m3 = r;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   150
}
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   151
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   152
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   153
static inline void MakeBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a, TransportType tt)
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   154
{
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   155
	SetTileType(t, MP_TUNNELBRIDGE);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   156
	SetTileOwner(t, OWNER_NONE);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   157
	_m[t].m2 = bridgetype << 4 | piece;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   158
	_m[t].m3 = 0;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   159
	_m[t].m4 = 0;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   160
	_m[t].m5 = 1 << 7 | 1 << 6 | 0 << 5 | 0 << 3 | tt << 1 | a;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   161
}
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   162
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   163
static inline void MakeRoadBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a)
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   164
{
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   165
	MakeBridgeMiddle(t, bridgetype, piece, a, TRANSPORT_ROAD);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   166
}
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   167
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   168
static inline void MakeRailBridgeMiddle(TileIndex t, uint bridgetype, uint piece, Axis a, RailType r)
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   169
{
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   170
	MakeBridgeMiddle(t, bridgetype, piece, a, TRANSPORT_RAIL);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   171
	SB(_m[t].m3, 4, 4, r);
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   172
}
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   173
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   174
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   175
#endif