Update: Translations from eints
[openttd-github.git] / src / pathfinder / pathfinder_type.h
blob93b2561d3215e71a65df1599acd7adac0391c9df
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 */
8 /** @file pathfinder_type.h General types related to pathfinders. */
10 #ifndef PATHFINDER_TYPE_H
11 #define PATHFINDER_TYPE_H
13 #include "../tile_type.h"
15 /** Length (penalty) of one tile with YAPF */
16 static const int YAPF_TILE_LENGTH = 100;
18 /** Length (penalty) of a corner with YAPF */
19 static const int YAPF_TILE_CORNER_LENGTH = 71;
21 /**
22 * This penalty is the equivalent of "infinite", which means that paths that
23 * get this penalty will be chosen, but only if there is no other route
24 * without it. Be careful with not applying this penalty too often, or the
25 * total path cost might overflow.
27 static const int YAPF_INFINITE_PENALTY = 1000 * YAPF_TILE_LENGTH;
29 /** Maximum segments of road vehicle path cache */
30 static const int YAPF_ROADVEH_PATH_CACHE_SEGMENTS = 8;
32 /** Distance from destination road stops to not cache any further */
33 static const int YAPF_ROADVEH_PATH_CACHE_DESTINATION_LIMIT = 8;
35 /**
36 * Helper container to find a depot
38 struct FindDepotData {
39 TileIndex tile; ///< The tile of the depot
40 uint best_length; ///< The distance towards the depot in penalty, or UINT_MAX if not found
41 bool reverse; ///< True if reversing is necessary for the train to get to this depot
43 /**
44 * Create an instance of this structure.
45 * @param tile the tile of the depot
46 * @param best_length the distance towards the depot, or UINT_MAX if not found
47 * @param reverse whether we need to reverse first.
49 FindDepotData(TileIndex tile = INVALID_TILE, uint best_length = UINT_MAX, bool reverse = false) :
50 tile(tile), best_length(best_length), reverse(reverse)
55 #endif /* PATHFINDER_TYPE_H */