yapf_rail.cpp File Reference

#include "../stdafx.h"
#include "yapf.hpp"
#include "yapf_node_rail.hpp"
#include "yapf_costrail.hpp"
#include "yapf_destrail.hpp"
#include "../vehicle_func.h"

Go to the source code of this file.

Data Structures

class  CYapfFollowAnyDepotRailT< Types >
class  CYapfFollowRailT< Types >
struct  CYapfRail_TypesT< Tpf_, Ttrack_follower, Tnode_list, TdestinationT, TfollowT >
struct  CYapfRail1
struct  CYapfRail2
struct  CYapfAnyDepotRail1
struct  CYapfAnyDepotRail2

Defines

#define DEBUG_YAPF_CACHE   0

Functions

Trackdir YapfChooseRailTrack (Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found)
 Finds the best path for given train.
bool YapfCheckReverseTrain (Vehicle *v)
 Returns true if it is better to reverse the train before leaving station.
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.
void YapfNotifyTrackLayoutChange (TileIndex tile, Track track)
 Use this function to notify YAPF that track layout (or signal configuration) has change.

Variables

int _total_pf_time_us = 0


Detailed Description

Definition in file yapf_rail.cpp.


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.

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().


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