# opf_ship.h File Reference

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

`#include "../../direction_type.h"`
`#include "../../tile_type.h"`
`#include "../../track_type.h"`
`#include "../../vehicle_type.h"`

Go to the source code of this file.

## Functions
Track | OPFShipChooseTrack (const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
| Finds the best path for given ship using OPF.

## Detailed Description

Original pathfinder for ships; very simple.

Definition in file opf_ship.h.

## Function Documentation

Track OPFShipChooseTrack | ( | const Ship * | v,
|  | TileIndex | tile,
|  | DiagDirection | enterdir,
|  | TrackBits | tracks |
| ) |  |  |

Finds the best path for given ship using OPF.

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_TRACK if the path could not be found

Finds the best path for given ship using OPF.

The tile given is the tile we are about to enter, enterdir is the direction in which we are entering the tile

Definition at line 184 of file opf_ship.cpp.

References DiagdirReachesTracks(), GetTileTrackStatus(), INVALID_TRACK, IsValidDiagDirection(), ReverseDiagDir(), Ship::state, TILE_ADD, TileOffsByDiagDir(), TrackStatusToTrackBits(), and TRANSPORT_WATER.