OpenTTD Source: src/pathfinder/yapf/yapf_node_ship.hpp Source File

OpenTTD Source 15.0-beta1

yapf_node_ship.hpp
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 YAPF_NODE_SHIP_HPP
11#define YAPF_NODE_SHIP_HPP
12
13#include "../../tile_type.h"
14#include "../../track_type.h"
15#include "nodelist.hpp"
16#include "yapf_node.hpp"
17
19template <class Tkey_>
20 struct CYapfShipNodeT : CYapfNodeT<Tkey_, CYapfShipNodeT<Tkey_> > {
21 typedef CYapfNodeT<Tkey_, CYapfShipNodeT<Tkey_> > base;
22
23 TileIndex segment_last_tile;
24 Trackdir segment_last_td;
25
26 void Set(CYapfShipNodeT *parent, TileIndex tile, Trackdir td, bool is_choice)
27 {
28 this->base::Set(parent, tile, td, is_choice);
29 this->segment_last_tile = tile;
30 this->segment_last_td = td;
31 }
32};
33
34/* now define two major node types (that differ by key type) */
35typedef CYapfShipNodeT<CYapfNodeKeyExitDir> CYapfShipNodeExitDir;
36typedef CYapfShipNodeT<CYapfNodeKeyTrackDir> CYapfShipNodeTrackDir;
37
38/* Default NodeList types */
39typedef NodeList<CYapfShipNodeExitDir , 10, 12> CShipNodeListExitDir;
40typedef NodeList<CYapfShipNodeTrackDir, 10, 12> CShipNodeListTrackDir;
41
42#endif /* YAPF_NODE_SHIP_HPP */
NodeList
Hash table based node list multi-container class.
Definition nodelist.hpp:21
nodelist.hpp
List of nodes used for the A-star pathfinder.
CYapfNodeT
Yapf Node base.
Definition yapf_node.hpp:62
CYapfShipNodeT
Yapf Node for ships.
Definition yapf_node_ship.hpp:20
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
Trackdir
Trackdir
Enumeration for tracks and directions.
Definition track_type.h:67
yapf_node.hpp
Node in the pathfinder's graph.