summaryrefslogtreecommitdiff
path: root/pathfind.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-06 20:28:28 +0000
committertron <tron@openttd.org>2006-03-06 20:28:28 +0000
commit49cb8eb470a886dcfebd827dec1fcd8a55c2dffb (patch)
tree410be31dd2267cd8af3257b3d145965515575d34 /pathfind.c
parent995a4572ec150b21f4f2fa401d67f6f6ba75a10a (diff)
downloadopenttd-49cb8eb470a886dcfebd827dec1fcd8a55c2dffb.tar.xz
(svn r3776) Replace many ints and magic numbers by Direction, DiagDirection and friends
Diffstat (limited to 'pathfind.c')
-rw-r--r--pathfind.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/pathfind.c b/pathfind.c
index 15b8efef5..8e0621bd9 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -127,7 +127,7 @@ static const byte _otherdir_mask[4] = {
0x2A,
};
-static void TPFMode2(TrackPathFinder *tpf, TileIndex tile, int direction)
+static void TPFMode2(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
{
uint bits;
int i;
@@ -275,7 +275,7 @@ const byte _ffb_64[128] = {
48,56,56,58,56,60,60,62,
};
-static void TPFMode1(TrackPathFinder *tpf, TileIndex tile, uint direction)
+static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
{
uint bits;
int i;
@@ -343,7 +343,7 @@ static void TPFMode1(TrackPathFinder *tpf, TileIndex tile, uint direction)
return;
tile = tile_org;
- direction ^= 2;
+ direction = ReverseDiagDir(direction);
bits = GetTileTrackStatus(tile, tpf->tracktype);
bits |= (bits >> 8);
@@ -370,7 +370,7 @@ static void TPFMode1(TrackPathFinder *tpf, TileIndex tile, uint direction)
} while (bits != 0);
}
-void FollowTrack(TileIndex tile, uint16 flags, byte direction, TPFEnumProc *enum_proc, TPFAfterProc *after_proc, void *data)
+void FollowTrack(TileIndex tile, uint16 flags, DiagDirection direction, TPFEnumProc *enum_proc, TPFAfterProc *after_proc, void *data)
{
TrackPathFinder tpf;
@@ -506,7 +506,7 @@ static inline void HeapifyDown(NewTrackPathFinder *tpf)
// mark a tile as visited and store the length of the path.
// if we already had a better path to this tile, return false.
// otherwise return true.
-static bool NtpVisit(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint length)
+static bool NtpVisit(NewTrackPathFinder* tpf, TileIndex tile, DiagDirection dir, uint length)
{
uint hash,head;
HashLink *link, *new_link;
@@ -671,7 +671,7 @@ static const byte _length_of_track[16] = {
// Tile is the tile the train is at.
// direction is the tile the train is moving towards.
-static void NTPEnum(NewTrackPathFinder *tpf, TileIndex tile, uint direction)
+static void NTPEnum(NewTrackPathFinder* tpf, TileIndex tile, DiagDirection direction)
{
TrackBits bits, allbits;
uint track;
@@ -912,7 +912,7 @@ start_at:
// new pathfinder for trains. better and faster.
-void NewTrainPathfind(TileIndex tile, TileIndex dest, byte direction, NTPEnumProc *enum_proc, void *data)
+void NewTrainPathfind(TileIndex tile, TileIndex dest, DiagDirection direction, NTPEnumProc* enum_proc, void* data)
{
NewTrackPathFinder tpf;