author | matthijs |
Mon, 30 May 2005 21:46:10 +0000 | |
changeset 1880 | 6541d49fd63a |
parent 1857 | 7321b4c1d4e1 |
child 1891 | 92a3b0aa0946 |
permissions | -rw-r--r-- |
1247 | 1 |
#ifndef NPF_H |
2 |
#define NPF_H |
|
3 |
||
1880 | 4 |
/* Blaat */ |
5 |
||
1247 | 6 |
#include "ttd.h" |
7 |
#include "aystar.h" |
|
8 |
#include "vehicle.h" |
|
9 |
||
10 |
//mowing grass |
|
1661
6af0c4416154
(svn r2165) - Codechange: [NPF] Properly enummed NPF hash size, it is easily changable now.
matthijs
parents:
1459
diff
changeset
|
11 |
enum { |
6af0c4416154
(svn r2165) - Codechange: [NPF] Properly enummed NPF hash size, it is easily changable now.
matthijs
parents:
1459
diff
changeset
|
12 |
NPF_HASH_BITS = 12, /* The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value. */ |
6af0c4416154
(svn r2165) - Codechange: [NPF] Properly enummed NPF hash size, it is easily changable now.
matthijs
parents:
1459
diff
changeset
|
13 |
/* Do no change below values */ |
6af0c4416154
(svn r2165) - Codechange: [NPF] Properly enummed NPF hash size, it is easily changable now.
matthijs
parents:
1459
diff
changeset
|
14 |
NPF_HASH_SIZE = 1 << NPF_HASH_BITS, |
6af0c4416154
(svn r2165) - Codechange: [NPF] Properly enummed NPF hash size, it is easily changable now.
matthijs
parents:
1459
diff
changeset
|
15 |
NPF_HASH_HALFBITS = NPF_HASH_BITS / 2, |
6af0c4416154
(svn r2165) - Codechange: [NPF] Properly enummed NPF hash size, it is easily changable now.
matthijs
parents:
1459
diff
changeset
|
16 |
NPF_HASH_HALFMASK = (1 << NPF_HASH_HALFBITS) - 1 |
6af0c4416154
(svn r2165) - Codechange: [NPF] Properly enummed NPF hash size, it is easily changable now.
matthijs
parents:
1459
diff
changeset
|
17 |
}; |
1247 | 18 |
|
1777
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
19 |
enum { |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
20 |
/** This penalty is the equivalent of "inifite", which means that paths that |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
21 |
* get this penalty will be chosen, but only if there is no other route |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
22 |
* without it. Be careful with not applying this penalty to often, or the |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
23 |
* total path cost might overflow.. |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
24 |
* For now, this is just a Very Big Penalty, we might actually implement |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
25 |
* this in a nicer way :-) |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
26 |
*/ |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
27 |
NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
28 |
}; |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
29 |
|
1247 | 30 |
typedef struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */ |
31 |
TileIndex dest_coords; /* An indication of where the station is, for heuristic purposes, or the target tile */ |
|
32 |
int station_index; /* station index we're heading for, or -1 when we're heading for a tile */ |
|
33 |
} NPFFindStationOrTileData; |
|
34 |
||
35 |
enum { /* Indices into AyStar.userdata[] */ |
|
1330
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
36 |
NPF_TYPE = 0, /* Contains a TransportTypes value */ |
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
37 |
NPF_OWNER, /* Contains an Owner value */ |
1247 | 38 |
}; |
39 |
||
40 |
enum { /* Indices into AyStarNode.userdata[] */ |
|
41 |
NPF_TRACKDIR_CHOICE = 0, /* The trackdir chosen to get here */ |
|
42 |
NPF_NODE_FLAGS, |
|
43 |
}; |
|
1459
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
44 |
typedef enum { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
45 |
NPF_FLAG_SEEN_SIGNAL, /* Used to mark that a signal was seen on the way, for rail only */ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
46 |
NPF_FLAG_REVERSE, /* Used to mark that this node was reached from the second start node, if applicable */ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
47 |
NPF_FLAG_LAST_SIGNAL_RED, /* Used to mark that the last signal on this path was red */ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
48 |
} NPFNodeFlag; |
1247 | 49 |
|
50 |
typedef struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */ |
|
51 |
uint best_bird_dist; /* The best heuristic found. Is 0 if the target was found */ |
|
52 |
uint best_path_dist; /* The shortest path. Is (uint)-1 if no path is found */ |
|
1330
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
53 |
byte best_trackdir; /* The trackdir that leads to the shortest path/closest birds dist */ |
1247 | 54 |
AyStarNode node; /* The node within the target the search led us to */ |
55 |
} NPFFoundTargetData; |
|
56 |
||
57 |
/* These functions below are _not_ re-entrant, in favor of speed! */ |
|
58 |
||
59 |
/* Will search from the given tile and direction, for a route to the given |
|
60 |
* station for the given transport type. See the declaration of |
|
61 |
* NPFFoundTargetData above for the meaning of the result. */ |
|
1330
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
62 |
NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, byte trackdir, NPFFindStationOrTileData* target, TransportType type, Owner owner); |
1247 | 63 |
/* Will search as above, but with two start nodes, the second being the |
1459
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
64 |
* reverse. Look at the NPF_FLAG_REVERSE flag in the result node to see which |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
65 |
* direction was taken (NPFGetBit(result.node, NPF_FLAG_REVERSE)) */ |
1330
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
66 |
NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, byte trackdir1, TileIndex tile2, byte trackdir2, NPFFindStationOrTileData* target, TransportType type, Owner owner); |
1247 | 67 |
|
68 |
/* Will search a route to the closest depot. */ |
|
69 |
||
70 |
/* Search using breadth first. Good for little track choice and inaccurate |
|
1777
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
71 |
* heuristic, such as railway/road.*/ |
1330
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
72 |
NPFFoundTargetData NPFRouteToDepotBreadthFirst(TileIndex tile, byte trackdir, TransportType type, Owner owner); |
1777
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
73 |
/* Same as above but with two start nodes, the second being the reverse. Call |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
74 |
* NPFGetBit(result.node, NPF_FLAG_REVERSE) to see from which node the path |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
75 |
* orginated. All pathfs from the second node will have the given |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
76 |
* reverse_penalty applied (NPF_TILE_LENGTH is the equivalent of one full |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
77 |
* tile). |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
78 |
*/ |
d328484bd6f2
(svn r2281) - Fix: [ 1115204 ] [NPF] When pressing the goto depot button, trains will now also look behind it if there is no depot in front. If so, the train reverses immediately. This also work anywhere, not just at stations.
matthijs
parents:
1751
diff
changeset
|
79 |
NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, byte trackdir1, TileIndex tile2, byte trackdir2, TransportType type, Owner owner, uint reverse_penalty); |
1247 | 80 |
/* Search by trying each depot in order of Manhattan Distance. Good for lots |
1330
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
81 |
* of choices and accurate heuristics, such as water. */ |
8a67d04016ce
(svn r1834) - Fix: NPF does not check the owner of its target, busses try to enter other players' depots. TODO
matthijs
parents:
1247
diff
changeset
|
82 |
NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, byte trackdir, TransportType type, Owner owner); |
1247 | 83 |
|
84 |
void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v); |
|
85 |
||
1459
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
86 |
|
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
87 |
/* |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
88 |
* Functions to manipulate the various NPF related flags on an AyStarNode. |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
89 |
*/ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
90 |
|
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
91 |
/** |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
92 |
* Returns the current value of the given flag on the given AyStarNode. |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
93 |
*/ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
94 |
static inline bool NPFGetFlag(const AyStarNode* node, NPFNodeFlag flag) |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
95 |
{ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
96 |
return HASBIT(node->user_data[NPF_NODE_FLAGS], flag); |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
97 |
} |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
98 |
|
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
99 |
/** |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
100 |
* Sets the given flag on the given AyStarNode to the given value. |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
101 |
*/ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
102 |
static inline void NPFSetFlag(AyStarNode* node, NPFNodeFlag flag, bool value) |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
103 |
{ |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
104 |
if (value) |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
105 |
SETBIT(node->user_data[NPF_NODE_FLAGS], flag); |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
106 |
else |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
107 |
CLRBIT(node->user_data[NPF_NODE_FLAGS], flag); |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
108 |
} |
6c1f01803928
(svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents:
1330
diff
changeset
|
109 |
|
1247 | 110 |
/* |
111 |
* Some tables considering tracks, directions and signals. |
|
112 |
* XXX: Better place to but these? |
|
113 |
*/ |
|
114 |
||
115 |
/** |
|
116 |
* Maps a trackdir to the bit that stores its status in the map arrays, in the |
|
117 |
* direction along with the trackdir. |
|
118 |
*/ |
|
119 |
const byte _signal_along_trackdir[14]; |
|
120 |
||
121 |
/** |
|
122 |
* Maps a trackdir to the bit that stores its status in the map arrays, in the |
|
123 |
* direction against the trackdir. |
|
124 |
*/ |
|
125 |
const byte _signal_against_trackdir[14]; |
|
126 |
||
127 |
/** |
|
128 |
* Maps a trackdir to the trackdirs that can be reached from it (ie, when |
|
129 |
* entering the next tile. |
|
130 |
*/ |
|
131 |
const uint16 _trackdir_reaches_trackdirs[14]; |
|
132 |
||
133 |
/** |
|
1751
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
134 |
* Maps a trackdir to the trackdir that you will end up on if you go straight |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
135 |
* ahead. This will be the same trackdir for diagonal trackdirs, but a |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
136 |
* different (alternating) one for straight trackdirs */ |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
137 |
const uint16 _next_trackdir[14]; |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
138 |
/** |
1247 | 139 |
* Maps a trackdir to all trackdirs that make 90 deg turns with it. |
140 |
*/ |
|
141 |
const uint16 _trackdir_crosses_trackdirs[14]; |
|
142 |
||
143 |
/** |
|
144 |
* Maps a track to all tracks that make 90 deg turns with it. |
|
145 |
*/ |
|
146 |
const byte _track_crosses_tracks[6]; |
|
147 |
||
148 |
/** |
|
149 |
* Maps a trackdir to the (4-way) direction the tile is exited when following |
|
150 |
* that trackdir. |
|
151 |
*/ |
|
152 |
const byte _trackdir_to_exitdir[14]; |
|
153 |
||
154 |
/** |
|
155 |
* Maps a track and an (4-way) dir to the trackdir that represents the track |
|
156 |
* with the exit in the given direction. |
|
157 |
*/ |
|
158 |
const byte _track_exitdir_to_trackdir[6][4]; |
|
159 |
||
160 |
/** |
|
161 |
* Maps a track and a full (8-way) direction to the trackdir that represents |
|
162 |
* the track running in the given direction. |
|
163 |
*/ |
|
164 |
const byte _track_direction_to_trackdir[6][8]; |
|
165 |
||
166 |
/** |
|
167 |
* Maps a (4-way) direction to the diagonal track that runs in that |
|
168 |
* direction. |
|
169 |
*/ |
|
170 |
const byte _dir_to_diag_trackdir[4]; |
|
171 |
||
172 |
/** |
|
173 |
* Maps a (4-way) direction to the reverse. |
|
174 |
*/ |
|
175 |
const byte _reverse_dir[4]; |
|
176 |
||
177 |
/** |
|
178 |
* Maps a trackdir to the reverse trackdir. |
|
179 |
*/ |
|
180 |
const byte _reverse_trackdir[14]; |
|
181 |
||
1751
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
182 |
/* Returns the Track that a given Trackdir represents */ |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
183 |
static inline byte TrackdirToTrack(byte trackdir) { return trackdir & 0x7; } |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
184 |
|
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
185 |
/* Returns a Trackdir for the given Track. Since every Track corresponds to |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
186 |
* two Trackdirs, we choose the one which points between N and SE. |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
187 |
* Note that the actual implementation is quite futile, but this might change |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
188 |
* in the future. |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
189 |
*/ |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
190 |
static inline byte TrackToTrackdir(byte track) { return track; } |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
191 |
|
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
192 |
/* Checks if a given Track is diagonal */ |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
193 |
static inline bool IsDiagonalTrack(byte track) { return track == 0x0 || track == 0x1; } |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
194 |
|
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
195 |
/* Checks if a given Trackdir is diagonal. */ |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
196 |
static inline bool IsDiagonalTrackdir(byte trackdir) { return IsDiagonalTrack(TrackdirToTrack(trackdir)); } |
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
197 |
|
954dd2900ac9
(svn r2255) - Fix: [ 9680363 ] [NPF] Broken buoy handling for ships
matthijs
parents:
1678
diff
changeset
|
198 |
|
1247 | 199 |
#define REVERSE_TRACKDIR(trackdir) (trackdir ^ 0x8) |
200 |
||
201 |
#endif // NPF_H |