equal
deleted
inserted
replaced
31 } Trackdir; |
31 } Trackdir; |
32 |
32 |
33 /** These are a combination of tracks and directions. Values are 0-5 in one |
33 /** These are a combination of tracks and directions. Values are 0-5 in one |
34 direction (corresponding to the Track enum) and 8-13 in the other direction. */ |
34 direction (corresponding to the Track enum) and 8-13 in the other direction. */ |
35 typedef enum TrackdirBits { |
35 typedef enum TrackdirBits { |
|
36 TRACKDIR_BIT_NONE = 0x0, |
36 TRACKDIR_BIT_X_NE = 0x1, |
37 TRACKDIR_BIT_X_NE = 0x1, |
37 TRACKDIR_BIT_Y_SE = 0x2, |
38 TRACKDIR_BIT_Y_SE = 0x2, |
38 TRACKDIR_BIT_UPPER_E = 0x4, |
39 TRACKDIR_BIT_UPPER_E = 0x4, |
39 TRACKDIR_BIT_LOWER_E = 0x8, |
40 TRACKDIR_BIT_LOWER_E = 0x8, |
40 TRACKDIR_BIT_LEFT_S = 0x10, |
41 TRACKDIR_BIT_LEFT_S = 0x10, |
214 |
215 |
215 /** |
216 /** |
216 * Returns a TrackdirBit mask that contains the two TrackdirBits that |
217 * Returns a TrackdirBit mask that contains the two TrackdirBits that |
217 * correspond with the given Track (one for each direction). |
218 * correspond with the given Track (one for each direction). |
218 */ |
219 */ |
219 static inline TrackdirBits TrackToTrackdirBits(Track track) { Trackdir td = TrackToTrackdir(track); return TrackdirToTrackdirBits(td) | TrackdirToTrackdirBits(ReverseTrackdir(td));} |
220 static inline TrackdirBits TrackToTrackdirBits(Track track) { Trackdir td = TrackToTrackdir(track); return (TrackdirBits)(TrackdirToTrackdirBits(td) | TrackdirToTrackdirBits(ReverseTrackdir(td)));} |
220 |
221 |
221 /** |
222 /** |
222 * Discards all directional information from the given TrackdirBits. Any |
223 * Discards all directional information from the given TrackdirBits. Any |
223 * Track which is present in either direction will be present in the result. |
224 * Track which is present in either direction will be present in the result. |
224 */ |
225 */ |
225 static inline TrackBits TrackdirBitsToTrackBits(TrackdirBits bits) { return bits | (bits >> 8); } |
226 static inline TrackBits TrackdirBitsToTrackBits(TrackdirBits bits) { return (TrackBits)(bits | (bits >> 8)); } |
226 |
227 |
227 /** |
228 /** |
228 * Maps a trackdir to the trackdir that you will end up on if you go straight |
229 * Maps a trackdir to the trackdir that you will end up on if you go straight |
229 * ahead. This will be the same trackdir for diagonal trackdirs, but a |
230 * ahead. This will be the same trackdir for diagonal trackdirs, but a |
230 * different (alternating) one for straight trackdirs |
231 * different (alternating) one for straight trackdirs |