Files @ r19086:cf77bf636a75
Branch filter:

Location: cpp/openttd-patchpack/source/src/pathfinder/yapf/yapf.h - annotation

michi_cc
(svn r23954) -Fix (r23952): Update required grfcodec version.
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r16850:82c7acc31833
r16850:82c7acc31833
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r14248:a9050881acd7
r14248:a9050881acd7
r13832:e17769fa4653
r13825:5de0a5d39b9e
r13829:20bef1fbce49
r13829:20bef1fbce49
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r16768:069c18958074
r13828:41995609971a
r13825:5de0a5d39b9e
r16768:069c18958074
r13825:5de0a5d39b9e
r13834:d933d863ff81
r13834:d933d863ff81
r13834:d933d863ff81
r13834:d933d863ff81
r13834:d933d863ff81
r13834:d933d863ff81
r16767:09527fa31974
r13834:d933d863ff81
r13825:5de0a5d39b9e
r16767:09527fa31974
r13825:5de0a5d39b9e
r13832:e17769fa4653
r13832:e17769fa4653
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r16766:61f33c5e3a5b
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13832:e17769fa4653
r13825:5de0a5d39b9e
r16766:61f33c5e3a5b
r13825:5de0a5d39b9e
r13834:d933d863ff81
r13834:d933d863ff81
r13825:5de0a5d39b9e
r13935:e0b7841f69a5
r13935:e0b7841f69a5
r13825:5de0a5d39b9e
r13834:d933d863ff81
r13825:5de0a5d39b9e
r13935:e0b7841f69a5
r13825:5de0a5d39b9e
r13832:e17769fa4653
r13832:e17769fa4653
r13825:5de0a5d39b9e
r17629:21e9dfd343cd
r13935:e0b7841f69a5
r13825:5de0a5d39b9e
r13832:e17769fa4653
r13825:5de0a5d39b9e
r13832:e17769fa4653
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13832:e17769fa4653
r13832:e17769fa4653
r13832:e17769fa4653
r13832:e17769fa4653
r13832:e17769fa4653
r13832:e17769fa4653
r13832:e17769fa4653
r13832:e17769fa4653
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13832:e17769fa4653
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
r13832:e17769fa4653
r13825:5de0a5d39b9e
r13825:5de0a5d39b9e
/* $Id$ */

/*
 * This file is part of OpenTTD.
 * 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.
 * 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.
 * 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/>.
 */

/** @file yapf.h Entry point for OpenTTD to YAPF. */

#ifndef YAPF_H
#define YAPF_H

#include "../../direction_type.h"
#include "../../track_type.h"
#include "../../vehicle_type.h"
#include "../pathfinder_type.h"

/**
 * Finds the best path for given ship using YAPF.
 * @param v        the ship that needs to find a path
 * @param tile     the tile to find the path from (should be next tile the ship is about to enter)
 * @param enterdir diagonal direction which the ship will enter this new tile from
 * @param tracks   available tracks on the new tile (to choose from)
 * @param path_found [out] Whether a path has been found (true) or has been guessed (false)
 * @return         the best trackdir for next turn or INVALID_TRACK if the path could not be found
 */
Track YapfShipChooseTrack(const Ship *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found);

/**
 * Finds the best path for given road vehicle using YAPF.
 * @param v         the RV that needs to find a path
 * @param tile      the tile to find the path from (should be next tile the RV is about to enter)
 * @param enterdir  diagonal direction which the RV will enter this new tile from
 * @param trackdirs available trackdirs on the new tile (to choose from)
 * @param path_found [out] Whether a path has been found (true) or has been guessed (false)
 * @return          the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
 */
Trackdir YapfRoadVehicleChooseTrack(const RoadVehicle *v, TileIndex tile, DiagDirection enterdir, TrackdirBits trackdirs, bool &path_found);

/**
 * Finds the best path for given train using YAPF.
 * @param v        the train that needs to find a path
 * @param tile     the tile to find the path from (should be next tile the train is about to enter)
 * @param enterdir diagonal direction which the RV will enter this new tile from
 * @param tracks   available trackdirs on the new tile (to choose from)
 * @param path_found [out] Whether a path has been found (true) or has been guessed (false)
 * @param reserve_track indicates whether YAPF should try to reserve the found path
 * @param target   [out] the target tile of the reservation, free is set to true if path was reserved
 * @return         the best track for next turn
 */
Track YapfTrainChooseTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, struct PBSTileInfo *target);

/**
 * Used when user sends road vehicle to the nearest depot or if road vehicle needs servicing using YAPF.
 * @param v            vehicle that needs to go to some depot
 * @param max_penalty  max distance (in pathfinder penalty) from the current vehicle position
 *                     (used also as optimization - the pathfinder can stop path finding if max_penalty
 *                     was reached and no depot was seen)
 * @return             the data about the depot
 */
FindDepotData YapfRoadVehicleFindNearestDepot(const RoadVehicle *v, int max_penalty);

/**
 * Used when user sends train to the nearest depot or if train needs servicing using YAPF.
 * @param v            train that needs to go to some depot
 * @param max_distance max distance (int pathfinder penalty) from the current train position
 *                     (used also as optimization - the pathfinder can stop path finding if max_penalty
 *                     was reached and no depot was seen)
 * @return             the data about the depot
 */
FindDepotData YapfTrainFindNearestDepot(const Train *v, int max_distance);

/**
 * Returns true if it is better to reverse the train before leaving station using YAPF.
 * @param v the train leaving the station
 * @return true if reversing is better
 */
bool YapfTrainCheckReverse(const Train *v);

/**
 * Try to extend the reserved path of a train to the nearest safe tile using YAPF.
 *
 * @param v    The train that needs to find a safe tile.
 * @param tile Last tile of the current reserved path.
 * @param td   Last trackdir of the current reserved path.
 * @param override_railtype Should all physically compatible railtypes be searched, even if the vehicle can't run on them on its own?
 * @return True if the path could be extended to a safe tile.
 */
bool YapfTrainFindNearestSafeTile(const Train *v, TileIndex tile, Trackdir td, bool override_railtype);

#endif /* YAPF_H */