OpenTTD
opf_ship.h File Reference

Original pathfinder for ships; very simple. More...

Go to the source code of this file.

Functions

Track OPFShipChooseTrack (const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found)
 Finds the best path for given ship using OPF. More...
 

Detailed Description

Original pathfinder for ships; very simple.

Definition in file opf_ship.h.

Function Documentation

◆ OPFShipChooseTrack()

Track OPFShipChooseTrack ( const Ship v,
TileIndex  tile,
DiagDirection  enterdir,
TrackBits  tracks,
bool &  path_found 
)

Finds the best path for given ship using OPF.

Parameters
vthe ship that needs to find a path
tilethe tile to find the path from (should be next tile the ship is about to enter)
enterdirdiagonal direction which the ship will enter this new tile from
tracksavailable tracks on the new tile (to choose from)
path_found[out] Whether a path has been found (true) or has been guessed (false)
Returns
the best trackdir for next turn or INVALID_TRACK if the path could not be found

Finds the best path for given ship using OPF.

Parameters
vThe ship.
tileThe tile we are about to enter.
enterdirThe direction entering the tile.
tracksThe tracks available on new tile.
[out]path_foundWhether a path has been found.
Returns
Best track on next tile or INVALID_TRACK when better to reverse.

Definition at line 196 of file opf_ship.cpp.