yapf_road.cpp File Reference

The road pathfinding. More...

#include "../stdafx.h"
#include "../depot_base.h"
#include "yapf.hpp"
#include "yapf_node_road.hpp"

Go to the source code of this file.

Data Structures

class  CYapfCostRoadT< Types >
class  CYapfDestinationAnyDepotRoadT< Types >
class  CYapfDestinationTileRoadT< Types >
class  CYapfFollowRoadT< Types >
struct  CYapfRoad_TypesT< Tpf_, Tnode_list, Tdestination >
struct  CYapfRoad1
struct  CYapfRoad2
struct  CYapfRoadAnyDepot1
struct  CYapfRoadAnyDepot2

Functions

Trackdir YapfChooseRoadTrack (const Vehicle *v, TileIndex tile, DiagDirection enterdir)
 Finds the best path for given road vehicle.
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.


Detailed Description

The road pathfinding.

Definition in file yapf_road.cpp.


Function Documentation

Trackdir YapfChooseRoadTrack ( const 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 433 of file yapf_road.cpp.

References _settings_game, YAPFSettings::disable_node_optimization, GameSettings::pf, and PathfinderSettings::yapf.

Referenced by RoadFindPathToDest().

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 469 of file yapf_road.cpp.

References _settings_game, YAPFSettings::disable_node_optimization, GetDepotByTile(), GetTileTrackStatus(), GetVehicleTrackdir(), GameSettings::pf, TrackdirToTrackdirBits(), TrackStatusToTrackdirBits(), TRANSPORT_ROAD, and PathfinderSettings::yapf.

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 448 of file yapf_road.cpp.

References _settings_game, YAPFSettings::disable_node_optimization, GameSettings::pf, and PathfinderSettings::yapf.


Generated on Wed Jun 3 19:05:31 2009 for OpenTTD by  doxygen 1.5.6