npf.h
author Darkvater
Sat, 02 Apr 2005 23:05:09 +0000
changeset 1632 c4ae19bfebf7
parent 1459 6c1f01803928
child 1661 6af0c4416154
permissions -rw-r--r--
(svn r2136) - Fix: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
- Fix: 'L' no longer opens ingame terraform bar in scenario editor bar, but the land generator one
- Feature: [ 1095110 ] Create Lake and draggable Create Desert tools (initial implementation GoneWacko), also added sticky buttons to land generator and town generator
- CodeChange: moved around some of the draggable tools, demystifying them
- CodeChange: change CmdBuildCanal to allow for XANDY dragging not only X or Y (only scenario editor)
- CodeChange: add some more enums to sprites.
- TODO: merge most of the ingame and scenario editor land terraform code. This can only be done after OnClickButton function is changed so it also includes the backreference to the widget being clicked, postponed to after 0.4.0
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     1
#ifndef NPF_H
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     2
#define NPF_H
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     3
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     4
#include "ttd.h"
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     5
#include "aystar.h"
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     6
#include "vehicle.h"
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     7
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     8
//#define NPF_DEBUG
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
     9
//#define NPF_MARKROUTE //Mark the routes considered by the pathfinder by
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    10
//mowing grass
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    11
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    12
typedef struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    13
	TileIndex dest_coords; /* An indication of where the station is, for heuristic purposes, or the target tile */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    14
	int station_index; /* station index we're heading for, or -1 when we're heading for a tile */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    15
} NPFFindStationOrTileData;
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    16
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    17
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
    18
	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
    19
	NPF_OWNER, /* Contains an Owner value */
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    20
};
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    21
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    22
enum { /* Indices into AyStarNode.userdata[] */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    23
	NPF_TRACKDIR_CHOICE = 0, /* The trackdir chosen to get here */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    24
	NPF_NODE_FLAGS,
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    25
};
1459
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    26
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
    27
	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
    28
	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
    29
	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
    30
	NPF_FLAG_TARGET_CHECKED, /* Used by end node checking function of npf to mark
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    31
														 that they have evaluated this node. When this
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    32
														 flag is on, NPF_FLAG_IS_TARGET is on when the
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    33
														 node is a target, and off when it is not. Should
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    34
														 never be used directly, only by the end node
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    35
														 checking functions for caching of results. */
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    36
	NPF_FLAG_IS_TARGET, /* See comment for NPF_FLAG_TARGET_CHECKED */
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    37
} NPFNodeFlag;
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    38
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    39
typedef struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    40
	uint best_bird_dist; /* The best heuristic found. Is 0 if the target was found */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    41
	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
    42
	byte best_trackdir; /* The trackdir that leads to the shortest path/closest birds dist */
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    43
	AyStarNode node; /* The node within the target the search led us to */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    44
} NPFFoundTargetData;
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    45
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    46
/* These functions below are _not_ re-entrant, in favor of speed! */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    47
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    48
/* Will search from the given tile and direction, for a route to the given
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    49
 * station for the given transport type. See the declaration of
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    50
 * 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
    51
NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, byte trackdir, NPFFindStationOrTileData* target, TransportType type, Owner owner);
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    52
/* 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
    53
 * 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
    54
 * 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
    55
NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, byte trackdir1, TileIndex tile2, byte trackdir2, NPFFindStationOrTileData* target, TransportType type, Owner owner);
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    56
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    57
/* Will search a route to the closest depot. */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    58
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    59
/* Search using breadth first. Good for little track choice and inaccurate
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    60
 * 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
    61
NPFFoundTargetData NPFRouteToDepotBreadthFirst(TileIndex tile, byte trackdir, TransportType type, Owner owner);
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    62
/* 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
    63
 * 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
    64
NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, byte trackdir, TransportType type, Owner owner);
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    65
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    66
void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v);
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    67
1459
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    68
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    69
/*
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    70
 * 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
    71
 */
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    72
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    73
/**
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    74
 * 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
    75
 */
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    76
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
    77
{
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    78
	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
    79
}
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    80
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    81
/**
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    82
 * 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
    83
 */
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    84
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
    85
{
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    86
	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
    87
		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
    88
	else
6c1f01803928 (svn r1963) - Add: [NPF] Penalty for a red signal that is the last signal on the path.
matthijs
parents: 1330
diff changeset
    89
		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
    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
1247
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    92
/*
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    93
 * Some tables considering tracks, directions and signals.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    94
 * XXX: Better place to but these?
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    95
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    96
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    97
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    98
 * Maps a trackdir to the bit that stores its status in the map arrays, in the
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
    99
 * direction along with the trackdir.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   100
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   101
const byte _signal_along_trackdir[14];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   102
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   103
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   104
 * Maps a trackdir to the bit that stores its status in the map arrays, in the
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   105
 * direction against the trackdir.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   106
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   107
const byte _signal_against_trackdir[14];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   108
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   109
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   110
 * Maps a trackdir to the trackdirs that can be reached from it (ie, when
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   111
 * entering the next tile.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   112
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   113
const uint16 _trackdir_reaches_trackdirs[14];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   114
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   115
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   116
 * Maps a trackdir to all trackdirs that make 90 deg turns with it.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   117
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   118
const uint16 _trackdir_crosses_trackdirs[14];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   119
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   120
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   121
 * Maps a track to all tracks that make 90 deg turns with it.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   122
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   123
const byte _track_crosses_tracks[6];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   124
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   125
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   126
 * Maps a trackdir to the (4-way) direction the tile is exited when following
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   127
 * that trackdir.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   128
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   129
const byte _trackdir_to_exitdir[14];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   130
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   131
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   132
 * Maps a track and an (4-way) dir to the trackdir that represents the track
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   133
 * with the exit in the given direction.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   134
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   135
const byte _track_exitdir_to_trackdir[6][4];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   136
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   137
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   138
 * Maps a track and a full (8-way) direction to the trackdir that represents
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   139
 * the track running in the given direction.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   140
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   141
const byte _track_direction_to_trackdir[6][8];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   142
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   143
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   144
 * Maps a (4-way) direction to the diagonal track that runs in that
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   145
 * direction.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   146
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   147
const byte _dir_to_diag_trackdir[4];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   148
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   149
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   150
 * Maps a (4-way) direction to the reverse.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   151
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   152
const byte _reverse_dir[4];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   153
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   154
/**
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   155
 * Maps a trackdir to the reverse trackdir.
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   156
 */
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   157
const byte _reverse_trackdir[14];
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   158
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   159
#define REVERSE_TRACKDIR(trackdir) (trackdir ^ 0x8)
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   160
01711347f9ac (svn r1751) - Feature: New PathFinder (NPF).
matthijs
parents:
diff changeset
   161
#endif // NPF_H