OpenTTD Source: src/pathfinder/yapf/yapf_ship_regions.cpp File Reference

OpenTTD Source 15.3

Data Structures | Typedefs | Functions | Variables
yapf_ship_regions.cpp File Reference

Implementation of YAPF for water regions, which are used for finding intermediate ship destinations. More...

`#include "../../stdafx.h"`
`#include "../../ship.h"`
`#include "yapf.hpp"`
`#include "yapf_ship_regions.h"`
`#include "../water_regions.h"`
`#include "../../safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | WaterRegionPatchKey
| Yapf Node Key that represents a single patch of interconnected water within a water region. More...
struct | WaterRegionNode
| Yapf Node for water regions. More...
struct | WaterRegionFollower
struct | WaterRegionTypes
class | YapfShipRegions
| Water region based YAPF implementation for ships. More...

## Typedefs
using | WaterRegionNodeList = NodeList< WaterRegionNode, NODE_LIST_HASH_BITS_OPEN, NODE_LIST_HASH_BITS_CLOSED >

## Functions
uint | ManhattanDistance (const WaterRegionPatchKey &a, const WaterRegionPatchKey &b)
std::vector< WaterRegionPatchDesc > | YapfShipFindWaterRegionPath (const Ship *v, TileIndex start_tile, int max_returned_path_length)
| Finds a path at the water region level.

## Variables
static constexpr int | DIRECT_NEIGHBOUR_COST = 100
static constexpr int | NODES_PER_REGION = 4
static constexpr int | MAX_NUMBER_OF_NODES = 65536
static constexpr int | NODE_LIST_HASH_BITS_OPEN = 12
static constexpr int | NODE_LIST_HASH_BITS_CLOSED = 12

## Detailed Description

Implementation of YAPF for water regions, which are used for finding intermediate ship destinations.

Definition in file yapf_ship_regions.cpp.

## Typedef Documentation

## ◆ WaterRegionNodeList

using WaterRegionNodeList = NodeList<WaterRegionNode, NODE_LIST_HASH_BITS_OPEN, NODE_LIST_HASH_BITS_CLOSED>

Definition at line 76 of file yapf_ship_regions.cpp.

## Function Documentation

## ◆ ManhattanDistance()

uint ManhattanDistance | ( | const WaterRegionPatchKey & | a,
|  | const WaterRegionPatchKey & | b
| ) |  |
| inline

Definition at line 39 of file yapf_ship_regions.cpp.

## ◆ YapfShipFindWaterRegionPath()

std::vector< WaterRegionPatchDesc > YapfShipFindWaterRegionPath | ( | const Ship * | v,
|  | TileIndex | start_tile,
|  | int | max_returned_path_length
| ) |  |

Finds a path at the water region level.

Note that the starting region is always included if the path was found.

Parameters

  v | The ship to find a path for.
  start_tile | The tile to start searching from.
  max_returned_path_length | The maximum length of the path that will be returned.

Returns
  A path of water region patches, or an empty vector if no path was found.

Definition at line 228 of file yapf_ship_regions.cpp.

## Variable Documentation

## ◆ DIRECT_NEIGHBOUR_COST

constexpr int DIRECT_NEIGHBOUR_COST = 100
| staticconstexpr

Definition at line 19 of file yapf_ship_regions.cpp.

## ◆ MAX_NUMBER_OF_NODES

constexpr int MAX_NUMBER_OF_NODES = 65536
| staticconstexpr

Definition at line 21 of file yapf_ship_regions.cpp.

## ◆ NODE_LIST_HASH_BITS_CLOSED

constexpr int NODE_LIST_HASH_BITS_CLOSED = 12
| staticconstexpr

Definition at line 24 of file yapf_ship_regions.cpp.

## ◆ NODE_LIST_HASH_BITS_OPEN

constexpr int NODE_LIST_HASH_BITS_OPEN = 12
| staticconstexpr

Definition at line 23 of file yapf_ship_regions.cpp.

## ◆ NODES_PER_REGION

constexpr int NODES_PER_REGION = 4
| staticconstexpr

Definition at line 20 of file yapf_ship_regions.cpp.