src/npf.h
changeset 8732 b18f578f7c16
parent 8638 d997e3a75b36
child 9006 f68ac871be5c
equal deleted inserted replaced
8731:a2cab8a23491 8732:b18f578f7c16
     8 #include "aystar.h"
     8 #include "aystar.h"
     9 #include "station.h"
     9 #include "station.h"
    10 #include "vehicle_type.h"
    10 #include "vehicle_type.h"
    11 #include "tile_type.h"
    11 #include "tile_type.h"
    12 #include "track_type.h"
    12 #include "track_type.h"
       
    13 #include "core/bitmath_func.hpp"
    13 
    14 
    14 /* mowing grass */
    15 /* mowing grass */
    15 enum {
    16 enum {
    16 	NPF_HASH_BITS = 12, ///< The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value.
    17 	NPF_HASH_BITS = 12, ///< The size of the hash used in pathfinding. Just changing this value should be sufficient to change the hash size. Should be an even value.
    17 	/* Do no change below values */
    18 	/* Do no change below values */
    75 /* These functions below are _not_ re-entrant, in favor of speed! */
    76 /* These functions below are _not_ re-entrant, in favor of speed! */
    76 
    77 
    77 /* Will search from the given tile and direction, for a route to the given
    78 /* Will search from the given tile and direction, for a route to the given
    78  * station for the given transport type. See the declaration of
    79  * station for the given transport type. See the declaration of
    79  * NPFFoundTargetData above for the meaning of the result. */
    80  * NPFFoundTargetData above for the meaning of the result. */
    80 NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypeMask railtypes);
    81 NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
    81 
    82 
    82 /* Will search as above, but with two start nodes, the second being the
    83 /* Will search as above, but with two start nodes, the second being the
    83  * reverse. Look at the NPF_FLAG_REVERSE flag in the result node to see which
    84  * reverse. Look at the NPF_FLAG_REVERSE flag in the result node to see which
    84  * direction was taken (NPFGetBit(result.node, NPF_FLAG_REVERSE)) */
    85  * direction was taken (NPFGetBit(result.node, NPF_FLAG_REVERSE)) */
    85 NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir trackdir1, TileIndex tile2, Trackdir trackdir2, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypeMask railtypes);
    86 NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir trackdir1, TileIndex tile2, Trackdir trackdir2, NPFFindStationOrTileData* target, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
    86 
    87 
    87 /* Will search a route to the closest depot. */
    88 /* Will search a route to the closest depot. */
    88 
    89 
    89 /* Search using breadth first. Good for little track choice and inaccurate
    90 /* Search using breadth first. Good for little track choice and inaccurate
    90  * heuristic, such as railway/road.*/
    91  * heuristic, such as railway/road.*/
    91 NPFFoundTargetData NPFRouteToDepotBreadthFirst(TileIndex tile, Trackdir trackdir, TransportType type, uint sub_type, Owner owner, RailTypeMask railtypes);
    92 NPFFoundTargetData NPFRouteToDepotBreadthFirst(TileIndex tile, Trackdir trackdir, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
    92 /* Same as above but with two start nodes, the second being the reverse. Call
    93 /* Same as above but with two start nodes, the second being the reverse. Call
    93  * NPFGetBit(result.node, NPF_FLAG_REVERSE) to see from which node the path
    94  * NPFGetBit(result.node, NPF_FLAG_REVERSE) to see from which node the path
    94  * orginated. All pathfs from the second node will have the given
    95  * orginated. All pathfs from the second node will have the given
    95  * reverse_penalty applied (NPF_TILE_LENGTH is the equivalent of one full
    96  * reverse_penalty applied (NPF_TILE_LENGTH is the equivalent of one full
    96  * tile).
    97  * tile).
    97  */
    98  */
    98 NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Trackdir trackdir1, TileIndex tile2, Trackdir trackdir2, TransportType type, uint sub_type, Owner owner, RailTypeMask railtypes, uint reverse_penalty);
    99 NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Trackdir trackdir1, TileIndex tile2, Trackdir trackdir2, TransportType type, uint sub_type, Owner owner, RailTypes railtypes, uint reverse_penalty);
    99 /* Search by trying each depot in order of Manhattan Distance. Good for lots
   100 /* Search by trying each depot in order of Manhattan Distance. Good for lots
   100  * of choices and accurate heuristics, such as water. */
   101  * of choices and accurate heuristics, such as water. */
   101 NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir, TransportType type, uint sub_type, Owner owner, RailTypeMask railtypes);
   102 NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir, TransportType type, uint sub_type, Owner owner, RailTypes railtypes);
   102 
   103 
   103 void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v);
   104 void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v);
   104 
   105 
   105 
   106 
   106 /*
   107 /*