The Battle for Wesnoth  1.19.7+dev
Namespaces | Macros | Functions | Variables
move.cpp File Reference

Movement. More...

#include "actions/move.hpp"
#include "actions/undo.hpp"
#include "actions/vision.hpp"
#include "game_events/pump.hpp"
#include "preferences/preferences.hpp"
#include "gettext.hpp"
#include "hotkey/hotkey_item.hpp"
#include "hotkey/hotkey_command.hpp"
#include "log.hpp"
#include "map/map.hpp"
#include "mouse_handler_base.hpp"
#include "pathfind/pathfind.hpp"
#include "pathfind/teleport.hpp"
#include "replay.hpp"
#include "replay_helper.hpp"
#include "synced_context.hpp"
#include "play_controller.hpp"
#include "resources.hpp"
#include "units/udisplay.hpp"
#include "font/standard_colors.hpp"
#include "formula/string_utils.hpp"
#include "team.hpp"
#include "units/unit.hpp"
#include "units/animation_component.hpp"
#include "whiteboard/manager.hpp"
#include <deque>
#include <set>
Include dependency graph for move.cpp:

Go to the source code of this file.

Namespaces

 actions
 

Macros

#define ERR_NG   LOG_STREAM(err, log_engine)
 
#define DBG_NG   LOG_STREAM(debug, log_engine)
 

Functions

game_events::pump_result_t actions::get_village (const map_location &loc, int side, bool *time_bonus=nullptr, bool fire_event=true)
 Makes it so the village at the given location is owned by the given side. More...
 
static void actions::move_unit_internal (unit_mover &mover)
 
void actions::execute_move_unit (const std::vector< map_location > &steps, bool continued_move, bool skip_ally_sighted, move_unit_spectator *move_spectator)
 Moves a unit across the board. More...
 
void actions::teleport_unit_and_record (const map_location &teleport_from, const map_location &teleport_to, move_unit_spectator *move_spectator=nullptr)
 Teleports a unit across the board and enters the synced context. More...
 
void actions::teleport_unit_from_replay (const std::vector< map_location > &steps, bool continued_move, bool skip_ally_sighted, bool show_move)
 Teleports a unit across the board. More...
 
std::size_t actions::move_unit_and_record (const std::vector< map_location > &steps, bool continued_move, bool *interrupted)
 Wrapper around the other overload. More...
 
void actions::move_unit_and_record (const std::vector< map_location > &steps, bool continued_move, move_unit_spectator &move_spectator)
 Moves a unit across the board. More...
 

Variables

static lg::log_domain log_engine ("engine")
 

Detailed Description

Movement.

Definition in file move.cpp.

Macro Definition Documentation

◆ DBG_NG

#define DBG_NG   LOG_STREAM(debug, log_engine)

Definition at line 54 of file move.cpp.

◆ ERR_NG

#define ERR_NG   LOG_STREAM(err, log_engine)

Definition at line 53 of file move.cpp.

Variable Documentation

◆ ambush_limit_

route_iterator ambush_limit_
private

Definition at line 390 of file move.cpp.

◆ ambush_stop_

map_location ambush_stop_
private

Definition at line 410 of file move.cpp.

◆ ambush_string_

std::string ambush_string_
private

Definition at line 424 of file move.cpp.

◆ ambushed_

bool ambushed_
private

Definition at line 412 of file move.cpp.

◆ ambushers_

std::vector<map_location> ambushers_
private

Definition at line 425 of file move.cpp.

◆ begin_

const route_iterator begin_
private

Definition at line 387 of file move.cpp.

Referenced by t_string_base::walker::update().

◆ blocked_loc_

map_location blocked_loc_
private

Definition at line 411 of file move.cpp.

◆ clearer_

shroud_clearer clearer_
private

Definition at line 428 of file move.cpp.

◆ current_side_

int current_side_
private

Definition at line 404 of file move.cpp.

◆ current_team_

team* current_team_
private

Definition at line 405 of file move.cpp.

◆ current_uses_fog_

bool current_uses_fog_
private

Definition at line 406 of file move.cpp.

◆ enemy_count_

std::size_t enemy_count_
private

Definition at line 422 of file move.cpp.

◆ event_mutated_mid_move_

bool event_mutated_mid_move_
private

Definition at line 417 of file move.cpp.

◆ expected_end_

route_iterator expected_end_
private

Definition at line 389 of file move.cpp.

◆ fog_changed_

bool fog_changed_
private

Definition at line 418 of file move.cpp.

◆ friend_count_

std::size_t friend_count_
private

Definition at line 423 of file move.cpp.

◆ full_end_

const route_iterator full_end_
private

Definition at line 388 of file move.cpp.

◆ goto_

const map_location goto_
private

Definition at line 401 of file move.cpp.

◆ loc

Definition at line 172 of file move.cpp.

Referenced by pathfind::a_star_search(), unit::ability_active(), unit::ability_active_impl(), unit::ability_affects_adjacent(), unit::ability_affects_self(), unit::ability_tooltips(), ai::ai_default_rca::move_to_targets_phase::access_points(), halo::manager::add(), halo::halo_impl::add(), display::add_arrow(), editor::map_context::add_changed_location(), terrain_builder::add_constraints(), display::add_exclusive_draw(), display::add_overlay(), actions::undo_list::add_recall(), actions::undo_list::add_recruit(), replay::add_rename(), ai::target_location_goal::add_targets(), ai::protect_goal::add_targets(), editor::map_fragment::add_tile(), editor::map_fragment::add_tiles(), editor::editor_map::add_to_selection(), unit_creator::add_unit(), replay::add_unit_checksum(), advance_unit(), ai::ai_stopunit_select(), unit_filter::all_matches_at(), unit_filter::all_matches_with_unit_at(), wb::any_recruiter(), terrain_builder::apply_rule(), ai::attack_analysis::attack_close(), attack_info(), ai::readonly_context_impl::best_defensive_position(), editor::brush::brush(), team::build(), cave_map_generator::cave_map_generator_job::build_chamber(), terrain_builder::build_terrains(), soundsource::positional_source::calculate_volume(), editor::editor_controller::can_execute_command(), events::menu_handler::can_recruit(), can_see(), ai::cfun_ai_get_suitable_keep(), events::menu_handler::change_side(), game_board::change_terrain(), editor::editor_controller::change_unit_id(), attack_type::check_adj_abilities_impl(), attack_type::check_self_abilities_impl(), unit_animation_component::choose_animation(), ai::ai_default_rca::move_to_targets_phase::choose_move(), team::clear_fog(), actions::shroud_clearer::clear_loc(), team::clear_shroud(), combat_modifier(), ai::default_recruitment::recruitment::compare_cost_maps_and_update_important_hexes(), pathfind::paths::dest_vect::contains(), passage_path_calculator::cost(), pathfind::shortest_path_calculator::cost(), pathfind::move_type_path_calculator::cost(), pathfind::emergency_path_calculator::cost(), lua_pathfind_cost_calculator::cost(), ai::ai_default_rca::move_cost_calculator::cost(), unit_map::count(), ai::default_ai_context_proxy::count_free_hexes_in_castle(), ai::default_ai_context_impl::count_free_hexes_in_castle(), events::mouse_handler::current_unit_attacks_from(), unit::damage_from(), default_map_generator_job::default_generate_map(), wfl::gamestate::DEFINE_WFL_FUNCTION(), wfl::builtins::DEFINE_WFL_FUNCTION(), ai::ai_default_rca::aspect_attacks_base::do_attack_analysis(), events::console_handler::do_create(), editor::editor_controller::do_execute_command(), events::console_handler::do_layers(), events::menu_handler::do_recruit(), do_replay_handle(), events::menu_handler::do_search(), events::console_handler::do_terrain(), events::console_handler::do_unit(), gui::button::draw_contents(), gui::tristate_button::draw_contents(), gui::textbox::draw_contents(), display::draw_hex(), editor::editor_display::draw_hex(), game_display::draw_hex(), display::draw_invalidated(), game_display::draw_invalidated(), display::draw_label(), game_display::draw_movement_info(), display::draw_overlays_at(), display::draw_panel(), display::draw_report(), display::draw_reports(), editor::map_context::draw_terrain(), editor::map_context::draw_terrain_actual(), display::draw_text_in_hex(), display::drawing_buffer_add(), editor::map_fragment::dump(), prefs::encounter_map_terrain(), pathfind::enemy_zoc(), unit_map::erase(), ai::ai_default_rca::move_leader_to_goals_phase::evaluate(), ai::ai_default_rca::move_leader_to_keep_phase::evaluate(), ai::ai_default_rca::retreat_phase::evaluate(), ai::default_recruitment::recruitment::evaluate(), ai::ai_default_rca::get_villages_phase::execute(), wb::recruit::execute(), editor::editor_action_select::extend(), editor::editor_action_deselect::extend(), unit_map::extract(), terrain_filterimpl::filter_area(), terrain_filterimpl::filter_final(), terrain_filterimpl::filter_special_loc(), terrain_filterimpl::filter_xy(), pathfind::paths::dest_vect::find(), unit_map::find(), unit_creator::find_location(), pathfind::find_routes(), game_board::find_unit(), pathfind::find_vacant_tile(), game_board::find_visible_unit(), fix_rename_command(), game_display::float_label(), display::fogged(), team::fogged(), footsteps_images(), ai::lua_object< T >::from_type(), default_map_generator_job::generate_river_internal(), ai::keeps_cache::get(), unit::get_abilities(), unit::get_abilities_weapons(), unit::get_ability_bool(), unit::get_adj_ability_bool(), unit::get_adj_ability_bool_weapon(), events::mouse_handler::get_adj_enemies(), pathfind::teleport_map::get_adjacents(), tod_manager::get_area_on_hex(), pathfind::full_cost_map::get_average_cost_at(), wfl::function_symbol_table::get_builtins(), pathfind::full_cost_map::get_cost_at(), tod_manager::get_current_time(), replay_helper::get_event(), unit_ability_list::get_extremum(), display::get_flag(), display::get_fog_shroud_images(), tod_manager::get_illuminated_time_of_day(), ai::formula_ai::get_keeps(), map_labels::get_label(), map_labels::get_label_private(), display::get_location(), get_location(), display::get_location_rect(), get_noise(), editor::map_fragment::get_offset_area(), pathfind::full_cost_map::get_pair_at(), game_display::get_reachmap_images(), replay_helper::get_recall(), replay_helper::get_recruit(), map_location::get_relative_dir(), unit::get_self_ability_bool(), unit::get_self_ability_bool_weapon(), attack_type::get_specials(), gamemap_base::get_terrain(), terrain_builder::get_terrain_at(), gamemap::get_terrain_editor_string(), display::get_terrain_images(), gamemap::get_terrain_info(), gamemap::get_terrain_string(), terrain_builder::get_tile(), get_tile_ring(), get_tiles_radius(), game_display::get_time_of_day(), tod_manager::get_time_of_day(), wfl::gamemap_callable::get_value(), team::get_village(), actions::get_village(), game_board::get_visible_unit(), display_context::get_visible_unit(), display_context::get_visible_unit_shared_ptr(), attack_type::get_weapon_ability(), gamemap::gives_healing(), gui::scrollbar::grip_area(), gui::textbox::handle_event(), unit_map::has_unit_at(), game_board::has_visible_unit(), ai::helper_advance_unit(), ai::helper_check_village(), ai::helper_place_unit(), impl_merge_terrain(), impl_slocs_set(), impl_source_get(), impl_terrainmap_get(), impl_terrainmap_set(), editor::editor_map::in_selection(), playsingle_controller::init_gui(), pathfind::paths::dest_vect::insert(), unit_map::insert(), game_lua_kernel::intf_add_tile_overlay(), intf_default_generate_height_map(), game_lua_kernel::intf_erase_unit(), game_lua_kernel::intf_find_cost_map(), game_lua_kernel::intf_find_vacant_tile(), game_lua_kernel::intf_float_label(), game_lua_kernel::intf_get_fog_or_shroud(), game_lua_kernel::intf_get_label(), game_lua_kernel::intf_get_mouseover_tile(), game_lua_kernel::intf_get_selected_tile(), game_lua_kernel::intf_get_time_area(), game_lua_kernel::intf_get_time_of_day(), game_lua_kernel::intf_get_unit(), game_lua_kernel::intf_get_units(), game_lua_kernel::intf_get_village_owner(), game_lua_kernel::intf_highlight_hex(), intf_make_shroud_bitmap(), game_lua_kernel::intf_match_location(), game_lua_kernel::intf_match_unit(), intf_on_board(), intf_on_border(), game_lua_kernel::intf_override_shroud(), game_lua_kernel::intf_put_unit(), game_lua_kernel::intf_remove_label(), game_lua_kernel::intf_remove_tile_overlay(), game_lua_kernel::intf_replace_schedule(), lua_map_location::intf_rotate_right_around_center(), game_lua_kernel::intf_scroll_to_tile(), game_lua_kernel::intf_select_unit(), game_lua_kernel::intf_set_floating_label(), game_lua_kernel::intf_set_village_owner(), intf_terrain_mask(), game_lua_kernel::intf_toggle_shroud(), intf_unit_defense(), intf_unit_jamming_cost(), intf_unit_movement_cost(), intf_unit_resistance(), intf_unit_vision_cost(), display::invalidate(), display::invalidate_animations(), display::invalidate_animations_location(), arrow::invalidate_arrow_path(), display::invalidate_locations_in_rect(), unit::invisible(), gamemap::is_castle(), ai::default_recruitment::recruitment::is_enemy_in_radius(), is_fogged(), gamemap::is_keep(), is_shrouded(), gamemap_base::is_special_location(), gamemap_base::is_starting_position(), gamemap::is_village(), unit::is_visible_to_team(), pathfind::jamming_path::jamming_path(), events::menu_handler::kill_unit(), events::menu_handler::label_terrain(), LATTR_SETTER(), display::layout_buttons(), events::mouse_handler_base::left_click(), image::load_from_disk(), image::load_image_data_uri(), image::load_image_file(), image::load_image_sub_file(), editor::map_context::load_scenario(), team::lose_village(), ai::lua_sticky_candidate_action_wrapper::lua_sticky_candidate_action_wrapper(), luaW_checkcubeloc(), luaW_push_locationset(), luaW_push_terrain(), luaW_pushcubeloc(), luaW_tofaivariant(), luaW_tolocation(), terrain_filter::match(), terrain_filter::match_impl(), terrain_filter::match_internal(), unit_animation::matches(), unit_filter::matches(), display::minimap_location_on(), game_lua_kernel::mouse_button_callback(), events::mouse_handler_base::mouse_button_event(), events::mouse_handler::mouse_button_event(), events::mouse_handler_base::mouse_motion_default(), game_lua_kernel::mouse_over_hex_callback(), events::mouse_handler_base::mouse_press(), events::mouse_handler_base::mouse_update(), ai::readonly_context_proxy::nearest_keep(), ai::readonly_context_impl::nearest_keep(), cave_map_generator::on_board(), gamemap_base::on_board(), gamemap_base::on_board_with_border(), terrain_builder::tilemap::on_map(), terrain_filter::operator()(), filter_with_unit::operator()(), game_events::filter_unit::operator()(), game_events::filter_attack::operator()(), unit_filter::operator()(), terrain_builder::tilemap::operator[](), gamemap::operator[](), gamemap_base::overlay(), team::owns_village(), terrain_builder::parse_config(), wesnothd::ban_manager::parse_time(), editor::map_fragment::paste_into(), wb::path_cost(), editor::editor_action_select::perform(), editor::editor_action_deselect::perform(), editor::editor_action_select::perform_without_undo(), editor::editor_action_deselect::perform_without_undo(), cave_map_generator::cave_map_generator_job::place_castle(), cave_map_generator::cave_map_generator_job::place_chamber(), team::place_shroud(), place_village(), unit_creator::post_create(), ai::readonly_context_proxy::power_projection(), ai::readonly_context_impl::power_projection(), gui2::dialogs::lobby_player_info::pre_show(), image::prep_minimap_for_rendering(), lua_unit::put_map(), game_lua_kernel::put_unit_helper(), wb::side_actions::queue_suppose_dead(), rank_castle_location(), ai::ai_default_rca::aspect_attacks_base::rate_terrain(), ai::default_ai_context_proxy::rate_terrain(), ai::default_ai_context_impl::rate_terrain(), reality_check_get_direction_helper(), editor::editor_display::rebuild_terrain(), terrain_builder::rebuild_terrain(), ai::readonly_context_impl::recalculate_move_maps(), actions::recall_unit(), actions::recruit_unit(), unit_drawer::redraw_unit(), editor::context_manager::refresh_after_action(), editor::context_manager::refresh_all(), display::refresh_report(), display::remove_arrow(), display::remove_exclusive_draw(), editor::editor_map::remove_from_selection(), display::remove_overlay(), display::remove_single_overlay(), editor::editor_controller::rename_unit(), REPORT_GENERATOR(), actions::undo::reset_adjacent(), unit::resistance_against(), editor::editor_map::resize(), terrain_builder::rule_matches(), editor::editor_map::sanity_check(), wb::manager::save_suppose_dead(), scale_surface(), scale_surface_legacy(), display::scroll_to_tile(), display::scroll_to_tiles(), game_lua_kernel::select_hex_callback(), unit_drawer::selected_or_reachable(), unit_abilities::individual_effect::set(), map_labels::set_label(), unit::set_location(), editor::editor_map::set_selection(), gamemap_base::set_special_location(), gamemap_base::set_starting_position(), gamemap::set_terrain(), mapgen_gamemap::set_terrain(), cave_map_generator::cave_map_generator_job::set_terrain(), ai::ai_default_rca::move_to_targets_phase::should_retreat(), ai::ai_default_rca::retreat_phase::should_retreat(), events::mouse_handler::show_attack_options(), ai::default_recruitment::recruitment::show_important_hexes(), display::shrouded(), team::shrouded(), attack_type::specials_context(), attack_type::specials_context_t::specials_context_t(), ai::readonly_context_impl::suitable_keep(), SYNCED_COMMAND_HANDLER_FUNCTION(), play_controller::tab(), pathfind::teleport_map::teleport_map(), temporary_unit_placer::temporary_unit_placer(), editor::editor_controller::terrain_description(), events::menu_handler::terrain_description(), gui2::dialogs::terrain_layers::terrain_layers(), display::tile_fully_on_screen(), display::tile_nearly_on_screen(), tod_manager::times(), wb::move::to_config(), under_leadership(), gamemap::underlying_def_terrain(), gamemap::underlying_mvt_terrain(), gamemap::underlying_union_terrain(), unit_abilities(), display::unit_can_draw_here(), editor::editor_controller::unit_description(), unit_display::unit_die(), unit_display::unit_draw_weapon(), unit_display::unit_recruited(), terrain_builder::update_animation(), display::update_arrow(), ai::default_recruitment::recruitment::update_average_local_cost(), verify(), display_context::village_owner(), map_labels::visible_global_label(), pathfind::vision_path::vision_path(), playsingle_controller::hotkey_handler::whiteboard_suppose_dead(), game_events::WML_HANDLER_FUNCTION(), display_context::would_be_discovered(), team::write(), and gamemap::write_terrain().

◆ log_engine

lg::log_domain log_engine("engine") ( "engine"  )
static

◆ move_it_

unit_map::iterator move_it_
private

Definition at line 395 of file move.cpp.

◆ move_loc_

route_iterator move_loc_
private

Definition at line 407 of file move.cpp.

◆ moves_left_

std::deque<int> moves_left_
private

Definition at line 426 of file move.cpp.

◆ obstructed_

route_iterator obstructed_
private

Definition at line 391 of file move.cpp.

◆ orig_dir_

const map_location::direction orig_dir_
private

Definition at line 400 of file move.cpp.

◆ orig_moves_

int orig_moves_
private

Definition at line 399 of file move.cpp.

◆ orig_side_

const int orig_side_
private

Definition at line 398 of file move.cpp.

◆ original_village_owner

int original_village_owner

Definition at line 170 of file move.cpp.

◆ playing_team_is_viewing_

const bool playing_team_is_viewing_
private

Definition at line 382 of file move.cpp.

◆ real_end_

route_iterator real_end_
private

Definition at line 392 of file move.cpp.

◆ route_

const std::vector<map_location>& route_
private

Definition at line 384 of file move.cpp.

Referenced by footsteps_images().

◆ show_ambush_alert_

bool show_ambush_alert_
private

Definition at line 413 of file move.cpp.

◆ sighted_

bool sighted_
private

Definition at line 419 of file move.cpp.

◆ sighted_stop_

bool sighted_stop_
private

Definition at line 420 of file move.cpp.

◆ skip_ally_sighting_

const bool skip_ally_sighting_
private

Definition at line 381 of file move.cpp.

◆ skip_sighting_

const bool skip_sighting_
private

Definition at line 380 of file move.cpp.

◆ spectator_

move_unit_spectator* const spectator_
private

Definition at line 379 of file move.cpp.

◆ take_village_timebonus

bool take_village_timebonus

Definition at line 171 of file move.cpp.

◆ teleport_failed_

bool teleport_failed_
private

Definition at line 421 of file move.cpp.

◆ wml_move_aborted_

bool wml_move_aborted_
private

Definition at line 416 of file move.cpp.

◆ wml_removed_unit_

bool wml_removed_unit_
private

Definition at line 414 of file move.cpp.

◆ wml_undo_disabled_

bool wml_undo_disabled_
private

Definition at line 415 of file move.cpp.

◆ zoc_stop_

map_location zoc_stop_
private

Definition at line 409 of file move.cpp.