Encapsulates the map of the game. More...
#include <location.hpp>
Public Types | |
enum | DIRECTION { NORTH =0, NORTH_EAST =1, SOUTH_EAST =2, SOUTH =3, SOUTH_WEST =4, NORTH_WEST =5, NDIRECTIONS =6 } |
Valid directions which can be moved in our hexagonal world. More... | |
enum | RELATIVE_DIR_MODE { DEFAULT, RADIAL_SYMMETRY } |
Static Public Member Functions | |
static const std::vector < DIRECTION > & | default_dirs () |
Default list of directions. More... | |
static DIRECTION | rotate_right (DIRECTION d, unsigned int k=1u) |
Inlined bodies. More... | |
static DIRECTION | rotate_right (DIRECTION d, signed int k) |
static DIRECTION | get_opposite_dir (DIRECTION d) |
static DIRECTION | parse_direction (const std::string &str) |
static std::vector< DIRECTION > | parse_directions (const std::string &str) |
Parse_directions takes a comma-separated list, and filters out any invalid directions. More... | |
static std::string | write_direction (DIRECTION dir) |
static std::string | write_translated_direction (DIRECTION dir) |
static const map_location & | ZERO () |
Old implementation: More... | |
static const map_location & | null_location () |
Public Attributes | |
int | x |
int | y |
Friends | |
std::size_t | hash_value (map_location const &a) |
Moved out of inline because of the boost dependency. More... | |
Encapsulates the map of the game.
Although the game is hexagonal, the map is stored as a grid. Each type of terrain is represented by a multiletter terrain code.
Represents a location on the map.
Definition at line 38 of file location.hpp.
Valid directions which can be moved in our hexagonal world.
Enumerator | |
---|---|
NORTH | |
NORTH_EAST | |
SOUTH_EAST | |
SOUTH | |
SOUTH_WEST | |
NORTH_WEST | |
NDIRECTIONS |
Definition at line 40 of file location.hpp.
Enumerator | |
---|---|
DEFAULT | |
RADIAL_SYMMETRY |
Definition at line 101 of file location.hpp.
|
inline |
Definition at line 60 of file location.hpp.
Referenced by get_direction(), vector_negation(), and vector_sum().
Definition at line 61 of file location.hpp.
map_location::map_location | ( | const config & | cfg, |
const variable_set * | variables = nullptr |
||
) |
Definition at line 186 of file location.cpp.
References utils::interpolate_variables_into_string().
|
static |
Default list of directions.
Moved out of inline, because boost assign list_of is somewhat expensive...
Definition at line 55 of file location.cpp.
References NORTH, NORTH_EAST, NORTH_WEST, SOUTH, SOUTH_EAST, and SOUTH_WEST.
Referenced by basic_unit_filter_impl::internal_matches_filter(), and terrain_filter::match_internal().
|
inline |
three-way comparator
Definition at line 86 of file location.hpp.
Referenced by game_logic::attack_callable::do_compare(), terrain_callable::do_compare(), game_logic::move_callable::do_compare(), location_callable::do_compare(), and game_logic::move_partial_callable::do_compare().
|
inline |
Definition at line 232 of file location.hpp.
References map_location(), NDIRECTIONS, NORTH, null_location(), and SOUTH.
Referenced by get_direction(), get_in_basis_N_NE(), unit_frame::get_overlaped_hex(), get_tile_ring(), lua_map_location::intf_get_direction(), MLFixture::MLFixture(), reality_check_get_direction_helper(), unit_drawer::redraw_unit(), editor::map_fragment::rotate_60_ccw(), editor::map_fragment::rotate_60_cw(), rotate_right_around_center(), and unit_animation_component::start_animation().
|
inline |
Get Direction function.
Definition at line 226 of file location.hpp.
References get_direction(), and get_opposite_dir().
Definition at line 281 of file location.cpp.
References get_direction(), NORTH, NORTH_EAST, SOUTH_WEST, x, and y.
Referenced by lua_map_location::intf_get_in_basis_N_NE(), and rotate_right_around_center().
|
inlinestatic |
Definition at line 163 of file location.hpp.
References rotate_right().
Referenced by BOOST_AUTO_TEST_CASE(), characterization_distance_direction(), get_direction(), mirror_walk(), and parse_direction().
map_location::DIRECTION map_location::get_relative_dir | ( | const map_location & | loc, |
map_location::RELATIVE_DIR_MODE | mode | ||
) | const |
Definition at line 220 of file location.cpp.
References DEFAULT, is_vertically_higher_than(), NDIRECTIONS, NORTH, NORTH_EAST, NORTH_WEST, rotate_right_around_center(), SOUTH, SOUTH_EAST, SOUTH_WEST, x, and y.
Referenced by game_display::attack_indicator_direction(), characterization_distance_direction(), events::mouse_handler::current_unit_attacks_from(), unit_frame::get_overlaped_hex(), get_relative_dir(), lua_map_location::intf_get_relative_dir(), move_unit_between(), unit_frame::redraw(), ai::formula_ai::shortest_path_calculator(), attack_type::special_active(), teleport_unit_between(), unit_display::unit_attack(), unit_display::unit_draw_weapon(), unit_display::unit_recruited(), and game_events::WML_HANDLER_FUNCTION().
map_location::DIRECTION map_location::get_relative_dir | ( | const map_location & | loc | ) | const |
Definition at line 215 of file location.cpp.
References get_relative_dir(), and RADIAL_SYMMETRY.
bool map_location::matches_range | ( | const std::string & | xloc, |
const std::string & | yloc | ||
) | const |
Definition at line 311 of file location.cpp.
References gui2::event::find(), i, and utils::split().
Referenced by basic_unit_filter_impl::internal_matches_filter(), and terrain_filter::match_internal().
|
inlinestatic |
Definition at line 195 of file location.hpp.
Referenced by pathfind::a_star_search(), ai::ai_recall(), ai::ai_recruit(), battle_context_unit_stats::battle_context_unit_stats(), game_state::can_recruit_from(), actions::check_recall_location(), actions::check_recruit_location(), game_display::clear_attack_indicator(), actions::shroud_clearer::clear_unit(), display::displayed_unit_hex(), ai::recall_result::do_describe(), ai::recruit_result::do_describe(), ai::synced_command_result::do_execute(), events::menu_handler::do_recruit(), ai::ai_default_rca::move_leader_to_keep_phase::evaluate(), ai::default_recruitment::recruitment::evaluate(), wb::recall::execute(), ai::default_recruitment::recruitment::execute(), ai::default_recruitment::recruitment::execute_recall(), ai::default_recruitment::recruitment::execute_recruit(), unit_creator::find_location(), pathfind::find_routes(), ai::ai_default_rca::get_villages_phase::find_villages(), actions::shroud_clearer::fire_events(), ai::default_recruitment::recruitment::get_appropriate_recall(), tod_manager::get_current_time(), get_direction(), joystick_manager::get_next_hex(), gamemap::get_terrain(), tod_manager::get_time_of_day(), unit_callable::get_value(), ai::ai_default_rca::get_villages_phase::get_villages(), play_controller::init_side_begin(), events::mouse_handler::mouse_motion(), actions::move_unit_and_record(), ai::readonly_context_impl::nearest_keep(), actions::place_recruit(), events::menu_handler::recall(), ai::ai_default_rca::get_villages_phase::remove_unit(), unit_type::resistance_against(), attack_type::set_specials_context(), ai::readonly_context_impl::suitable_keep(), tod_manager::times(), under_leadership(), unit_display::unit_attack(), unit_display::unit_healing(), unit_display::unit_recruited(), unit_display::wml_animation_internal(), and game_events::WML_HANDLER_FUNCTION().
|
inline |
Definition at line 83 of file location.hpp.
References operator==().
|
inline |
Definition at line 81 of file location.hpp.
|
inline |
|
static |
Definition at line 69 of file location.cpp.
References get_opposite_dir(), NDIRECTIONS, NORTH, NORTH_EAST, NORTH_WEST, rotate_right(), SOUTH, SOUTH_EAST, SOUTH_WEST, schema_validation::sub(), and write_direction().
Referenced by actions::undo_list::create_action(), get_second(), impl_unit_set(), lua_map_location::intf_get_direction(), lua_map_location::intf_parse_direction(), parse_directions(), unit::unit(), and unit_animation::unit_animation().
|
static |
Parse_directions takes a comma-separated list, and filters out any invalid directions.
Definition at line 128 of file location.cpp.
References i, NDIRECTIONS, parse_direction(), and utils::split().
Referenced by unit::ability_active(), unit::ability_affects_adjacent(), basic_unit_filter_impl::internal_matches_filter(), terrain_filter::match_internal(), and attack_type::special_active().
|
inlinestatic |
Inlined bodies.
Inline direction manipulators
Definition at line 155 of file location.hpp.
References NDIRECTIONS.
Referenced by BOOST_AUTO_TEST_CASE(), get_opposite_dir(), lua_map_location::intf_get_direction(), parse_direction(), rotate_right(), and rotate_right_around_center().
|
inlinestatic |
Definition at line 159 of file location.hpp.
References rotate_right().
map_location map_location::rotate_right_around_center | ( | const map_location & | center, |
int | k | ||
) | const |
Definition at line 300 of file location.cpp.
References get_direction(), get_in_basis_N_NE(), NORTH, NORTH_EAST, rotate_right(), and vector_difference_assign().
Referenced by get_relative_dir(), lua_map_location::intf_rotate_right_around_center(), and rotate_around_centers().
|
inline |
Definition at line 69 of file location.hpp.
Referenced by pathfind::a_star_search(), display::add_exclusive_draw(), unit_creator::add_unit(), editor::location_palette::adjust_size(), battle_context_unit_stats::battle_context_unit_stats(), editor::editor_controller::can_execute_command(), play_controller::hotkey_handler::can_execute_command(), game_events::wml_menu_item::can_show(), actions::check_recall_location(), actions::check_recruit_location(), wb::attack::check_validity(), ai::ai_default_rca::move_to_targets_phase::choose_move(), events::mouse_handler::current_unit_attacks_from(), game_display::display_unit_hex(), ai::recall_result::do_check_before(), ai::recruit_result::do_check_before(), events::console_handler::do_layers(), events::menu_handler::do_search(), display::draw_minimap(), game_display::draw_movement_info(), ai::ai_default_rca::move_leader_to_goals_phase::evaluate(), ai::ai_default_rca::retreat_phase::evaluate(), unit_creator::find_location(), game_events::wml_menu_item::fire_event(), replay_helper::get_event(), terrain_filter::get_locations(), unit::has_goto(), game_lua_kernel::impl_current_get(), unit_map::insert(), intf_find_cost_map_helper(), game_lua_kernel::intf_find_vacant_tile(), game_lua_kernel::intf_put_unit(), editor::mouse_action::key_event(), ai::readonly_context_impl::leader_can_reach_keep(), events::mouse_handler_base::left_click(), image::load_image_sub_file(), basic_unit_filter_impl::matches(), events::mouse_handler::mouse_motion(), events::mouse_handler_base::mouse_motion_default(), events::mouse_handler_base::mouse_press(), events::mouse_handler::move_action(), ai::ai_default_rca::move_to_targets_phase::move_group(), gamemap::on_board(), wb::manager::on_mouseover_change(), terrain_builder::parse_config(), ai::readonly_context_impl::power_projection(), gui2::teditor_set_starting_position::pre_show(), display::remove_exclusive_draw(), REPORT_GENERATOR(), events::mouse_handler::right_click_show_menu(), terrain_builder::rule_matches(), events::menu_handler::search(), game_display::select_hex(), events::mouse_handler::select_hex(), wb::highlighter::set_mouseover_hex(), gamemap::set_special_location(), ai::formula_ai::shortest_path_calculator(), image::simplify_type(), and ai::move_result::test_route().
Definition at line 71 of file location.hpp.
Definition at line 74 of file location.hpp.
|
inline |
Definition at line 219 of file location.hpp.
References vector_negation(), and vector_sum_assign().
Referenced by characterization_distance_direction(), rotate_right_around_center(), and vector_difference().
|
inline |
Inline vector ops.
Definition at line 201 of file location.hpp.
References map_location().
Referenced by characterization_distance_direction(), lua_map_location::intf_vector_negation(), MLFixture::MLFixture(), and vector_difference_assign().
|
inline |
Definition at line 206 of file location.hpp.
References map_location().
Referenced by characterization_distance_direction(), MLFixture::MLFixture(), and reality_check_get_direction_helper().
|
inline |
Definition at line 211 of file location.hpp.
Referenced by editor::map_fragment::center_of_mass(), lua_map_location::intf_vector_sum(), and vector_difference_assign().
Definition at line 205 of file location.cpp.
Referenced by replay::add_rename(), replay::add_unit_checksum(), fix_rename_command(), replay_helper::get_attack(), replay_helper::get_event(), replay_helper::get_recall(), replay_helper::get_recruit(), impl_unit_get(), actions::undo::recruit_action::write(), actions::undo::recall_action::write(), and terrain_label::write().
|
static |
Definition at line 144 of file location.cpp.
References NORTH, NORTH_EAST, NORTH_WEST, SOUTH, SOUTH_EAST, and SOUTH_WEST.
Referenced by game_display::attack_indicator_direction(), characterization_distance_direction(), wb::attack::draw_hex(), unit_callable::get_value(), impl_unit_get(), lua_map_location::intf_write_direction(), parse_direction(), editor::map_context::to_config(), arrow::update_symbols(), game_events::WML_HANDLER_FUNCTION(), actions::undo::move_action::write(), and unit::write().
|
static |
Definition at line 165 of file location.cpp.
References _(), NORTH, NORTH_EAST, NORTH_WEST, SOUTH, SOUTH_EAST, and SOUTH_WEST.
Referenced by editor::editor_controller::show_menu().
|
inlinestatic |
Old implementation:
Inline constant map_location defns
Definition at line 190 of file location.hpp.
Referenced by ai::default_ai_context_impl::find_targets(), gamemap::get_weighted_terrain_frequencies(), lua_map_location::intf_vector_zero(), MLFixture::MLFixture(), halo::halo_impl::effect::render(), editor::map_fragment::rotate_60_ccw(), editor::map_fragment::rotate_60_cw(), halo::halo_impl::effect::set_location(), and halo::halo_impl::effect::unrender().
|
friend |
Moved out of inline because of the boost dependency.
Definition at line 63 of file location.cpp.
int map_location::x |
Definition at line 77 of file location.hpp.
Referenced by terrain_builder::add_constraints(), ai::ai_recall(), ai::ai_recruit(), ai::ai_synced_command(), editor::map_fragment::center_of_mass(), team::clear_fog(), actions::shroud_clearer::clear_loc(), team::clear_shroud(), lua_pathfind_cost_calculator::cost(), passage_path_calculator::cost(), default_map_generator_job::default_generate_map(), distance_between(), do_compare(), ai::synced_command_result::do_execute(), events::console_handler::do_layers(), events::menu_handler::do_search(), events::console_handler::do_unit(), terrain_label::draw(), unit_drawer::draw_bar(), display::draw_border(), display::drawing_buffer_key::drawing_buffer_key(), game_events::entity_location::filter_x(), pathfind::find_routes(), game_events::wmi_container::fire_item(), flood_name(), team::fogged(), default_map_generator_job::generate_river_internal(), get_adjacent_tiles(), joystick_manager::get_direction(), get_in_basis_N_NE(), game_events::wmi_container::get_items(), display::get_location_x(), display::get_location_y(), get_noise(), get_relative_dir(), pathfind::teleport_group::get_teleport_pair(), gamemap::get_terrain(), terrain_callable::get_value(), location_callable::get_value(), unit_callable::get_value(), display::get_variant(), controller_base::handle_scroll(), hash_value(), image::hash_value(), game_lua_kernel::impl_current_get(), impl_unit_get(), impl_unit_set(), game_lua_kernel::intf_erase_unit(), intf_find_path(), game_lua_kernel::intf_find_reach(), game_lua_kernel::intf_find_vacant_tile(), game_lua_kernel::intf_get_mouseover_tile(), game_lua_kernel::intf_get_selected_tile(), game_lua_kernel::intf_get_starting_location(), game_lua_kernel::intf_put_unit(), is_shrouded(), gamemap::is_starting_position(), is_vertically_higher_than(), editor::editor_controller::left_click(), legacy_negation(), legacy_sum_assign(), image::load_image_sub_file(), theme::object::location(), luaW_pushlocation(), luaW_tolocation(), editor::editor_map::mask_to(), basic_unit_filter_impl::matches(), display::minimap_location_on(), theme::object::modify_location(), game_lua_kernel::mouse_over_hex_callback(), ai::ai_default_rca::move_to_targets_phase::move_group(), unit::move_interrupted(), cave_map_generator::on_board(), gamemap::on_board(), gamemap::on_board_with_border(), terrain_builder::tilemap::on_map(), display::rect_of_hexes::iterator::operator++(), operator<(), operator<<(), operator==(), gamemap::operator[](), terrain_builder::tilemap::operator[](), game_board::overlay_map(), terrain_builder::parse_config(), editor::editor_action_unit_delete::perform_without_undo(), cave_map_generator::cave_map_generator_job::place_castle(), team::place_shroud(), place_village(), placing_score(), gui2::teditor_set_starting_position::pre_show(), help::help_menu::process(), game_events::t_pump::process_event(), ai::push_location_key(), halo::halo_impl::effect::render(), editor::editor_controller::right_click(), terrain_builder::rotate(), terrain_builder::rotate_rule(), terrain_builder::rule_matches(), game_lua_kernel::run_filter(), game_lua_kernel::select_hex_callback(), location_callable::serialize_to_string(), gamemap::set_special_location(), cave_map_generator::cave_map_generator_job::set_terrain(), gamemap::set_terrain(), team::shrouded(), tiles_adjacent(), wb::attack::to_config(), wb::suppose_dead::to_config(), wb::recall::to_config(), wb::recruit::to_config(), wb::move::to_config(), unit::unit(), halo::halo_impl::effect::unrender(), joystick_manager::update_highlighted_hex(), vector_sum_assign(), actions::undo::move_action::write(), and unit::write().
int map_location::y |
Definition at line 77 of file location.hpp.
Referenced by terrain_builder::add_constraints(), ai::ai_recall(), ai::ai_recruit(), ai::ai_synced_command(), editor::map_fragment::center_of_mass(), team::clear_fog(), actions::shroud_clearer::clear_loc(), team::clear_shroud(), lua_pathfind_cost_calculator::cost(), passage_path_calculator::cost(), default_map_generator_job::default_generate_map(), distance_between(), do_compare(), ai::synced_command_result::do_execute(), events::console_handler::do_layers(), events::menu_handler::do_search(), events::console_handler::do_unit(), terrain_label::draw(), display::draw_border(), display::drawing_buffer_key::drawing_buffer_key(), game_events::entity_location::filter_y(), pathfind::find_routes(), game_events::wmi_container::fire_item(), team::fogged(), default_map_generator_job::generate_river_internal(), get_adjacent_tiles(), joystick_manager::get_direction(), get_in_basis_N_NE(), game_events::wmi_container::get_items(), display::get_location_y(), get_noise(), get_relative_dir(), pathfind::teleport_group::get_teleport_pair(), gamemap::get_terrain(), terrain_callable::get_value(), location_callable::get_value(), unit_callable::get_value(), display::get_variant(), controller_base::handle_scroll(), hash_value(), image::hash_value(), game_lua_kernel::impl_current_get(), impl_unit_get(), impl_unit_set(), game_lua_kernel::intf_erase_unit(), intf_find_path(), game_lua_kernel::intf_find_reach(), game_lua_kernel::intf_find_vacant_tile(), game_lua_kernel::intf_get_mouseover_tile(), game_lua_kernel::intf_get_selected_tile(), game_lua_kernel::intf_get_starting_location(), game_lua_kernel::intf_put_unit(), is_shrouded(), gamemap::is_starting_position(), is_vertically_higher_than(), editor::editor_controller::left_click(), legacy_negation(), legacy_sum_assign(), image::load_image_sub_file(), theme::object::location(), luaW_pushlocation(), luaW_tolocation(), editor::editor_map::mask_to(), basic_unit_filter_impl::matches(), display::minimap_location_on(), theme::object::modify_location(), game_lua_kernel::mouse_over_hex_callback(), ai::ai_default_rca::move_to_targets_phase::move_group(), unit::move_interrupted(), cave_map_generator::on_board(), gamemap::on_board(), gamemap::on_board_with_border(), terrain_builder::tilemap::on_map(), display::rect_of_hexes::iterator::operator++(), operator<(), operator<<(), operator==(), gamemap::operator[](), terrain_builder::tilemap::operator[](), game_board::overlay_map(), terrain_builder::parse_config(), editor::editor_action_unit_delete::perform_without_undo(), cave_map_generator::cave_map_generator_job::place_castle(), team::place_shroud(), place_village(), placing_score(), gui2::teditor_set_starting_position::pre_show(), game_events::t_pump::process_event(), ai::push_location_key(), unit_drawer::redraw_unit(), halo::halo_impl::effect::render(), editor::editor_controller::right_click(), terrain_builder::rotate(), terrain_builder::rotate_rule(), terrain_builder::rule_matches(), game_lua_kernel::run_filter(), game_lua_kernel::select_hex_callback(), location_callable::serialize_to_string(), gamemap::set_special_location(), cave_map_generator::cave_map_generator_job::set_terrain(), gamemap::set_terrain(), team::shrouded(), tiles_adjacent(), wb::attack::to_config(), wb::suppose_dead::to_config(), wb::recall::to_config(), wb::recruit::to_config(), wb::move::to_config(), unit::unit(), halo::halo_impl::effect::unrender(), joystick_manager::update_highlighted_hex(), vector_sum_assign(), actions::undo::move_action::write(), and unit::write().