OpenTTD Source: src/pathfinder/yapf/yapf_common.hpp File Reference

OpenTTD Source 15.3

Data Structures | Functions
yapf_common.hpp File Reference

Commonly used classes and utilities for YAPF. More...

`#include "../../core/bitmath_func.hpp"`
`#include "../../tile_type.h"`
`#include "../../track_type.h"`

Go to the source code of this file.

## Data Structures
class | CYapfOriginTileT< Types >
| YAPF origin provider base class - used when origin is one tile / multiple trackdirs. More...
class | CYapfOriginTileTwoWayT< Types >
| YAPF origin provider base class - used when there are two tile/trackdir origins. More...
class | CYapfT< Ttypes >
| YAPF template that uses Ttypes template argument to determine all YAPF components (base classes) from which the actual YAPF is composed. More...

## Functions
int | OctileDistanceCost (TileIndex start_tile, Trackdir start_td, TileIndex destination_tile)
| Calculates the octile distance cost between a starting tile / trackdir and a destination tile.

## Detailed Description

Commonly used classes and utilities for YAPF.

Definition in file yapf_common.hpp.

## Function Documentation

## ◆ OctileDistanceCost()

int OctileDistanceCost | ( | TileIndex | start_tile,
|  | Trackdir | start_td,
|  | TileIndex | destination_tile
| ) |  |
| inline

Calculates the octile distance cost between a starting tile / trackdir and a destination tile.

Parameters

  start_tile | Starting tile.
  start_td | Starting trackdir.
  destination_tile | Destination tile.

Returns
  Octile distance cost between starting tile / trackdir and destination tile.

Definition at line 104 of file yapf_common.hpp.

References abs(), TileX(), TileY(), TrackdirToExitdir(), YAPF_TILE_CORNER_LENGTH, and YAPF_TILE_LENGTH.

Referenced by CYapfDestinationTileOrStationRailT< Types >::PfCalcEstimate(), CYapfDestinationTileRoadT< Types >::PfCalcEstimate(), and CYapfDestinationTileWaterT< Types >::PfCalcEstimate().