Rework the trip history window layout.
[openttd-joker.git] / src / pathfinder / pathfinder_type.h
blobe4167865be20c60ba1a14547bba56515586061c7
1 /* $Id: pathfinder_type.h 24900 2013-01-08 22:46:42Z planetmaker $ */
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
10 /** @file pathfinder_type.h General types related to pathfinders. */
12 #ifndef PATHFINDER_TYPE_H
13 #define PATHFINDER_TYPE_H
15 #include "../tile_type.h"
17 /** Length (penalty) of one tile with NPF */
18 static const int NPF_TILE_LENGTH = 100;
20 /**
21 * This penalty is the equivalent of "infinite", which means that paths that
22 * get this penalty will be chosen, but only if there is no other route
23 * without it. Be careful with not applying this penalty to often, or the
24 * total path cost might overflow..
26 static const int NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH;
29 /** Length (penalty) of one tile with YAPF */
30 static const int YAPF_TILE_LENGTH = 100;
32 /** Length (penalty) of a corner with YAPF */
33 static const int YAPF_TILE_CORNER_LENGTH = 71;
35 /**
36 * This penalty is the equivalent of "infinite", which means that paths that
37 * get this penalty will be chosen, but only if there is no other route
38 * without it. Be careful with not applying this penalty to often, or the
39 * total path cost might overflow..
41 static const int YAPF_INFINITE_PENALTY = 1000 * YAPF_TILE_LENGTH;
43 /**
44 * Helper container to find a depot
46 struct FindDepotData {
47 TileIndex tile; ///< The tile of the depot
48 uint best_length; ///< The distance towards the depot in penalty, or UINT_MAX if not found
49 bool reverse; ///< True if reversing is necessary for the train to get to this depot
51 /**
52 * Create an instance of this structure.
53 * @param tile the tile of the depot
54 * @param best_length the distance towards the depot, or UINT_MAX if not found
55 * @param reverse whether we need to reverse first.
57 FindDepotData(TileIndex tile = INVALID_TILE, uint best_length = UINT_MAX, bool reverse = false) :
58 tile(tile), best_length(best_length), reverse(reverse)
63 #endif /* PATHFINDER_TYPE_H */