bridge_map.h
author celestar
Fri, 29 Dec 2006 10:13:35 +0000
branchcustombridgeheads
changeset 5592 fd60d4ecc921
parent 5591 8cd83b10634f
child 5596 fdbe3e553294
permissions -rw-r--r--
(svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
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"
3234
986c30171e92 (svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents: 3231
diff changeset
    10
#include "road_map.h"
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
    11
#include "tile.h"
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
    12
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
    13
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    14
void DrawBridgeMiddle(const TileInfo* ti); // XXX
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    15
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    16
5591
8cd83b10634f (svn r7598) [cbh] - Codechange: Remove the functions IsTunnel() and IsBridge() as they are no longer needed.
celestar
parents: 5590
diff changeset
    17
static inline bool IsBridgeTile(TileIndex t)
3234
986c30171e92 (svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents: 3231
diff changeset
    18
{
5590
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
    19
	return IsTileType(t, MP_STREET_BRIDGE) || IsTileType(t, MP_RAILWAY_BRIDGE);
3234
986c30171e92 (svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents: 3231
diff changeset
    20
}
986c30171e92 (svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents: 3231
diff changeset
    21
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    22
static inline bool MayHaveBridgeAbove(TileIndex t)
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
    23
{
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    24
	return
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    25
		IsTileType(t, MP_CLEAR) ||
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    26
		IsTileType(t, MP_RAILWAY) ||
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    27
		IsTileType(t, MP_STREET) ||
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    28
		IsTileType(t, MP_WATER) ||
5590
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
    29
		IsTileType(t, MP_TUNNEL) ||
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
    30
		IsTileType(t, MP_STREET_BRIDGE) ||
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
    31
		IsTileType(t, MP_RAILWAY_BRIDGE) ||
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    32
		IsTileType(t, MP_UNMOVABLE);
3225
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    33
}
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    34
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    35
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    36
static inline bool IsBridgeAbove(TileIndex t)
3933
a5f08e17f4a0 (svn r5070) Merged the bridge branch
celestar
parents: 3466
diff changeset
    37
{
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    38
	assert(MayHaveBridgeAbove(t));
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    39
	return GB(_m[t].extra, 6, 2) != 0;
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
    40
}
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
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
 * 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
    45
 * @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
    46
 * @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
    47
 */
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3355
diff changeset
    48
static inline uint GetBridgeType(TileIndex t)
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
    49
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3355
diff changeset
    50
	assert(IsBridgeTile(t));
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3355
diff changeset
    51
	return GB(_m[t].m2, 4, 4);
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
    52
}
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
    53
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
    54
3196
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
 * Get the direction pointing onto the bridge
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    57
 */
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    58
static inline DiagDirection GetBridgeRampDirection(TileIndex t)
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    59
{
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    60
	assert(IsBridgeTile(t));
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    61
	return (DiagDirection)GB(_m[t].m5, 0, 2);
3196
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    62
}
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    63
29717e930f9a (svn r3857) Add and use GetBridgeRampDirection()
tron
parents: 3189
diff changeset
    64
3225
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    65
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
    66
{
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    67
	assert(IsBridgeAbove(t));
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
    68
	return (Axis)(GB(_m[t].extra, 6, 2) - 1);
3225
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    69
}
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    70
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    71
3234
986c30171e92 (svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents: 3231
diff changeset
    72
static inline TransportType GetBridgeTransportType(TileIndex t)
986c30171e92 (svn r3907) Replace many bridge related direct map accesses with calls to shiny new functions and mark some strange constructs with XXX
tron
parents: 3231
diff changeset
    73
{
3369
00c2ca209a89 (svn r4166) Sprinkle several map accessors with assert()s
tron
parents: 3355
diff changeset
    74
	assert(IsBridgeTile(t));
5590
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
    75
	if (IsTileType(t, MP_STREET_BRIDGE)) return TRANSPORT_ROAD;
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
    76
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
    77
	return TRANSPORT_RAIL;
3977
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3953
diff changeset
    78
}
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3953
diff changeset
    79
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3953
diff changeset
    80
5592
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    81
static inline bool HasBridgeSnowOrDesert(TileIndex t)
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    82
{
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    83
	assert(IsBridgeTile(t));
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    84
	return HASBIT(_m[t].m4, 7);
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    85
}
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    86
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    87
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    88
static inline void SetBridgeSnowOrDesert(TileIndex t, bool snow_or_desert)
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    89
{
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    90
	assert(IsBridgeTile(t));
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    91
	SB(_m[t].m4, 7, 1, snow_or_desert);
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    92
}
fd60d4ecc921 (svn r7608) [cbh] - Merge with trunk r7593:7607 because I need 7607 here
celestar
parents: 5591
diff changeset
    93
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
    94
/**
3225
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    95
 * 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
    96
 */
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    97
TileIndex GetBridgeEnd(TileIndex, DiagDirection);
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    98
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
    99
/**
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   100
 * Finds the northern end of a bridge starting at a middle tile
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   101
 */
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   102
TileIndex GetNorthernBridgeEnd(TileIndex t);
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   103
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   104
/**
3225
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
   105
 * 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
   106
 */
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
   107
TileIndex GetSouthernBridgeEnd(TileIndex t);
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
   108
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
   109
655763f3861c (svn r3898) Add functions to find a bridge end starting at a middle tile
tron
parents: 3216
diff changeset
   110
/**
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
   111
 * 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
   112
 */
172b409bf612 (svn r3887) Add a function to get the other bridge end when you're at a bridge ramp
tron
parents: 3209
diff changeset
   113
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
   114
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   115
uint GetBridgeHeight(TileIndex tile);
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   116
uint GetBridgeFoundation(Slope tileh, Axis axis);
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
   117
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   118
static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a)
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   119
{
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   120
	assert(MayHaveBridgeAbove(t));
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   121
	CLRBIT(_m[t].extra, 6 + a);
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   122
}
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   123
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   124
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   125
static inline void ClearBridgeMiddle(TileIndex t)
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   126
{
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   127
	ClearSingleBridgeMiddle(t, AXIS_X);
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   128
	ClearSingleBridgeMiddle(t, AXIS_Y);
3977
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3953
diff changeset
   129
}
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3953
diff changeset
   130
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   131
static inline void SetBridgeMiddle(TileIndex t, Axis a)
3977
edb5b94e2094 (svn r5155) - Remove the bridge branch merge (revision r5070)
tron
parents: 3953
diff changeset
   132
{
5573
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   133
	assert(MayHaveBridgeAbove(t));
afa6f92a71fd (svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents: 4666
diff changeset
   134
	SETBIT(_m[t].extra, 6 + a);
3189
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   135
}
1af302c5abd0 (svn r3846) Add functions to set the type of stuff (clear, water, rail, road) under bridges
tron
parents:
diff changeset
   136
3209
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   137
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   138
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
   139
{
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   140
	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
   141
	_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
   142
	_m[t].m4 = 0;
5590
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
   143
	_m[t].m5 = d;
3209
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 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
   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_ROAD);
5590
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
   149
	SetTileType(t, MP_STREET_BRIDGE);
3209
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   150
	_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
   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 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
   154
{
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   155
	MakeBridgeRamp(t, o, bridgetype, d, TRANSPORT_RAIL);
5590
dc34c43fc3eb (svn r7597) [cbh] - Codechange: Remove MP_TUNNELBRIDGE and introduce three new TileTypes: MP_TUNNEL, MP_STREET_BRIDGE, MP_RAILWAY_BRIDGE
celestar
parents: 5573
diff changeset
   156
	SetTileType(t, MP_RAILWAY_BRIDGE);
3209
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].m3 = r;
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   158
}
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   159
e0b7d48351a3 (svn r3877) Add functions to turn a tile into a rail/road bridge ramp/middle part
tron
parents: 3196
diff changeset
   160
4666
850b5b6e4bac (svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents: 4158
diff changeset
   161
#endif /* BRIDGE_MAP_H */