OpenTTD Source: src/pathfinder/pathfinder_type.h Source File

OpenTTD Source 14.1

pathfinder_type.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10 #ifndef PATHFINDER_TYPE_H
11 #define PATHFINDER_TYPE_H
12
13 #include "../tile_type.h"
14 #include "npf/aystar.h"
15
17 static const int NPF_TILE_LENGTH = 100;
18
25 static const int NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH;
26
27
29 static const int YAPF_TILE_LENGTH = 100;
30
32 static const int YAPF_TILE_CORNER_LENGTH = 71;
33
40 static const int YAPF_INFINITE_PENALTY = 1000 * YAPF_TILE_LENGTH;
41
43 static const int YAPF_ROADVEH_PATH_CACHE_SEGMENTS = 8;
44
46 static const int YAPF_ROADVEH_PATH_CACHE_DESTINATION_LIMIT = 8;
47
51 struct FindDepotData {
52 TileIndex tile;
53 uint best_length;
54 bool reverse;
55
62 FindDepotData(TileIndex tile = INVALID_TILE, uint best_length = UINT_MAX, bool reverse = false) :
63 tile(tile), best_length(best_length), reverse(reverse)
64 {
65 }
66 };
67
68 #endif /* PATHFINDER_TYPE_H */
FindDepotData
Helper container to find a depot.
Definition: pathfinder_type.h:51
NPF_INFINITE_PENALTY
static const int NPF_INFINITE_PENALTY
This penalty is the equivalent of "infinite", which means that paths that get this penalty will be ch...
Definition: pathfinder_type.h:25
FindDepotData::reverse
bool reverse
True if reversing is necessary for the train to get to this depot.
Definition: pathfinder_type.h:54
INVALID_TILE
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:95
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
FindDepotData::best_length
uint best_length
The distance towards the depot in penalty, or UINT_MAX if not found.
Definition: pathfinder_type.h:53
YAPF_TILE_LENGTH
static const int YAPF_TILE_LENGTH
Length (penalty) of one tile with YAPF.
Definition: pathfinder_type.h:29
YAPF_ROADVEH_PATH_CACHE_SEGMENTS
static const int YAPF_ROADVEH_PATH_CACHE_SEGMENTS
Maximum segments of road vehicle path cache.
Definition: pathfinder_type.h:43
NPF_TILE_LENGTH
static const int NPF_TILE_LENGTH
Length (penalty) of one tile with NPF.
Definition: pathfinder_type.h:17
FindDepotData::tile
TileIndex tile
The tile of the depot.
Definition: pathfinder_type.h:52
YAPF_INFINITE_PENALTY
static const int YAPF_INFINITE_PENALTY
This penalty is the equivalent of "infinite", which means that paths that get this penalty will be ch...
Definition: pathfinder_type.h:40
YAPF_TILE_CORNER_LENGTH
static const int YAPF_TILE_CORNER_LENGTH
Length (penalty) of a corner with YAPF.
Definition: pathfinder_type.h:32
YAPF_ROADVEH_PATH_CACHE_DESTINATION_LIMIT
static const int YAPF_ROADVEH_PATH_CACHE_DESTINATION_LIMIT
Distance from destination road stops to not cache any further.
Definition: pathfinder_type.h:46
aystar.h
FindDepotData::FindDepotData
FindDepotData(TileIndex tile=INVALID_TILE, uint best_length=UINT_MAX, bool reverse=false)
Create an instance of this structure.
Definition: pathfinder_type.h:62