The Battle for Wesnoth  1.15.0+dev
Namespaces | Macros | Functions | Variables
pathfind.cpp File Reference

Various pathfinding functions and utilities. More...

#include "pathfind/pathfind.hpp"
#include "pathfind/teleport.hpp"
#include "display.hpp"
#include "game_board.hpp"
#include "gettext.hpp"
#include "log.hpp"
#include "map/map.hpp"
#include "resources.hpp"
#include "team.hpp"
#include "units/unit.hpp"
#include "units/map.hpp"
#include "wml_exception.hpp"
#include <iostream>
#include <vector>
#include <algorithm>
Include dependency graph for pathfind.cpp:

Go to the source code of this file.




#define ERR_PF   LOG_STREAM(err, log_engine)


map_location pathfind::find_vacant_tile (const map_location &loc, VACANT_TILE_TYPE vacancy, const unit *pass_check, const team *shroud_check, const game_board *board)
 Function that will find a location on the board that is as near to loc as possible, but which is unoccupied by any units. More...
map_location pathfind::find_vacant_castle (const unit &leader)
 Wrapper for find_vacant_tile() when looking for a vacant castle tile near a leader. More...
bool pathfind::enemy_zoc (const team &current_team, const map_location &loc, const team &viewing_team, bool see_all)
 Determines if a given location is in an enemy zone of control. More...
static void pathfind::find_routes (const map_location &origin, const movetype::terrain_costs &costs, bool slowed, int moves_left, int max_moves, int turns_left, paths::dest_vect &destinations, std::set< map_location > *edges, const unit *teleporter, const team *current_team, const unit *skirmisher, const team *viewing_team, const std::map< map_location, int > *jamming_map=nullptr, std::vector< std::pair< int, int >> *full_cost_map=nullptr, bool check_vision=false)
 Creates a list of routes that a unit can traverse from the provided location. More...
static bool pathfind::step_compare (const paths::step &a, const map_location &b)
marked_route pathfind::mark_route (const plain_route &rt, bool update_move_cost=false)
 Add marks on a route rt assuming that the unit located at the first hex of rt travels along it. More...


static lg::log_domain log_engine ("engine")

Detailed Description

Various pathfinding functions and utilities.

Definition in file pathfind.cpp.

Macro Definition Documentation


#define ERR_PF   LOG_STREAM(err, log_engine)

Definition at line 40 of file pathfind.cpp.

Variable Documentation

◆ h

int h

Definition at line 193 of file pathfind.cpp.

◆ log_engine

lg::log_domain log_engine("engine")

◆ moves_left

int moves_left

Definition at line 161 of file pathfind.cpp.

Referenced by gui2::dialogs::format_movement_string().

◆ nodes

const std::vector<findroute_node>& nodes

Definition at line 225 of file pathfind.cpp.

Referenced by pathfind::find_routes().

◆ prev

Definition at line 162 of file pathfind.cpp.

◆ search_num

unsigned search_num

Definition at line 166 of file pathfind.cpp.

◆ turns_left

int turns_left

◆ w

int w

Definition at line 193 of file pathfind.cpp.