Feature: Purchase land multiple tiles at a time
[openttd-github.git] / src / track_func.h
blob646745064600dea19069d6d370df496dcf8166b6
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file track_func.h Different conversion functions from one kind of track to another. */
10 #ifndef TRACK_FUNC_H
11 #define TRACK_FUNC_H
13 #include "core/bitmath_func.hpp"
14 #include "track_type.h"
15 #include "direction_func.h"
16 #include "slope_func.h"
18 using SetTrackBitIterator = SetBitIterator<Track, TrackBits>;
20 /**
21 * Checks if a Track is valid.
23 * @param track The value to check
24 * @return true if the given value is a valid track.
25 * @note Use this in an assert()
27 static inline bool IsValidTrack(Track track)
29 return track < TRACK_END;
32 /**
33 * Checks if a Trackdir is valid for road vehicles.
35 * @param trackdir The value to check
36 * @return true if the given value is a valid Trackdir
37 * @note Use this in an assert()
39 static inline bool IsValidTrackdirForRoadVehicle(Trackdir trackdir)
41 return trackdir < TRACKDIR_END;
44 /**
45 * Checks if a Trackdir is valid for non-road vehicles.
47 * @param trackdir The value to check
48 * @return true if the given value is a valid Trackdir
49 * @note Use this in an assert()
51 static inline bool IsValidTrackdir(Trackdir trackdir)
53 return trackdir != INVALID_TRACKDIR && ((1 << trackdir & TRACKDIR_BIT_MASK) != TRACKDIR_BIT_NONE);
56 /**
57 * Convert an Axis to the corresponding Track
58 * AXIS_X -> TRACK_X
59 * AXIS_Y -> TRACK_Y
60 * Uses the fact that they share the same internal encoding
62 * @param a the axis to convert
63 * @return the track corresponding to the axis
65 static inline Track AxisToTrack(Axis a)
67 assert(IsValidAxis(a));
68 return (Track)a;
71 /**
72 * Maps a Track to the corresponding TrackBits value
73 * @param track the track to convert
74 * @return the converted TrackBits value of the track
76 static inline TrackBits TrackToTrackBits(Track track)
78 assert(IsValidTrack(track));
79 return (TrackBits)(1 << track);
82 /**
83 * Maps an Axis to the corresponding TrackBits value
84 * @param a the axis to convert
85 * @return the converted TrackBits value of the axis
87 static inline TrackBits AxisToTrackBits(Axis a)
89 return TrackToTrackBits(AxisToTrack(a));
92 /**
93 * Returns a single horizontal/vertical trackbit that is in a specific tile corner.
95 * @param corner The corner of a tile.
96 * @return The TrackBits of the track in the corner.
98 static inline TrackBits CornerToTrackBits(Corner corner)
100 extern const TrackBits _corner_to_trackbits[];
101 assert(IsValidCorner(corner));
102 return _corner_to_trackbits[corner];
106 * Maps a Trackdir to the corresponding TrackdirBits value
107 * @param trackdir the track direction to convert
108 * @return the converted TrackdirBits value
110 static inline TrackdirBits TrackdirToTrackdirBits(Trackdir trackdir)
112 assert(IsValidTrackdir(trackdir));
113 return (TrackdirBits)(1 << trackdir);
117 * Removes first Track from TrackBits and returns it
119 * This function searches for the first bit in the TrackBits,
120 * remove this bit from the parameter and returns the found
121 * bit as Track value. It returns INVALID_TRACK if the
122 * parameter was TRACK_BIT_NONE or INVALID_TRACK_BIT. This
123 * is basically used in while-loops to get up to 6 possible
124 * tracks on a tile until the parameter becomes TRACK_BIT_NONE.
126 * @param tracks The value with the TrackBits
127 * @return The first Track from the TrackBits value
128 * @see FindFirstTrack
130 static inline Track RemoveFirstTrack(TrackBits *tracks)
132 if (*tracks != TRACK_BIT_NONE && *tracks != INVALID_TRACK_BIT) {
133 assert((*tracks & ~TRACK_BIT_MASK) == TRACK_BIT_NONE);
134 Track first = (Track)FIND_FIRST_BIT(*tracks);
135 ClrBit(*tracks, first);
136 return first;
138 return INVALID_TRACK;
142 * Removes first Trackdir from TrackdirBits and returns it
144 * This function searches for the first bit in the TrackdirBits parameter,
145 * remove this bit from the parameter and returns the fnound bit as
146 * Trackdir value. It returns INVALID_TRACKDIR if the trackdirs is
147 * TRACKDIR_BIT_NONE or INVALID_TRACKDIR_BIT. This is basically used in a
148 * while-loop to get all track-directions step by step until the value
149 * reaches TRACKDIR_BIT_NONE.
151 * @param trackdirs The value with the TrackdirBits
152 * @return The first Trackdir from the TrackdirBits value
153 * @see FindFirstTrackdir
155 static inline Trackdir RemoveFirstTrackdir(TrackdirBits *trackdirs)
157 if (*trackdirs != TRACKDIR_BIT_NONE && *trackdirs != INVALID_TRACKDIR_BIT) {
158 assert((*trackdirs & ~TRACKDIR_BIT_MASK) == TRACKDIR_BIT_NONE);
159 Trackdir first = (Trackdir)FindFirstBit2x64(*trackdirs);
160 ClrBit(*trackdirs, first);
161 return first;
163 return INVALID_TRACKDIR;
167 * Returns first Track from TrackBits or INVALID_TRACK
169 * This function returns the first Track found in the TrackBits value as Track-value.
170 * It returns INVALID_TRACK if the parameter is TRACK_BIT_NONE or INVALID_TRACK_BIT.
172 * @param tracks The TrackBits value
173 * @return The first Track found or INVALID_TRACK
174 * @see RemoveFirstTrack
176 static inline Track FindFirstTrack(TrackBits tracks)
178 return (tracks != TRACK_BIT_NONE && tracks != INVALID_TRACK_BIT) ? (Track)FIND_FIRST_BIT(tracks) : INVALID_TRACK;
182 * Converts TrackBits to Track.
184 * This function converts a TrackBits value to a Track value. As it
185 * is not possible to convert two or more tracks to one track the
186 * parameter must contain only one track or be the INVALID_TRACK_BIT value.
188 * @param tracks The TrackBits value to convert
189 * @return The Track from the value or INVALID_TRACK
190 * @pre tracks must contains only one Track or be INVALID_TRACK_BIT
192 static inline Track TrackBitsToTrack(TrackBits tracks)
194 assert(tracks == INVALID_TRACK_BIT || (tracks != TRACK_BIT_NONE && KillFirstBit(tracks & TRACK_BIT_MASK) == TRACK_BIT_NONE));
195 return tracks != INVALID_TRACK_BIT ? (Track)FIND_FIRST_BIT(tracks & TRACK_BIT_MASK) : INVALID_TRACK;
199 * Returns first Trackdir from TrackdirBits or INVALID_TRACKDIR
201 * This function returns the first Trackdir in the given TrackdirBits value or
202 * INVALID_TRACKDIR if the value is TRACKDIR_BIT_NONE. The TrackdirBits must
203 * not be INVALID_TRACKDIR_BIT.
205 * @param trackdirs The TrackdirBits value
206 * @return The first Trackdir from the TrackdirBits or INVALID_TRACKDIR on TRACKDIR_BIT_NONE.
207 * @pre trackdirs must not be INVALID_TRACKDIR_BIT
208 * @see RemoveFirstTrackdir
210 static inline Trackdir FindFirstTrackdir(TrackdirBits trackdirs)
212 assert((trackdirs & ~TRACKDIR_BIT_MASK) == TRACKDIR_BIT_NONE);
213 return (trackdirs != TRACKDIR_BIT_NONE) ? (Trackdir)FindFirstBit2x64(trackdirs) : INVALID_TRACKDIR;
217 * Functions describing logical relations between Tracks, TrackBits, Trackdirs
218 * TrackdirBits, Direction and DiagDirections.
222 * Find the opposite track to a given track.
224 * TRACK_LOWER -> TRACK_UPPER and vice versa, likewise for left/right.
225 * TRACK_X is mapped to TRACK_Y and reversed.
227 * @param t the track to convert
228 * @return the opposite track
230 static inline Track TrackToOppositeTrack(Track t)
232 assert(IsValidTrack(t));
233 return (Track)(t ^ 1);
237 * Maps a trackdir to the reverse trackdir.
239 * Returns the reverse trackdir of a Trackdir value. The reverse trackdir
240 * is the same track with the other direction on it.
242 * @param trackdir The Trackdir value
243 * @return The reverse trackdir
244 * @pre trackdir must not be INVALID_TRACKDIR
246 static inline Trackdir ReverseTrackdir(Trackdir trackdir)
248 assert(IsValidTrackdirForRoadVehicle(trackdir));
249 return (Trackdir)(trackdir ^ 8);
253 * Returns the Track that a given Trackdir represents
255 * This function filters the Track which is used in the Trackdir value and
256 * returns it as a Track value.
258 * @param trackdir The trackdir value
259 * @return The Track which is used in the value
261 static inline Track TrackdirToTrack(Trackdir trackdir)
263 assert(IsValidTrackdir(trackdir));
264 return (Track)(trackdir & 0x7);
268 * Returns a Trackdir for the given Track
270 * Since every Track corresponds to two Trackdirs, we choose the
271 * one which points between NE and S. Note that the actual
272 * implementation is quite futile, but this might change
273 * in the future.
275 * @param track The given Track
276 * @return The Trackdir from the given Track
278 static inline Trackdir TrackToTrackdir(Track track)
280 assert(IsValidTrack(track));
281 return (Trackdir)track;
285 * Returns a TrackdirBit mask from a given Track
287 * The TrackdirBit mask contains the two TrackdirBits that
288 * correspond with the given Track (one for each direction).
290 * @param track The track to get the TrackdirBits from
291 * @return The TrackdirBits which the selected tracks
293 static inline TrackdirBits TrackToTrackdirBits(Track track)
295 Trackdir td = TrackToTrackdir(track);
296 return (TrackdirBits)(TrackdirToTrackdirBits(td) | TrackdirToTrackdirBits(ReverseTrackdir(td)));
300 * Discards all directional information from a TrackdirBits value
302 * Any Track which is present in either direction will be present in the result.
304 * @param bits The TrackdirBits to get the TrackBits from
305 * @return The TrackBits
307 static inline TrackBits TrackdirBitsToTrackBits(TrackdirBits bits)
309 return (TrackBits)((bits | (bits >> 8)) & TRACK_BIT_MASK);
313 * Converts TrackBits to TrackdirBits while allowing both directions.
315 * @param bits The TrackBits
316 * @return The TrackdirBits containing of bits in both directions.
318 static inline TrackdirBits TrackBitsToTrackdirBits(TrackBits bits)
320 return (TrackdirBits)(bits * 0x101);
324 * Checks whether a TrackBits has a given Track.
325 * @param tracks The track bits.
326 * @param track The track to check.
328 static inline bool HasTrack(TrackBits tracks, Track track)
330 assert(IsValidTrack(track));
331 return HasBit(tracks, track);
335 * Checks whether a TrackdirBits has a given Trackdir.
336 * @param trackdirs The trackdir bits.
337 * @param trackdir The trackdir to check.
339 static inline bool HasTrackdir(TrackdirBits trackdirs, Trackdir trackdir)
341 assert(IsValidTrackdir(trackdir));
342 return HasBit(trackdirs, trackdir);
346 * Returns the present-trackdir-information of a TrackStatus.
348 * @param ts The TrackStatus returned by GetTileTrackStatus()
349 * @return the present trackdirs
351 static inline TrackdirBits TrackStatusToTrackdirBits(TrackStatus ts)
353 return (TrackdirBits)(ts & TRACKDIR_BIT_MASK);
357 * Returns the present-track-information of a TrackStatus.
359 * @param ts The TrackStatus returned by GetTileTrackStatus()
360 * @return the present tracks
362 static inline TrackBits TrackStatusToTrackBits(TrackStatus ts)
364 return TrackdirBitsToTrackBits(TrackStatusToTrackdirBits(ts));
368 * Returns the red-signal-information of a TrackStatus.
370 * Note: The result may contain red signals for non-present tracks.
372 * @param ts The TrackStatus returned by GetTileTrackStatus()
373 * @return the The trackdirs that are blocked by red-signals
375 static inline TrackdirBits TrackStatusToRedSignals(TrackStatus ts)
377 return (TrackdirBits)((ts >> 16) & TRACKDIR_BIT_MASK);
381 * Builds a TrackStatus
383 * @param trackdirbits present trackdirs
384 * @param red_signals red signals
385 * @return the TrackStatus representing the given information
387 static inline TrackStatus CombineTrackStatus(TrackdirBits trackdirbits, TrackdirBits red_signals)
389 return (TrackStatus)(trackdirbits | (red_signals << 16));
393 * Maps a trackdir to the trackdir that you will end up on if you go straight
394 * ahead.
396 * This will be the same trackdir for diagonal trackdirs, but a
397 * different (alternating) one for straight trackdirs
399 * @param trackdir The given trackdir
400 * @return The next Trackdir value of the next tile.
402 static inline Trackdir NextTrackdir(Trackdir trackdir)
404 assert(IsValidTrackdir(trackdir));
405 extern const Trackdir _next_trackdir[TRACKDIR_END];
406 return _next_trackdir[trackdir];
410 * Maps a track to all tracks that make 90 deg turns with it.
412 * For the diagonal directions these are the complement of the
413 * direction, for the straight directions these are the
414 * two vertical or horizontal tracks, depend on the given direction
416 * @param track The given track
417 * @return The TrackBits with the tracks marked which cross the given track by 90 deg.
419 static inline TrackBits TrackCrossesTracks(Track track)
421 assert(IsValidTrack(track));
422 extern const TrackBits _track_crosses_tracks[TRACK_END];
423 return _track_crosses_tracks[track];
427 * Maps a trackdir to the (4-way) direction the tile is exited when following
428 * that trackdir.
430 * For the diagonal directions these are the same directions. For
431 * the straight directions these are the directions from the imagined
432 * base-tile to the bordering tile which will be joined if the given
433 * straight direction is leaved from the base-tile.
435 * @param trackdir The given track direction
436 * @return The direction which points to the resulting tile if following the Trackdir
438 static inline DiagDirection TrackdirToExitdir(Trackdir trackdir)
440 assert(IsValidTrackdirForRoadVehicle(trackdir));
441 extern const DiagDirection _trackdir_to_exitdir[TRACKDIR_END];
442 return _trackdir_to_exitdir[trackdir];
446 * Maps a track and an (4-way) dir to the trackdir that represents the track
447 * with the exit in the given direction.
449 * For the diagonal tracks the resulting track direction are clear for a given
450 * DiagDirection. It either matches the direction or it returns INVALID_TRACKDIR,
451 * as a TRACK_X cannot be applied with DIAG_SE.
452 * For the straight tracks the resulting track direction will be the
453 * direction which the DiagDirection is pointing. But this will be INVALID_TRACKDIR
454 * if the DiagDirection is pointing 'away' the track.
456 * @param track The track to apply an direction on
457 * @param diagdir The DiagDirection to apply on
458 * @return The resulting track direction or INVALID_TRACKDIR if not possible.
460 static inline Trackdir TrackExitdirToTrackdir(Track track, DiagDirection diagdir)
462 assert(IsValidTrack(track));
463 assert(IsValidDiagDirection(diagdir));
464 extern const Trackdir _track_exitdir_to_trackdir[TRACK_END][DIAGDIR_END];
465 return _track_exitdir_to_trackdir[track][diagdir];
469 * Maps a track and an (4-way) dir to the trackdir that represents the track
470 * with the entry in the given direction.
472 * For the diagonal tracks the return value is clear, its either the matching
473 * track direction or INVALID_TRACKDIR.
474 * For the straight tracks this returns the track direction which results if
475 * you follow the DiagDirection and then turn by 45 deg left or right on the
476 * next tile. The new direction on the new track will be the returning Trackdir
477 * value. If the parameters makes no sense like the track TRACK_UPPER and the
478 * direction DIAGDIR_NE (target track cannot be reached) this function returns
479 * INVALID_TRACKDIR.
481 * @param track The target track
482 * @param diagdir The direction to "come from"
483 * @return the resulting Trackdir or INVALID_TRACKDIR if not possible.
485 static inline Trackdir TrackEnterdirToTrackdir(Track track, DiagDirection diagdir)
487 assert(IsValidTrack(track));
488 assert(IsValidDiagDirection(diagdir));
489 extern const Trackdir _track_enterdir_to_trackdir[TRACK_END][DIAGDIR_END];
490 return _track_enterdir_to_trackdir[track][diagdir];
494 * Maps a track and a full (8-way) direction to the trackdir that represents
495 * the track running in the given direction.
497 static inline Trackdir TrackDirectionToTrackdir(Track track, Direction dir)
499 assert(IsValidTrack(track));
500 assert(IsValidDirection(dir));
501 extern const Trackdir _track_direction_to_trackdir[TRACK_END][DIR_END];
502 return _track_direction_to_trackdir[track][dir];
506 * Maps a (4-way) direction to the diagonal track incidating with that diagdir
508 * @param diagdir The direction
509 * @return The resulting Track
511 static inline Track DiagDirToDiagTrack(DiagDirection diagdir)
513 assert(IsValidDiagDirection(diagdir));
514 return (Track)(diagdir & 1);
518 * Maps a (4-way) direction to the diagonal track bits incidating with that diagdir
520 * @param diagdir The direction
521 * @return The resulting TrackBits
523 static inline TrackBits DiagDirToDiagTrackBits(DiagDirection diagdir)
525 assert(IsValidDiagDirection(diagdir));
526 return TrackToTrackBits(DiagDirToDiagTrack(diagdir));
530 * Maps a (4-way) direction to the diagonal trackdir that runs in that
531 * direction.
533 * @param diagdir The direction
534 * @return The resulting Trackdir direction
536 static inline Trackdir DiagDirToDiagTrackdir(DiagDirection diagdir)
538 assert(IsValidDiagDirection(diagdir));
539 extern const Trackdir _dir_to_diag_trackdir[DIAGDIR_END];
540 return _dir_to_diag_trackdir[diagdir];
544 * Returns all trackdirs that can be reached when entering a tile from a given
545 * (diagonal) direction.
547 * This will obviously include 90 degree turns, since no information is available
548 * about the exact angle of entering
550 * @param diagdir The joining direction
551 * @return The TrackdirBits which can be used from the given direction
552 * @see DiagdirReachesTracks
554 static inline TrackdirBits DiagdirReachesTrackdirs(DiagDirection diagdir)
556 assert(IsValidDiagDirection(diagdir));
557 extern const TrackdirBits _exitdir_reaches_trackdirs[DIAGDIR_END];
558 return _exitdir_reaches_trackdirs[diagdir];
562 * Returns all tracks that can be reached when entering a tile from a given
563 * (diagonal) direction.
565 * This will obviously include 90 degree turns, since no
566 * information is available about the exact angle of entering
568 * @param diagdir The joining direction
569 * @return The tracks which can be used
570 * @see DiagdirReachesTrackdirs
572 static inline TrackBits DiagdirReachesTracks(DiagDirection diagdir) { return TrackdirBitsToTrackBits(DiagdirReachesTrackdirs(diagdir)); }
575 * Maps a trackdir to the trackdirs that can be reached from it (ie, when
576 * entering the next tile.
578 * This will include 90 degree turns!
580 * @param trackdir The track direction which will be leaved
581 * @return The track directions which can be used from this direction (in the next tile)
583 static inline TrackdirBits TrackdirReachesTrackdirs(Trackdir trackdir)
585 assert(IsValidTrackdir(trackdir));
586 extern const TrackdirBits _exitdir_reaches_trackdirs[DIAGDIR_END];
587 return _exitdir_reaches_trackdirs[TrackdirToExitdir(trackdir)];
589 /* Note that there is no direct table for this function (there used to be),
590 * but it uses two simpler tables to achieve the result */
593 * Maps a trackdir to all trackdirs that make 90 deg turns with it.
595 * For the diagonal tracks this returns the track direction bits
596 * of the other axis in both directions, which cannot be joined by
597 * the given track direction.
598 * For the straight tracks this returns all possible 90 deg turns
599 * either on the current tile (which no train can joined) or on the
600 * bordering tiles.
602 * @param trackdir The track direction
603 * @return The TrackdirBits which are (more or less) 90 deg turns.
605 static inline TrackdirBits TrackdirCrossesTrackdirs(Trackdir trackdir)
607 assert(IsValidTrackdirForRoadVehicle(trackdir));
608 extern const TrackdirBits _track_crosses_trackdirs[TRACK_END];
609 return _track_crosses_trackdirs[TrackdirToTrack(trackdir)];
613 * Checks if a given Track is diagonal
615 * @param track The given track to check
616 * @return true if diagonal, else false
618 static inline bool IsDiagonalTrack(Track track)
620 assert(IsValidTrack(track));
621 return (track == TRACK_X) || (track == TRACK_Y);
625 * Checks if a given Trackdir is diagonal.
627 * @param trackdir The given trackdir
628 * @return true if the trackdir use a diagonal track
630 static inline bool IsDiagonalTrackdir(Trackdir trackdir)
632 assert(IsValidTrackdir(trackdir));
633 return IsDiagonalTrack(TrackdirToTrack(trackdir));
638 * Checks if the given tracks overlap, ie form a crossing. Basically this
639 * means when there is more than one track on the tile, except when there are
640 * two parallel tracks.
641 * @param bits The tracks present.
642 * @return Whether the tracks present overlap in any way.
644 static inline bool TracksOverlap(TrackBits bits)
646 /* With no, or only one track, there is no overlap */
647 if (bits == TRACK_BIT_NONE || KillFirstBit(bits) == TRACK_BIT_NONE) return false;
648 /* We know that there are at least two tracks present. When there are more
649 * than 2 tracks, they will surely overlap. When there are two, they will
650 * always overlap unless they are lower & upper or right & left. */
651 return bits != TRACK_BIT_HORZ && bits != TRACK_BIT_VERT;
655 * Check if a given track is contained within or overlaps some other tracks.
657 * @param tracks Tracks to be tested against
658 * @param track The track to test
659 * @return true if the track is already in the tracks or overlaps the tracks.
661 static inline bool TrackOverlapsTracks(TrackBits tracks, Track track)
663 if (HasBit(tracks, track)) return true;
664 return TracksOverlap(tracks | TrackToTrackBits(track));
668 * Checks whether the trackdir means that we are reversing.
669 * @param dir the trackdir to check
670 * @return true if it is a reversing road trackdir
672 static inline bool IsReversingRoadTrackdir(Trackdir dir)
674 assert(IsValidTrackdirForRoadVehicle(dir));
675 return (dir & 0x07) >= 6;
679 * Checks whether the given trackdir is a straight road
680 * @param dir the trackdir to check
681 * @return true if it is a straight road trackdir
683 static inline bool IsStraightRoadTrackdir(Trackdir dir)
685 assert(IsValidTrackdirForRoadVehicle(dir));
686 return (dir & 0x06) == 0;
690 * Checks whether a trackdir on a specific slope is going uphill.
692 * Valid for rail and road tracks.
693 * Valid for tile-slopes (under foundation) and foundation-slopes (on foundation).
695 * @param slope The slope of the tile.
696 * @param dir The trackdir of interest.
697 * @return true iff the track goes upwards.
699 static inline bool IsUphillTrackdir(Slope slope, Trackdir dir)
701 assert(IsValidTrackdirForRoadVehicle(dir));
702 extern const TrackdirBits _uphill_trackdirs[];
703 return HasBit(_uphill_trackdirs[RemoveHalftileSlope(slope)], dir);
707 * Determine the side in which the vehicle will leave the tile
709 * @param direction vehicle direction
710 * @param track vehicle track bits
711 * @return side of tile the vehicle will leave
713 static inline DiagDirection VehicleExitDir(Direction direction, TrackBits track)
715 static const TrackBits state_dir_table[DIAGDIR_END] = { TRACK_BIT_RIGHT, TRACK_BIT_LOWER, TRACK_BIT_LEFT, TRACK_BIT_UPPER };
717 DiagDirection diagdir = DirToDiagDir(direction);
719 /* Determine the diagonal direction in which we will exit this tile */
720 if (!HasBit(direction, 0) && track != state_dir_table[diagdir]) {
721 diagdir = ChangeDiagDir(diagdir, DIAGDIRDIFF_90LEFT);
724 return diagdir;
727 #endif /* TRACK_FUNC_H */