OpenTTD
|
Implementation of the oldest supported ship pathfinder. More...
#include "../../stdafx.h"
#include "../../tunnelbridge_map.h"
#include "../../tunnelbridge.h"
#include "../../ship.h"
#include "../../core/random_func.hpp"
#include "../../safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | RememberData |
struct | TrackPathFinder |
Functions | |
static bool | ShipTrackFollower (TileIndex tile, TrackPathFinder *pfs, uint length) |
static void | TPFModeShip (TrackPathFinder *tpf, TileIndex tile, DiagDirection direction) |
static void | OPFShipFollowTrack (TileIndex tile, DiagDirection direction, TrackPathFinder *tpf) |
static uint | FindShipTrack (const Ship *v, TileIndex tile, DiagDirection dir, TrackBits bits, TileIndex skiptile, Track *track) |
Track | OPFShipChooseTrack (const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found) |
Finds the best track to choose on the next tile and returns INVALID_TRACK when it is better to reverse. More... | |
Variables | |
static const DiagDirection | _ship_search_directions [6][4] |
Directions to search towards given track bits and the ship's enter direction. More... | |
static const byte | _pick_shiptrack_table [6] = {DIR_NE, DIR_SE, DIR_E, DIR_E, DIR_N, DIR_N} |
Track to "direction (& 3)" mapping. More... | |
Implementation of the oldest supported ship pathfinder.
Definition in file opf_ship.cpp.
Track OPFShipChooseTrack | ( | const Ship * | v, |
TileIndex | tile, | ||
DiagDirection | enterdir, | ||
TrackBits | tracks, | ||
bool & | path_found | ||
) |
Finds the best track to choose on the next tile and returns INVALID_TRACK when it is better to reverse.
Finds the best path for given ship using OPF.
v | The ship. | |
tile | The tile we are about to enter. | |
enterdir | The direction entering the tile. | |
tracks | The tracks available on new tile. | |
[out] | path_found | Whether a path has been found. |
Definition at line 196 of file opf_ship.cpp.
Track to "direction (& 3)" mapping.
Definition at line 134 of file opf_ship.cpp.
|
static |
Directions to search towards given track bits and the ship's enter direction.
Definition at line 124 of file opf_ship.cpp.