gamemap::location Struct Reference

Represents a location on the map. More...

#include <map.hpp>

Inheritance diagram for gamemap::location:

Inheritance graph
[legend]
Collaboration diagram for gamemap::location:

Collaboration graph
[legend]

List of all members.

Public Types

enum  DIRECTION {
  NORTH, NORTH_EAST, SOUTH_EAST, SOUTH,
  SOUTH_WEST, NORTH_WEST, NDIRECTIONS
}
 Valid directions which can be moved in our hexagonal world. More...

Public Member Functions

 location ()
 location (int x, int y)
 location (const config &cfg, const variable_set *variables)
void write (config &cfg) const
bool valid () const
bool valid (const int parWidth, const int parHeight) const
bool matches_range (const std::string &xloc, const std::string &yloc) const
bool operator< (const location &a) const
bool operator== (const location &a) const
bool operator!= (const location &a) const
location operator- () const
location operator+ (const location &a) const
locationoperator+= (const location &a)
location operator- (const location &a) const
locationoperator-= (const location &a)
location get_direction (DIRECTION d, int n=1) const
DIRECTION get_relative_dir (location loc) const

Static Public Member Functions

static DIRECTION parse_direction (const std::string &str)
static std::vector< DIRECTIONparse_directions (const std::string &str)
 Parse_directions takes a comma-separated list, and filters out any invalid directions.
static std::string write_direction (DIRECTION dir)
static DIRECTION get_opposite_dir (DIRECTION d)

Public Attributes

int x
int y

Static Public Attributes

static const location null_location


Detailed Description

Represents a location on the map.

Definition at line 62 of file map.hpp.


Member Enumeration Documentation

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 64 of file map.hpp.


Constructor & Destructor Documentation

gamemap::location::location (  )  [inline]

Definition at line 73 of file map.hpp.

Referenced by display::create_buttons(), and get_relative_dir().

gamemap::location::location ( int  x,
int  y 
) [inline]

Definition at line 74 of file map.hpp.

gamemap::location::location ( const config cfg,
const variable_set variables 
)

Definition at line 158 of file map.cpp.

References utils::interpolate_variables_into_string(), x, and y.


Member Function Documentation

gamemap::location::DIRECTION gamemap::location::parse_direction ( const std::string &  str  )  [static]

std::vector< gamemap::location::DIRECTION > gamemap::location::parse_directions ( const std::string &  str  )  [static]

Parse_directions takes a comma-separated list, and filters out any invalid directions.

Definition at line 121 of file map.cpp.

References NDIRECTIONS, parse_direction(), and utils::split().

Referenced by unit::internal_matches_filter(), and terrain_filter::match_internal().

std::string gamemap::location::write_direction ( DIRECTION  dir  )  [static]

Definition at line 137 of file map.cpp.

References NORTH, NORTH_EAST, NORTH_WEST, SOUTH, SOUTH_EAST, and SOUTH_WEST.

Referenced by game_display::attack_indicator_direction(), and unit::write().

void gamemap::location::write ( config cfg  )  const

bool gamemap::location::valid (  )  const [inline]

bool gamemap::location::valid ( const int  parWidth,
const int  parHeight 
) const [inline]

Definition at line 81 of file map.hpp.

References x, and y.

bool gamemap::location::matches_range ( const std::string &  xloc,
const std::string &  yloc 
) const

bool gamemap::location::operator< ( const location a  )  const [inline]

Definition at line 90 of file map.hpp.

References x, and y.

bool gamemap::location::operator== ( const location a  )  const [inline]

Definition at line 91 of file map.hpp.

References x, and y.

Referenced by operator!=().

bool gamemap::location::operator!= ( const location a  )  const [inline]

Definition at line 92 of file map.hpp.

References operator==().

gamemap::location gamemap::location::operator- (  )  const

Definition at line 186 of file map.cpp.

References x, and y.

gamemap::location gamemap::location::operator+ ( const location a  )  const

Definition at line 195 of file map.cpp.

Referenced by operator-().

gamemap::location & gamemap::location::operator+= ( const location a  ) 

Definition at line 202 of file map.cpp.

References x, and y.

Referenced by operator-=().

gamemap::location gamemap::location::operator- ( const location a  )  const

Definition at line 217 of file map.cpp.

References operator+().

gamemap::location & gamemap::location::operator-= ( const location a  ) 

Definition at line 222 of file map.cpp.

References operator+=().

gamemap::location gamemap::location::get_direction ( DIRECTION  d,
int  n = 1 
) const

gamemap::location::DIRECTION gamemap::location::get_relative_dir ( gamemap::location  loc  )  const

gamemap::location::DIRECTION gamemap::location::get_opposite_dir ( DIRECTION  d  )  [static]

Definition at line 264 of file map.cpp.

References NDIRECTIONS, NORTH, NORTH_EAST, NORTH_WEST, SOUTH, SOUTH_EAST, and SOUTH_WEST.

Referenced by get_direction(), unit::overlaps(), and parse_direction().


Member Data Documentation

Definition at line 86 of file map.hpp.

Referenced by terrain_builder::add_constraints(), check_checksums(), team::clear_fog(), team::clear_shroud(), clear_shroud_loc(), passage_path_calculator::cost(), default_generate_map(), distance_between(), location_callable::do_compare(), events::menu_handler::do_search(), terrain_label::draw(), display::draw_border(), display::draw_init(), map_editor::edit_rotate_selection(), formula_ai::execute_variant(), play_controller::expand_wml_commands(), team::fogged(), generate_river_internal(), get_adjacent_tiles(), get_direction(), gamemap::get_drawing_order(), gui::menu::get_item_rect_internal(), display::get_location_x(), display::get_location_y(), get_player_info(), display::get_rect_hex_bounds(), get_relative_dir(), gamemap::get_terrain(), terrain_callable::get_value(), unit_callable::get_value(), location_callable::get_value(), a_star_world::getNodeFromLocation(), game_display::invalidate_animations(), display::invalidate_locations_in_rect(), display::invalidate_rectangle(), is_shrouded(), image::locator::load_image_sub_file(), location(), unit::matches_filter(), matches_range(), display::minimap_location_on(), ai::move_group(), unit::move_interrupted(), ai::move_leader_after_recruit(), dfool::dfool_ai::moveto(), gamemap::on_board(), cave_map_generator::on_board(), terrain_builder::tilemap::on_map(), display::ordered_draw::operator()(), operator+=(), operator-(), operator<(), operator<<(), operator==(), gamemap::operator[](), terrain_builder::tilemap::operator[](), terrain_builder::parse_config(), cave_map_generator::place_castle(), team::place_shroud(), place_village(), placing_score(), help::help_menu::process(), game_display::process_reachmap_changes(), unit::read(), editormap::resize(), terrain_builder::rotate(), terrain_builder::rule_matches(), location_callable::serialize_to_string(), gamemap::set_terrain(), cave_map_generator::set_terrain(), team::shrouded(), tiles_adjacent(), valid(), dfool::distance_evaluator::value(), unit::write(), gamemap::write(), and write().

Definition at line 86 of file map.hpp.

Referenced by terrain_builder::add_constraints(), check_checksums(), team::clear_fog(), team::clear_shroud(), clear_shroud_loc(), passage_path_calculator::cost(), default_generate_map(), distance_between(), location_callable::do_compare(), events::menu_handler::do_search(), terrain_label::draw(), display::draw_border(), display::draw_init(), map_editor::edit_rotate_selection(), formula_ai::execute_variant(), play_controller::expand_wml_commands(), team::fogged(), generate_river_internal(), get_adjacent_tiles(), get_direction(), gamemap::get_drawing_order(), gui::menu::get_item_rect_internal(), display::get_location_y(), get_player_info(), display::get_rect_hex_bounds(), get_relative_dir(), gamemap::get_terrain(), terrain_callable::get_value(), unit_callable::get_value(), location_callable::get_value(), a_star_world::getNodeFromLocation(), game_display::invalidate_animations(), display::invalidate_locations_in_rect(), display::invalidate_rectangle(), is_shrouded(), image::locator::load_image_sub_file(), location(), unit::matches_filter(), matches_range(), display::minimap_location_on(), ai::move_group(), unit::move_interrupted(), ai::move_leader_after_recruit(), dfool::dfool_ai::moveto(), gamemap::on_board(), cave_map_generator::on_board(), terrain_builder::tilemap::on_map(), display::ordered_draw::operator()(), operator+=(), operator-(), operator<(), operator<<(), operator==(), gamemap::operator[](), terrain_builder::tilemap::operator[](), terrain_builder::parse_config(), cave_map_generator::place_castle(), team::place_shroud(), place_village(), placing_score(), game_display::process_reachmap_changes(), unit::read(), editormap::resize(), terrain_builder::rotate(), terrain_builder::rule_matches(), location_callable::serialize_to_string(), gamemap::set_terrain(), cave_map_generator::set_terrain(), team::shrouded(), tiles_adjacent(), valid(), dfool::distance_evaluator::value(), unit::write(), gamemap::write(), and write().


The documentation for this struct was generated from the following files:

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs