yapf.h File Reference

#include "../debug.h"

Go to the source code of this file.

Enumerations

enum  { YAPF_TILE_LENGTH = 100, YAPF_TILE_CORNER_LENGTH = 71 }
 Base tile length units.

Functions

Trackdir YapfChooseShipTrack (Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
 Finds the best path for given ship.
Trackdir YapfChooseRoadTrack (Vehicle *v, TileIndex tile, DiagDirection enterdir)
 Finds the best path for given road vehicle.
Trackdir YapfChooseRailTrack (Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found)
 Finds the best path for given train.
uint YapfRoadVehDistanceToTile (const Vehicle *v, TileIndex tile)
 Used by RV multistop feature to find the nearest road stop that has a free slot.
Depot * YapfFindNearestRoadDepot (const Vehicle *v)
 Used when user sends RV to the nearest depot or if RV needs servicing.
bool YapfFindNearestRailDepotTwoWay (Vehicle *v, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed)
 Used when user sends train to the nearest depot or if train needs servicing.
bool YapfCheckReverseTrain (Vehicle *v)
 Returns true if it is better to reverse the train before leaving station.
void YapfNotifyTrackLayoutChange (TileIndex tile, Track track)
 Use this function to notify YAPF that track layout (or signal configuration) has change.
void * NpfBeginInterval ()
 performance measurement helpers
int NpfEndInterval (void *perf)
 performance measurement helper

Variables

int _aystar_stats_open_size
int _aystar_stats_closed_size


Detailed Description

Definition in file yapf.h.


Function Documentation

Trackdir YapfChooseRailTrack ( Vehicle *  v,
TileIndex  tile,
DiagDirection  enterdir,
TrackBits  tracks,
bool *  path_not_found 
)

Finds the best path for given train.

Parameters:
v the train that needs to find a path
tile the tile to find the path from (should be next tile the train is about to enter)
enterdir diagonal direction which the RV will enter this new tile from
tracks available trackdirs on the new tile (to choose from)
path_not_found [out] true is returned if no path can be found (returned Trackdir is only a 'guess')
Returns:
the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found

Definition at line 250 of file yapf_rail.cpp.

Trackdir YapfChooseRoadTrack ( Vehicle *  v,
TileIndex  tile,
DiagDirection  enterdir 
)

Finds the best path for given road vehicle.

Parameters:
v the RV that needs to find a path
tile the tile to find the path from (should be next tile the RV is about to enter)
enterdir diagonal direction which the RV will enter this new tile from
Returns:
the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found

Definition at line 403 of file yapf_road.cpp.

Referenced by RoadFindPathToDest().

Trackdir YapfChooseShipTrack ( Vehicle *  v,
TileIndex  tile,
DiagDirection  enterdir,
TrackBits  tracks 
)

Finds the best path for given ship.

Parameters:
v the ship that needs to find a path
tile the tile to find the path from (should be next tile the ship is about to enter)
enterdir diagonal direction which the ship will enter this new tile from
tracks available tracks on the new tile (to choose from)
Returns:
the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found

Definition at line 150 of file yapf_ship.cpp.

References ChooseShipTrack().

Referenced by ChooseShipTrack().

bool YapfFindNearestRailDepotTwoWay ( Vehicle *  v,
int  max_distance,
int  reverse_penalty,
TileIndex depot_tile,
bool *  reversed 
)

Used when user sends train to the nearest depot or if train needs servicing.

Parameters:
v train that needs to go to some depot
max_distance max distance (number of track tiles) from the current train position (used also as optimization - the pathfinder can stop path finding if max_distance was reached and no depot was seen)
reverse_penalty penalty that should be added for the path that requires reversing the train first
depot_tile receives the depot tile if depot was found
reversed receives true if train needs to reversed first
Returns:
the true if depot was found.

Definition at line 326 of file yapf_rail.cpp.

References GetVehicleTrackdir(), INVALID_TILE, and ReverseTrackdir().

Referenced by FindClosestTrainDepot().

Depot* YapfFindNearestRoadDepot ( const Vehicle *  v  ) 

Used when user sends RV to the nearest depot or if RV needs servicing.

Returns the nearest depot (or NULL if depot was not found).

Definition at line 435 of file yapf_road.cpp.

References GetDepotByTile(), GetVehicleTrackdir(), IsTileDepotType(), IsTileType(), MP_ROAD, TrackdirToTrackdirBits(), and TrackStatusToTrackdirBits().

uint YapfRoadVehDistanceToTile ( const Vehicle *  v,
TileIndex  tile 
)

Used by RV multistop feature to find the nearest road stop that has a free slot.

Parameters:
v RV (its current tile will be the origin)
tile destination tile
Returns:
distance from origin tile to the destination (number of road tiles) or UINT_MAX if path not found

Definition at line 417 of file yapf_road.cpp.


Generated on Mon Sep 22 20:34:32 2008 for openttd by  doxygen 1.5.6