author | rubidium |
Thu, 18 Dec 2008 12:23:08 +0000 | |
changeset 10436 | 8d3a9fbe8f19 |
parent 10340 | a4757ae623ca |
permissions | -rw-r--r-- |
3069
9a1fd047b595
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
1 |
/* $Id$ */ |
9a1fd047b595
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
2 |
|
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8744
diff
changeset
|
3 |
/** @file road_map.h Map accessors for roads. */ |
6393
e1e4939d19b5
(svn r9523) -Cleanup: doxygen changes. Time to take care of "R"
belugas
parents:
6390
diff
changeset
|
4 |
|
3145
e833d7a78887
(svn r3765) Fix some naming glitches in r3763 and add missing svn properties
tron
parents:
3144
diff
changeset
|
5 |
#ifndef ROAD_MAP_H |
e833d7a78887
(svn r3765) Fix some naming glitches in r3763 and add missing svn properties
tron
parents:
3144
diff
changeset
|
6 |
#define ROAD_MAP_H |
3069
9a1fd047b595
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
7 |
|
8101
d5357bde8cab
(svn r11662) -Codechange: move some rail types/related functions around.
rubidium
parents:
7932
diff
changeset
|
8 |
#include "track_func.h" |
d5357bde8cab
(svn r11662) -Codechange: move some rail types/related functions around.
rubidium
parents:
7932
diff
changeset
|
9 |
#include "rail_type.h" |
8213
7bdd7593eb9b
(svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents:
8113
diff
changeset
|
10 |
#include "town_type.h" |
8102
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
11 |
#include "road_func.h" |
8108
b42a0e5c67ef
(svn r11669) -Codechange: refactor tile.h -> tile_type.h and tile_map.h
rubidium
parents:
8102
diff
changeset
|
12 |
#include "tile_map.h" |
3069
9a1fd047b595
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
13 |
|
3146
8d95593c5ff0
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
14 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6172
diff
changeset
|
15 |
enum RoadTileType { |
3793
7fe24e10ea63
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
16 |
ROAD_TILE_NORMAL, |
7fe24e10ea63
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
17 |
ROAD_TILE_CROSSING, |
7fe24e10ea63
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
18 |
ROAD_TILE_DEPOT |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6172
diff
changeset
|
19 |
}; |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
20 |
|
3793
7fe24e10ea63
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
21 |
static inline RoadTileType GetRoadTileType(TileIndex t) |
8529
93d4dea423e5
(svn r12104) -Fix (r12103): remember loading indicators transparency settings and make in switchable by Ctrl+9
smatz
parents:
8344
diff
changeset
|
22 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
23 |
assert(IsTileType(t, MP_ROAD)); |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
24 |
return (RoadTileType)GB(_m[t].m5, 6, 2); |
3150
729951cb5448
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
25 |
} |
729951cb5448
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
26 |
|
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
27 |
static inline bool IsNormalRoad(TileIndex t) |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
28 |
{ |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
29 |
return GetRoadTileType(t) == ROAD_TILE_NORMAL; |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
30 |
} |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
31 |
|
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
32 |
static inline bool IsNormalRoadTile(TileIndex t) |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
33 |
{ |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
34 |
return IsTileType(t, MP_ROAD) && IsNormalRoad(t); |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
35 |
} |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
36 |
|
3497
154080838ed1
(svn r4348) Move IsLevelCrossing() from rail.h to road_map.h
tron
parents:
3430
diff
changeset
|
37 |
static inline bool IsLevelCrossing(TileIndex t) |
154080838ed1
(svn r4348) Move IsLevelCrossing() from rail.h to road_map.h
tron
parents:
3430
diff
changeset
|
38 |
{ |
3793
7fe24e10ea63
(svn r4789) - Codechange: rename RoadType to RoadTileType and ROAD_{NORMAL,CROSSING,DEPOT} to ROAD_TILE_* for consistency
rubidium
parents:
3560
diff
changeset
|
39 |
return GetRoadTileType(t) == ROAD_TILE_CROSSING; |
3497
154080838ed1
(svn r4348) Move IsLevelCrossing() from rail.h to road_map.h
tron
parents:
3430
diff
changeset
|
40 |
} |
154080838ed1
(svn r4348) Move IsLevelCrossing() from rail.h to road_map.h
tron
parents:
3430
diff
changeset
|
41 |
|
3560
b2fcf1898eec
(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.
Darkvater
parents:
3518
diff
changeset
|
42 |
static inline bool IsLevelCrossingTile(TileIndex t) |
b2fcf1898eec
(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.
Darkvater
parents:
3518
diff
changeset
|
43 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
44 |
return IsTileType(t, MP_ROAD) && IsLevelCrossing(t); |
3560
b2fcf1898eec
(svn r4435) - Fix: an assertion triggered when trying to remove a bridge with the remove-tool (r4348 surfaced this). In CmdRemoveRoad tiletype was not checked for ownership. Intorudce IsLevelCrossingTile() which checks if a tile is a crossing without knowing the type. Suggested by peter1138 and Tron.
Darkvater
parents:
3518
diff
changeset
|
45 |
} |
3150
729951cb5448
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
46 |
|
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
47 |
static inline bool IsRoadDepot(TileIndex t) |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
48 |
{ |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
49 |
return GetRoadTileType(t) == ROAD_TILE_DEPOT; |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
50 |
} |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
51 |
|
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
52 |
static inline bool IsRoadDepotTile(TileIndex t) |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
53 |
{ |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
54 |
return IsTileType(t, MP_ROAD) && IsRoadDepot(t); |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
55 |
} |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
56 |
|
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
57 |
static inline RoadBits GetRoadBits(TileIndex t, RoadType rt) |
3272
b3e2d8e19937
(svn r3984) Add a function to get the road axis of a level crossing
tron
parents:
3196
diff
changeset
|
58 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
59 |
assert(IsNormalRoad(t)); |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
60 |
switch (rt) { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
61 |
default: NOT_REACHED(); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
62 |
case ROADTYPE_ROAD: return (RoadBits)GB(_m[t].m4, 0, 4); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
63 |
case ROADTYPE_TRAM: return (RoadBits)GB(_m[t].m4, 4, 4); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
64 |
case ROADTYPE_HWAY: return (RoadBits)GB(_m[t].m6, 2, 4); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
65 |
} |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
66 |
} |
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
67 |
|
8734
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
68 |
/** |
8744
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
69 |
* Get all RoadBits set on a tile except from the given RoadType |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
70 |
* |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
71 |
* @param t The tile from which we want to get the RoadBits |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
72 |
* @param rt The RoadType which we exclude from the querry |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
73 |
* @return all set RoadBits of the tile which are not from the given RoadType |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
74 |
*/ |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
75 |
static inline RoadBits GetOtherRoadBits(TileIndex t, RoadType rt) |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
76 |
{ |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
77 |
return ((rt == ROADTYPE_ROAD) ? ROAD_NONE : GetRoadBits(t, ROADTYPE_ROAD)) | |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
78 |
((rt == ROADTYPE_TRAM) ? ROAD_NONE : GetRoadBits(t, ROADTYPE_TRAM)) | |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
79 |
((rt == ROADTYPE_HWAY) ? ROAD_NONE : GetRoadBits(t, ROADTYPE_HWAY)); |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
80 |
} |
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
81 |
|
099f75f4b51f
(svn r12440) -Fix [FS#1694]: Make the road building and road removing conditions more union
skidd13
parents:
8734
diff
changeset
|
82 |
/** |
8734
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
83 |
* Get all set RoadBits on the given tile |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
84 |
* |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
85 |
* @param tile The tile from which we want to get the RoadBits |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
86 |
* @return all set RoadBits of the tile |
cf2c240d2e1b
(svn r12419) -Cleanup: of the internal road-piece building and removing.
skidd13
parents:
8716
diff
changeset
|
87 |
*/ |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
88 |
static inline RoadBits GetAllRoadBits(TileIndex tile) |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
89 |
{ |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
90 |
return GetRoadBits(tile, ROADTYPE_ROAD) | GetRoadBits(tile, ROADTYPE_TRAM) | GetRoadBits(tile, ROADTYPE_HWAY); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
91 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
92 |
|
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
93 |
static inline void SetRoadBits(TileIndex t, RoadBits r, RoadType rt) |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
94 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
95 |
assert(IsNormalRoad(t)); // XXX incomplete |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
96 |
switch (rt) { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
97 |
default: NOT_REACHED(); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
98 |
case ROADTYPE_ROAD: SB(_m[t].m4, 0, 4, r); break; |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
99 |
case ROADTYPE_TRAM: SB(_m[t].m4, 4, 4, r); break; |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
100 |
case ROADTYPE_HWAY: SB(_m[t].m6, 2, 4, r); break; |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
101 |
} |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
102 |
} |
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
103 |
|
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
104 |
static inline RoadTypes GetRoadTypes(TileIndex t) |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
105 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
106 |
if (IsTileType(t, MP_ROAD)) { |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
107 |
return (RoadTypes)GB(_me[t].m7, 5, 3); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
108 |
} else { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
109 |
return (RoadTypes)GB(_m[t].m3, 0, 3); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
110 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
111 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
112 |
|
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
113 |
static inline void SetRoadTypes(TileIndex t, RoadTypes rt) |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
114 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
115 |
if (IsTileType(t, MP_ROAD)) { |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
116 |
SB(_me[t].m7, 5, 3, rt); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
117 |
} else { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
118 |
assert(IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE)); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
119 |
SB(_m[t].m3, 0, 2, rt); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
120 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
121 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
122 |
|
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
123 |
static inline bool HasTileRoadType(TileIndex t, RoadType rt) |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
124 |
{ |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
125 |
return HasBit(GetRoadTypes(t), rt); |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
126 |
} |
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
127 |
|
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
128 |
static inline Owner GetRoadOwner(TileIndex t, RoadType rt) |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
129 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
130 |
if (!IsTileType(t, MP_ROAD)) return GetTileOwner(t); |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
131 |
|
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
132 |
switch (GetRoadTileType(t)) { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
133 |
default: NOT_REACHED(); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
134 |
case ROAD_TILE_NORMAL: |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
135 |
switch (rt) { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
136 |
default: NOT_REACHED(); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
137 |
case ROADTYPE_ROAD: return (Owner)GB( _m[t].m1, 0, 5); |
6764
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
138 |
case ROADTYPE_TRAM: { |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
139 |
/* Trams don't need OWNER_TOWN, and remapping OWNER_NONE |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
140 |
* to OWNER_TOWN makes it use one bit less */ |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
141 |
Owner o = (Owner)GB( _m[t].m5, 0, 4); |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
142 |
return o == OWNER_TOWN ? OWNER_NONE : o; |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
143 |
} |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
144 |
case ROADTYPE_HWAY: return (Owner)GB(_me[t].m7, 0, 5); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
145 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
146 |
case ROAD_TILE_CROSSING: |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
147 |
switch (rt) { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
148 |
default: NOT_REACHED(); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
149 |
case ROADTYPE_ROAD: return (Owner)GB( _m[t].m4, 0, 5); |
6764
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
150 |
case ROADTYPE_TRAM: { |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
151 |
/* Trams don't need OWNER_TOWN, and remapping OWNER_NONE |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
152 |
* to OWNER_TOWN makes it use one bit less */ |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
153 |
Owner o = (Owner)GB( _m[t].m5, 0, 4); |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
154 |
return o == OWNER_TOWN ? OWNER_NONE : o; |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
155 |
} |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
156 |
case ROADTYPE_HWAY: return (Owner)GB(_me[t].m7, 0, 5); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
157 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
158 |
case ROAD_TILE_DEPOT: return GetTileOwner(t); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
159 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
160 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
161 |
|
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
162 |
static inline void SetRoadOwner(TileIndex t, RoadType rt, Owner o) |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
163 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
164 |
if (!IsTileType(t, MP_ROAD)) return SetTileOwner(t, o); |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
165 |
|
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
166 |
switch (GetRoadTileType(t)) { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
167 |
default: NOT_REACHED(); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
168 |
case ROAD_TILE_NORMAL: |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
169 |
switch (rt) { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
170 |
default: NOT_REACHED(); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
171 |
case ROADTYPE_ROAD: SB( _m[t].m1, 0, 5, o); break; |
6764
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
172 |
case ROADTYPE_TRAM: SB( _m[t].m5, 0, 4, o == OWNER_NONE ? OWNER_TOWN : o); break; |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
173 |
case ROADTYPE_HWAY: SB(_me[t].m7, 0, 5, o); break; |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
174 |
} |
6662
ea30b3497d9a
(svn r9893) -Fix (r9892): various small bugs that only act up when using something different than plain roads.
rubidium
parents:
6661
diff
changeset
|
175 |
break; |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
176 |
case ROAD_TILE_CROSSING: |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
177 |
switch (rt) { |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
178 |
default: NOT_REACHED(); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
179 |
case ROADTYPE_ROAD: SB( _m[t].m4, 0, 5, o); break; |
6764
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
180 |
/* Trams don't need OWNER_TOWN, and remapping OWNER_NONE |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
181 |
* to OWNER_TOWN makes it use one bit less */ |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
182 |
case ROADTYPE_TRAM: SB( _m[t].m5, 0, 4, o == OWNER_NONE ? OWNER_TOWN : o); break; |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
183 |
case ROADTYPE_HWAY: SB(_me[t].m7, 0, 5, o); break; |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
184 |
} |
6662
ea30b3497d9a
(svn r9893) -Fix (r9892): various small bugs that only act up when using something different than plain roads.
rubidium
parents:
6661
diff
changeset
|
185 |
break; |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
186 |
case ROAD_TILE_DEPOT: return SetTileOwner(t, o); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
187 |
} |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
188 |
} |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
189 |
|
9341
bd60c3b2d1e0
(svn r13233) -Fix: Replace some (incorrect) evaluations of TileOwner by RoadOwner.
frosch
parents:
9111
diff
changeset
|
190 |
static inline bool IsRoadOwner(TileIndex t, RoadType rt, Owner o) |
bd60c3b2d1e0
(svn r13233) -Fix: Replace some (incorrect) evaluations of TileOwner by RoadOwner.
frosch
parents:
9111
diff
changeset
|
191 |
{ |
10340
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
192 |
assert(HasTileRoadType(t, rt)); |
9341
bd60c3b2d1e0
(svn r13233) -Fix: Replace some (incorrect) evaluations of TileOwner by RoadOwner.
frosch
parents:
9111
diff
changeset
|
193 |
return (GetRoadOwner(t, rt) == o); |
bd60c3b2d1e0
(svn r13233) -Fix: Replace some (incorrect) evaluations of TileOwner by RoadOwner.
frosch
parents:
9111
diff
changeset
|
194 |
} |
bd60c3b2d1e0
(svn r13233) -Fix: Replace some (incorrect) evaluations of TileOwner by RoadOwner.
frosch
parents:
9111
diff
changeset
|
195 |
|
10340
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
196 |
/** Checks if given tile has town owned road |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
197 |
* @param t tile to check |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
198 |
* @return true iff tile has road and the road is owned by a town |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
199 |
* @pre IsTileType(t, MP_ROAD) |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
200 |
*/ |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
201 |
static inline bool HasTownOwnedRoad(TileIndex t) |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
202 |
{ |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
203 |
assert(IsTileType(t, MP_ROAD)); |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
204 |
return HasTileRoadType(t, ROADTYPE_ROAD) && IsRoadOwner(t, ROADTYPE_ROAD, OWNER_TOWN); |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
205 |
} |
a4757ae623ca
(svn r14591) -Fix [FS#2388](r14528): cached nearest town could be invalid after importing older savegame and during town generation
smatz
parents:
10289
diff
changeset
|
206 |
|
6764
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
207 |
/** Which directions are disallowed ? */ |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
208 |
enum DisallowedRoadDirections { |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
209 |
DRD_NONE, ///< None of the directions are disallowed |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
210 |
DRD_SOUTHBOUND, ///< All southbound traffic is disallowed |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
211 |
DRD_NORTHBOUND, ///< All northbound traffic is disallowed |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
212 |
DRD_BOTH, ///< All directions are disallowed |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
213 |
DRD_END |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
214 |
}; |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
215 |
DECLARE_ENUM_AS_BIT_SET(DisallowedRoadDirections); |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
216 |
|
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
217 |
/** |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
218 |
* Gets the disallowed directions |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
219 |
* @param t the tile to get the directions from |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
220 |
* @return the disallowed directions |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
221 |
*/ |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
222 |
static inline DisallowedRoadDirections GetDisallowedRoadDirections(TileIndex t) |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
223 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
224 |
assert(IsNormalRoad(t)); |
6764
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
225 |
return (DisallowedRoadDirections)GB(_m[t].m5, 4, 2); |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
226 |
} |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
227 |
|
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
228 |
/** |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
229 |
* Sets the disallowed directions |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
230 |
* @param t the tile to set the directions for |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
231 |
* @param drd the disallowed directions |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
232 |
*/ |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
233 |
static inline void SetDisallowedRoadDirections(TileIndex t, DisallowedRoadDirections drd) |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
234 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
235 |
assert(IsNormalRoad(t)); |
6764
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
236 |
assert(drd < DRD_END); |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
237 |
SB(_m[t].m5, 4, 2, drd); |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
238 |
} |
d09d8d618a07
(svn r9999) -Feature: make it possible to disallow busses and lorries to go a specific way on straight pieces of road.
rubidium
parents:
6662
diff
changeset
|
239 |
|
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
240 |
static inline Axis GetCrossingRoadAxis(TileIndex t) |
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
241 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
242 |
assert(IsLevelCrossing(t)); |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
243 |
return (Axis)GB(_m[t].m4, 6, 1); |
3272
b3e2d8e19937
(svn r3984) Add a function to get the road axis of a level crossing
tron
parents:
3196
diff
changeset
|
244 |
} |
b3e2d8e19937
(svn r3984) Add a function to get the road axis of a level crossing
tron
parents:
3196
diff
changeset
|
245 |
|
8598
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
246 |
static inline Axis GetCrossingRailAxis(TileIndex t) |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
247 |
{ |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
248 |
assert(IsLevelCrossing(t)); |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
249 |
return OtherAxis((Axis)GetCrossingRoadAxis(t)); |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
250 |
} |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
251 |
|
3070
980529af506f
(svn r3659) Add function to get the road bits of a level crossing
tron
parents:
3069
diff
changeset
|
252 |
static inline RoadBits GetCrossingRoadBits(TileIndex tile) |
980529af506f
(svn r3659) Add function to get the road bits of a level crossing
tron
parents:
3069
diff
changeset
|
253 |
{ |
3272
b3e2d8e19937
(svn r3984) Add a function to get the road axis of a level crossing
tron
parents:
3196
diff
changeset
|
254 |
return GetCrossingRoadAxis(tile) == AXIS_X ? ROAD_X : ROAD_Y; |
3070
980529af506f
(svn r3659) Add function to get the road bits of a level crossing
tron
parents:
3069
diff
changeset
|
255 |
} |
980529af506f
(svn r3659) Add function to get the road bits of a level crossing
tron
parents:
3069
diff
changeset
|
256 |
|
8598
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
257 |
static inline Track GetCrossingRailTrack(TileIndex tile) |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
258 |
{ |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
259 |
return AxisToTrack(GetCrossingRailAxis(tile)); |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
260 |
} |
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
261 |
|
3103
c0681c720481
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
262 |
static inline TrackBits GetCrossingRailBits(TileIndex tile) |
c0681c720481
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
263 |
{ |
8598
ddd1f342b0da
(svn r12179) -Codechange: use GetCrossingRailTrack() and GetCrossingRailAxis() to improve code readability
smatz
parents:
8563
diff
changeset
|
264 |
return AxisToTrackBits(GetCrossingRailAxis(tile)); |
3103
c0681c720481
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
265 |
} |
c0681c720481
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
266 |
|
9784
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
267 |
|
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
268 |
/** |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
269 |
* Get the reservation state of the rail crossing |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
270 |
* @pre IsLevelCrossingTile(t) |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
271 |
* @param t the crossing tile |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
272 |
* @return reservation state |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
273 |
*/ |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
274 |
static inline bool GetCrossingReservation(TileIndex t) |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
275 |
{ |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
276 |
assert(IsLevelCrossingTile(t)); |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
277 |
return HasBit(_m[t].m5, 4); |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
278 |
} |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
279 |
|
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
280 |
/** |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
281 |
* Set the reservation state of the rail crossing |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
282 |
* @note Works for both waypoints and rail depots |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
283 |
* @pre IsLevelCrossingTile(t) |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
284 |
* @param t the crossing tile |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
285 |
* @param b the reservation state |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
286 |
*/ |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
287 |
static inline void SetCrossingReservation(TileIndex t, bool b) |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
288 |
{ |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
289 |
assert(IsLevelCrossingTile(t)); |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
290 |
SB(_m[t].m5, 4, 1, b ? 1 : 0); |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
291 |
} |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
292 |
|
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
293 |
/** |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
294 |
* Get the reserved track bits for a rail crossing |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
295 |
* @pre IsLevelCrossingTile(t) |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
296 |
* @param t the tile |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
297 |
* @return reserved track bits |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
298 |
*/ |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
299 |
static inline TrackBits GetRailCrossingReservation(TileIndex t) |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
300 |
{ |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
301 |
return GetCrossingReservation(t) ? GetCrossingRailBits(t) : TRACK_BIT_NONE; |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
302 |
} |
a9cc0dff1667
(svn r13926) -Add [YAPP]: Add map accessors for path reservations. (michi_cc)
rubidium
parents:
9341
diff
changeset
|
303 |
|
8344
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
304 |
static inline bool IsCrossingBarred(TileIndex t) |
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
305 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
306 |
assert(IsLevelCrossing(t)); |
8344
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
307 |
return HasBit(_m[t].m4, 5); |
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
308 |
} |
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
309 |
|
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
310 |
static inline void SetCrossingBarred(TileIndex t, bool barred) |
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
311 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
312 |
assert(IsLevelCrossing(t)); |
8344
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
313 |
SB(_m[t].m4, 5, 1, barred); |
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
314 |
} |
3103
c0681c720481
(svn r3698) Add GetCrossingRailBits() and ComplementRoadBits(). Simplify the code by using them
tron
parents:
3099
diff
changeset
|
315 |
|
3322
41b4d25b126d
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
316 |
static inline void UnbarCrossing(TileIndex t) |
41b4d25b126d
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
317 |
{ |
8344
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
318 |
SetCrossingBarred(t, false); |
3322
41b4d25b126d
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
319 |
} |
41b4d25b126d
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
320 |
|
41b4d25b126d
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
321 |
static inline void BarCrossing(TileIndex t) |
41b4d25b126d
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
322 |
{ |
8344
1cd2a831b06c
(svn r11910) -Fix: play 'ding-ding' crossing sound in more cases (except gameload and crossing construction)
smatz
parents:
8213
diff
changeset
|
323 |
SetCrossingBarred(t, true); |
3322
41b4d25b126d
(svn r4088) -Codechange: Introduce {Unb,B}arCrossing and IsCrossingBarred to put and get the status of a level crossing
celestar
parents:
3274
diff
changeset
|
324 |
} |
3274 | 325 |
|
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
326 |
#define IsOnDesert IsOnSnow |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
327 |
static inline bool IsOnSnow(TileIndex t) |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
328 |
{ |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7370
diff
changeset
|
329 |
return HasBit(_m[t].m3, 7); |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
330 |
} |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
331 |
|
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
332 |
#define ToggleDesert ToggleSnow |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
333 |
static inline void ToggleSnow(TileIndex t) |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
334 |
{ |
7932
6c3d71e8a129
(svn r11485) -Codechange: Remove the doubled function ToggleBitT and rename the remaining to fit with the naming style
skidd13
parents:
7931
diff
changeset
|
335 |
ToggleBit(_m[t].m3, 7); |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
336 |
} |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
337 |
|
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
338 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6172
diff
changeset
|
339 |
enum Roadside { |
4048 | 340 |
ROADSIDE_BARREN = 0, |
341 |
ROADSIDE_GRASS = 1, |
|
342 |
ROADSIDE_PAVED = 2, |
|
343 |
ROADSIDE_STREET_LIGHTS = 3, |
|
344 |
ROADSIDE_TREES = 5, |
|
345 |
ROADSIDE_GRASS_ROAD_WORKS = 6, |
|
346 |
ROADSIDE_PAVED_ROAD_WORKS = 7 |
|
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6172
diff
changeset
|
347 |
}; |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
348 |
|
4048 | 349 |
static inline Roadside GetRoadside(TileIndex tile) |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
350 |
{ |
6172
e6d7a5b3d63f
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5475
diff
changeset
|
351 |
return (Roadside)GB(_m[tile].m3, 4, 3); |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
352 |
} |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
353 |
|
4048 | 354 |
static inline void SetRoadside(TileIndex tile, Roadside s) |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
355 |
{ |
6172
e6d7a5b3d63f
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5475
diff
changeset
|
356 |
SB(_m[tile].m3, 4, 3, s); |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
357 |
} |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
358 |
|
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
359 |
static inline bool HasRoadWorks(TileIndex t) |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
360 |
{ |
4048 | 361 |
return GetRoadside(t) >= ROADSIDE_GRASS_ROAD_WORKS; |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
362 |
} |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
363 |
|
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
364 |
static inline bool IncreaseRoadWorksCounter(TileIndex t) |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
365 |
{ |
6172
e6d7a5b3d63f
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5475
diff
changeset
|
366 |
AB(_m[t].m3, 0, 4, 1); |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
367 |
|
6172
e6d7a5b3d63f
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5475
diff
changeset
|
368 |
return GB(_m[t].m3, 0, 4) == 15; |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
369 |
} |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
370 |
|
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
371 |
static inline void StartRoadWorks(TileIndex t) |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
372 |
{ |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
373 |
assert(!HasRoadWorks(t)); |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
374 |
/* Remove any trees or lamps in case or roadwork */ |
4048 | 375 |
switch (GetRoadside(t)) { |
376 |
case ROADSIDE_BARREN: |
|
377 |
case ROADSIDE_GRASS: SetRoadside(t, ROADSIDE_GRASS_ROAD_WORKS); break; |
|
378 |
default: SetRoadside(t, ROADSIDE_PAVED_ROAD_WORKS); break; |
|
4045
9eda219bc134
(svn r5314) -Regression: When road works started on a road tile with barren roadside the road side turned into trees (caused by r4258)
tron
parents:
4000
diff
changeset
|
379 |
} |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
380 |
} |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
381 |
|
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
382 |
static inline void TerminateRoadWorks(TileIndex t) |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
383 |
{ |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
384 |
assert(HasRoadWorks(t)); |
4048 | 385 |
SetRoadside(t, (Roadside)(GetRoadside(t) - ROADSIDE_GRASS_ROAD_WORKS + ROADSIDE_GRASS)); |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
386 |
/* Stop the counter */ |
6172
e6d7a5b3d63f
(svn r8935) -Codechange: unification of track type between road and rail tiles, unification of ground type between normal rail tiles and depots/waypoints and removing the need for RailTileSubType.
rubidium
parents:
5475
diff
changeset
|
387 |
SB(_m[t].m3, 0, 4, 0); |
3430
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
388 |
} |
fcc344e41319
(svn r4258) -Codechange: Add and make use of map accessors dealing with road ground types (including roadworks).
celestar
parents:
3369
diff
changeset
|
389 |
|
3069
9a1fd047b595
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
390 |
|
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
391 |
static inline DiagDirection GetRoadDepotDirection(TileIndex t) |
3069
9a1fd047b595
(svn r3658) Add functions and symbolic names to retrieve road tile types and road pieces
tron
parents:
diff
changeset
|
392 |
{ |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8529
diff
changeset
|
393 |
assert(IsRoadDepot(t)); |
3369
cab209754317
(svn r4166) Sprinkle several map accessors with assert()s
tron
parents:
3322
diff
changeset
|
394 |
return (DiagDirection)GB(_m[t].m5, 0, 2); |
3167
8323c2ccd029
(svn r3795) Add a function to request the orientation of a depot
tron
parents:
3150
diff
changeset
|
395 |
} |
8323c2ccd029
(svn r3795) Add a function to request the orientation of a depot
tron
parents:
3150
diff
changeset
|
396 |
|
8323c2ccd029
(svn r3795) Add a function to request the orientation of a depot
tron
parents:
3150
diff
changeset
|
397 |
|
3146
8d95593c5ff0
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
398 |
/** |
8d95593c5ff0
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
399 |
* Returns the RoadBits on an arbitrary tile |
6390
802629b3c7f1
(svn r9520) -Codechange: Add the notion of Industry behaviour. It means what an industry can do (plant fields, cut trees, do not change production), what can be done to it (disasters like mine subsidence, jet/chopper attack), when it can be built etc...
belugas
parents:
6248
diff
changeset
|
400 |
* Special behaviour: |
3146
8d95593c5ff0
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
401 |
* - road depots: entrance is treated as road piece |
8d95593c5ff0
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
402 |
* - road tunnels: entrance is treated as road piece |
3196 | 403 |
* - bridge ramps: start of the ramp is treated as road piece |
3146
8d95593c5ff0
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
404 |
* - bridge middle parts: bridge itself is ignored |
8716
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8598
diff
changeset
|
405 |
* |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8598
diff
changeset
|
406 |
* If straight_tunnel_bridge_entrance is set a ROAD_X or ROAD_Y |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8598
diff
changeset
|
407 |
* for bridge ramps and tunnel entrances is returned depending |
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8598
diff
changeset
|
408 |
* on the orientation of the tunnel or bridge. |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
409 |
* @param tile the tile to get the road bits for |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
410 |
* @param rt the road type to get the road bits form |
8716
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8598
diff
changeset
|
411 |
* @param stbe whether to return straight road bits for tunnels/bridges. |
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
412 |
* @return the road bits of the given tile |
3146
8d95593c5ff0
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
413 |
*/ |
8716
360342cfd3fe
(svn r12390) -Fix [FS#1851]: trams failing to turn on bridge heads/tunnel entrances.
rubidium
parents:
8598
diff
changeset
|
414 |
RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt, bool straight_tunnel_bridge_entrance = false); |
3146
8d95593c5ff0
(svn r3766) Add a function to get the RoadBits from an arbitrary tile
tron
parents:
3145
diff
changeset
|
415 |
|
6418
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
416 |
/** |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
417 |
* Get the accessible track bits for the given tile. |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
418 |
* Special behaviour: |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
419 |
* - road depots: no track bits |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
420 |
* - non-drive-through stations: no track bits |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
421 |
* @param tile the tile to get the track bits for |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
422 |
* @return the track bits for the given tile |
e04693bbe82a
(svn r9554) -Documentation: add documentation to some map accessors.
rubidium
parents:
6393
diff
changeset
|
423 |
*/ |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
424 |
TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt); |
3150
729951cb5448
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
425 |
|
8102
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
426 |
/** |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
427 |
* Return if the tile is a valid tile for a crossing. |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
428 |
* |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
429 |
* @note function is overloaded |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
430 |
* @param tile the curent tile |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
431 |
* @param ax the axis of the road over the rail |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
432 |
* @return true if it is a valid tile |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
433 |
*/ |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
434 |
bool IsPossibleCrossing(const TileIndex tile, Axis ax); |
906a3d3b6df1
(svn r11663) -Codechange: moving of the road related types and functions.
rubidium
parents:
8101
diff
changeset
|
435 |
|
3150
729951cb5448
(svn r3773) Shove some semantics down ottd's throat by replacing ints and magic numbers by enums and some related changes
tron
parents:
3146
diff
changeset
|
436 |
|
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
437 |
static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram, Owner hway) |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
438 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
439 |
SetTileType(t, MP_ROAD); |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
440 |
SetTileOwner(t, road); |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
441 |
_m[t].m2 = town; |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
442 |
_m[t].m3 = 0; |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7370
diff
changeset
|
443 |
_m[t].m4 = (HasBit(rot, ROADTYPE_TRAM) ? bits : 0) << 4 | (HasBit(rot, ROADTYPE_ROAD) ? bits : 0); |
6778
58189151ce4f
(svn r10014) -Fix: roads became automatically one way in the scenario editor.
rubidium
parents:
6764
diff
changeset
|
444 |
_m[t].m5 = ROAD_TILE_NORMAL << 6; |
58189151ce4f
(svn r10014) -Fix: roads became automatically one way in the scenario editor.
rubidium
parents:
6764
diff
changeset
|
445 |
SetRoadOwner(t, ROADTYPE_TRAM, tram); |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7370
diff
changeset
|
446 |
SB(_m[t].m6, 2, 4, HasBit(rot, ROADTYPE_HWAY) ? bits : 0); |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
447 |
_me[t].m7 = rot << 5 | hway; |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
448 |
} |
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
449 |
|
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
450 |
|
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
451 |
static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner hway, Owner rail, Axis roaddir, RailType rat, RoadTypes rot, uint town) |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
452 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
453 |
SetTileType(t, MP_ROAD); |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
454 |
SetTileOwner(t, rail); |
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
455 |
_m[t].m2 = town; |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
456 |
_m[t].m3 = rat; |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
457 |
_m[t].m4 = roaddir << 6 | road; |
6778
58189151ce4f
(svn r10014) -Fix: roads became automatically one way in the scenario editor.
rubidium
parents:
6764
diff
changeset
|
458 |
_m[t].m5 = ROAD_TILE_CROSSING << 6; |
58189151ce4f
(svn r10014) -Fix: roads became automatically one way in the scenario editor.
rubidium
parents:
6764
diff
changeset
|
459 |
SetRoadOwner(t, ROADTYPE_TRAM, tram); |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
460 |
SB(_m[t].m6, 2, 4, 0); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
461 |
_me[t].m7 = rot << 5 | hway; |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
462 |
} |
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
463 |
|
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
464 |
|
10289
801e5451f0ca
(svn r14528) -Codechange: cache the closest town for all road tiles instead of only roads owned by tiles. This replaces a O(n) search over all towns from the road's tileloop with a O(1) lookup (PhilSophus)
rubidium
parents:
9784
diff
changeset
|
465 |
static inline void MakeRoadDepot(TileIndex t, Owner owner, DiagDirection dir, RoadType rt, TownID town) |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
466 |
{ |
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
6778
diff
changeset
|
467 |
SetTileType(t, MP_ROAD); |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
468 |
SetTileOwner(t, owner); |
10289
801e5451f0ca
(svn r14528) -Codechange: cache the closest town for all road tiles instead of only roads owned by tiles. This replaces a O(n) search over all towns from the road's tileloop with a O(1) lookup (PhilSophus)
rubidium
parents:
9784
diff
changeset
|
469 |
_m[t].m2 = town; |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
470 |
_m[t].m3 = 0; |
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
471 |
_m[t].m4 = 0; |
6661
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
472 |
_m[t].m5 = ROAD_TILE_DEPOT << 6 | dir; |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
473 |
SB(_m[t].m6, 2, 4, 0); |
1716fce5ad29
(svn r9892) -Codechange: lots of ground work for allowing multiple types of "road" with multiple owners on a single tile.
rubidium
parents:
6418
diff
changeset
|
474 |
_me[t].m7 = RoadTypeToRoadTypes(rt) << 5; |
3099
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
475 |
} |
571719b2cee3
(svn r3689) Add functions to turn a tile into either a normal road tile, a level crossing or a road depot
tron
parents:
3070
diff
changeset
|
476 |
|
4666
172a0cdf28a6
(svn r6560) - Codechange: Minor fix; add missing #include guards and comments, and correct svn properties on bmp.[ch]
peter1138
parents:
4158
diff
changeset
|
477 |
#endif /* ROAD_MAP_H */ |