33 * this in a nicer way :-) |
33 * this in a nicer way :-) |
34 */ |
34 */ |
35 NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH |
35 NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH |
36 }; |
36 }; |
37 |
37 |
38 typedef struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */ |
38 struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */ |
39 TileIndex dest_coords; /* An indication of where the station is, for heuristic purposes, or the target tile */ |
39 TileIndex dest_coords; /* An indication of where the station is, for heuristic purposes, or the target tile */ |
40 StationID station_index; /* station index we're heading for, or INVALID_STATION when we're heading for a tile */ |
40 StationID station_index; /* station index we're heading for, or INVALID_STATION when we're heading for a tile */ |
41 } NPFFindStationOrTileData; |
41 }; |
42 |
42 |
43 enum { /* Indices into AyStar.userdata[] */ |
43 enum { /* Indices into AyStar.userdata[] */ |
44 NPF_TYPE = 0, /* Contains a TransportTypes value */ |
44 NPF_TYPE = 0, /* Contains a TransportTypes value */ |
45 NPF_OWNER, /* Contains an Owner value */ |
45 NPF_OWNER, /* Contains an Owner value */ |
46 NPF_RAILTYPES, /* Contains a bitmask the compatible RailTypes of the engine when NPF_TYPE == TRANSPORT_RAIL. Unused otherwise. */ |
46 NPF_RAILTYPES, /* Contains a bitmask the compatible RailTypes of the engine when NPF_TYPE == TRANSPORT_RAIL. Unused otherwise. */ |
49 enum { /* Indices into AyStarNode.userdata[] */ |
49 enum { /* Indices into AyStarNode.userdata[] */ |
50 NPF_TRACKDIR_CHOICE = 0, /* The trackdir chosen to get here */ |
50 NPF_TRACKDIR_CHOICE = 0, /* The trackdir chosen to get here */ |
51 NPF_NODE_FLAGS, |
51 NPF_NODE_FLAGS, |
52 }; |
52 }; |
53 |
53 |
54 typedef enum { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */ |
54 enum NPFNodeFlag { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */ |
55 NPF_FLAG_SEEN_SIGNAL, /* Used to mark that a signal was seen on the way, for rail only */ |
55 NPF_FLAG_SEEN_SIGNAL, /* Used to mark that a signal was seen on the way, for rail only */ |
56 NPF_FLAG_REVERSE, /* Used to mark that this node was reached from the second start node, if applicable */ |
56 NPF_FLAG_REVERSE, /* Used to mark that this node was reached from the second start node, if applicable */ |
57 NPF_FLAG_LAST_SIGNAL_RED, /* Used to mark that the last signal on this path was red */ |
57 NPF_FLAG_LAST_SIGNAL_RED, /* Used to mark that the last signal on this path was red */ |
58 } NPFNodeFlag; |
58 }; |
59 |
59 |
60 typedef struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */ |
60 struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */ |
61 uint best_bird_dist; /* The best heuristic found. Is 0 if the target was found */ |
61 uint best_bird_dist; /* The best heuristic found. Is 0 if the target was found */ |
62 uint best_path_dist; /* The shortest path. Is (uint)-1 if no path is found */ |
62 uint best_path_dist; /* The shortest path. Is (uint)-1 if no path is found */ |
63 Trackdir best_trackdir; /* The trackdir that leads to the shortest path/closest birds dist */ |
63 Trackdir best_trackdir; /* The trackdir that leads to the shortest path/closest birds dist */ |
64 AyStarNode node; /* The node within the target the search led us to */ |
64 AyStarNode node; /* The node within the target the search led us to */ |
65 } NPFFoundTargetData; |
65 }; |
66 |
66 |
67 /* These functions below are _not_ re-entrant, in favor of speed! */ |
67 /* These functions below are _not_ re-entrant, in favor of speed! */ |
68 |
68 |
69 /* Will search from the given tile and direction, for a route to the given |
69 /* Will search from the given tile and direction, for a route to the given |
70 * station for the given transport type. See the declaration of |
70 * station for the given transport type. See the declaration of |