#include "global.hpp"
#include "astarnode.hpp"
#include "gamestatus.hpp"
#include "gettext.hpp"
#include "log.hpp"
#include "pathfind.hpp"
#include "util.hpp"
#include "wml_exception.hpp"
#include <cassert>
#include <cmath>
#include <iostream>
Go to the source code of this file.
Defines | |
#define | LOG_PF LOG_STREAM(info, engine) |
Functions | |
static gamemap::location | find_vacant (const gamemap &map, const unit_map &units, const gamemap::location &loc, int depth, VACANT_TILE_TYPE vacancy, std::set< gamemap::location > &touched) |
gamemap::location | find_vacant_tile (const gamemap &map, const unit_map &units, const gamemap::location &loc, VACANT_TILE_TYPE vacancy) |
Function which will find a location on the board that is as near to loc as possible, but which is unoccupied by any units. | |
bool | enemy_zoc (gamemap const &map, unit_map const &units, std::vector< team > const &teams, gamemap::location const &loc, team const &viewing_team, unsigned int side, bool see_all) |
Function which determines if a given location is in an enemy zone of control. | |
static void | find_routes (const gamemap &map, const unit_map &units, const unit &u, const gamemap::location &loc, int move_left, paths::routes_map &routes, std::vector< team > const &teams, bool force_ignore_zocs, bool allow_teleport, int turns_left, bool starting_pos, const team &viewing_team, bool see_all, bool ignore_units) |
int | route_turns_to_complete (const unit &u, paths::route &rt, const team &viewing_team, const unit_map &units, const std::vector< team > &teams, const gamemap &map) |
Function which, given a unit and a route the unit can move on, will return the number of turns it will take the unit to traverse the route. |
Definition in file pathfind.cpp.
#define LOG_PF LOG_STREAM(info, engine) |
Definition at line 33 of file pathfind.cpp.
bool enemy_zoc | ( | gamemap const & | map, | |
unit_map const & | units, | |||
std::vector< team > const & | teams, | |||
gamemap::location const & | loc, | |||
team const & | viewing_team, | |||
unsigned int | side, | |||
bool | see_all | |||
) |
Function which determines if a given location is in an enemy zone of control.
Definition at line 84 of file pathfind.cpp.
References unit_map::end(), find_visible_unit(), get_adjacent_tiles(), and team::is_enemy().
Referenced by shortest_path_calculator::cost(), find_routes(), move_unit(), and route_turns_to_complete().
static void find_routes | ( | const gamemap & | map, | |
const unit_map & | units, | |||
const unit & | u, | |||
const gamemap::location & | loc, | |||
int | move_left, | |||
paths::routes_map & | routes, | |||
std::vector< team > const & | teams, | |||
bool | force_ignore_zocs, | |||
bool | allow_teleport, | |||
int | turns_left, | |||
bool | starting_pos, | |||
const team & | viewing_team, | |||
bool | see_all, | |||
bool | ignore_units | |||
) | [static] |
Definition at line 105 of file pathfind.cpp.
References unit_map::end(), enemy_zoc(), find_visible_unit(), team::fogged(), unit::get_ability_bool(), get_adjacent_tiles(), team::is_enemy(), gamemap::is_village(), paths::route::move_left, unit::movement_cost(), gamemap::on_board(), team::owns_village(), unit::side(), paths::route::steps, unit::total_movement(), and team::villages().
Referenced by paths::paths().
static gamemap::location find_vacant | ( | const gamemap & | map, | |
const unit_map & | units, | |||
const gamemap::location & | loc, | |||
int | depth, | |||
VACANT_TILE_TYPE | vacancy, | |||
std::set< gamemap::location > & | touched | |||
) | [static] |
Definition at line 35 of file pathfind.cpp.
References unit_map::end(), unit_map::find(), get_adjacent_tiles(), gamemap::is_castle(), gamemap::on_board(), VACANT_ANY, and VACANT_CASTLE.
Referenced by find_vacant_tile().
gamemap::location find_vacant_tile | ( | const gamemap & | map, | |
const unit_map & | un, | |||
const gamemap::location & | loc, | |||
VACANT_TILE_TYPE | vacancy = VACANT_ANY | |||
) |
Function which will find a location on the board that is as near to loc as possible, but which is unoccupied by any units.
If terrain is not 0, then the location found must be of the given terrain type, and must have a path of that terrain type to loc. If no valid location can be found, it will return a null location.
Definition at line 69 of file pathfind.cpp.
References find_vacant(), and gamemap::on_board().
Referenced by recruit_unit().
int route_turns_to_complete | ( | const unit & | u, | |
paths::route & | rt, | |||
const team & | viewing_team, | |||
const unit_map & | units, | |||
const std::vector< team > & | teams, | |||
const gamemap & | map | |||
) |
Function which, given a unit and a route the unit can move on, will return the number of turns it will take the unit to traverse the route.
adds "turn waypoints" to rt.turn_waypoints. Note that "end of path" is also added.
Definition at line 228 of file pathfind.cpp.
References enemy_zoc(), team::fogged(), unit::get_ability_bool(), unit::invisible(), team::is_enemy(), gamemap::is_village(), unit::movement_cost(), unit::movement_left(), gamemap::on_board(), team::owns_village(), unit::side(), paths::route::steps, unit::total_movement(), preferences::turns(), and paths::route::waypoints.
Referenced by events::mouse_handler::get_route().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |