The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions
location.cpp File Reference

Routines related to game-maps, terrain, locations, directions. More...

#include "global.hpp"
#include <cassert>
#include "map/location.hpp"
#include "config.hpp"
#include "formula/string_utils.hpp"
#include "gettext.hpp"
#include "util.hpp"
#include <boost/functional/hash.hpp>
Include dependency graph for location.cpp:

Go to the source code of this file.

Macros

#define ERR_CF   LOG_STREAM(err, config)
 
#define LOG_G   LOG_STREAM(info, general)
 
#define DBG_G   LOG_STREAM(debug, general)
 

Functions

std::ostream & operator<< (std::ostream &s, map_location const &l)
 Dumps a position on a stream, for debug purposes. More...
 
std::ostream & operator<< (std::ostream &s, std::vector< map_location > const &v)
 Dumps a vector of positions on a stream, for debug purposes. More...
 
std::size_t hash_value (map_location const &a)
 Moved out of inline because of the boost dependency. More...
 
static bool is_vertically_higher_than (const map_location &m1, const map_location &m2)
 
void write_location_range (const std::set< map_location > &locs, config &cfg)
 Write a set of locations into a config using ranges, adding keys x=x1,..,xn and y=y1a-y1b,..,yna-ynb. More...
 
static map_location read_locations_helper (const std::string &xi, const std::string &yi)
 
void read_locations (const config &cfg, std::vector< map_location > &locs)
 Parse x,y keys of a config into a vector of locations. More...
 
void write_locations (const std::vector< map_location > &locs, config &cfg)
 Write a vector of locations into a config adding keys x=x1,x2,..,xn and y=y1,y2,..,yn. More...
 

Detailed Description

Routines related to game-maps, terrain, locations, directions.

etc.

Definition in file location.cpp.

Macro Definition Documentation

#define DBG_G   LOG_STREAM(debug, general)

Definition at line 35 of file location.cpp.

#define ERR_CF   LOG_STREAM(err, config)

Definition at line 33 of file location.cpp.

#define LOG_G   LOG_STREAM(info, general)

Definition at line 34 of file location.cpp.

Function Documentation

std::size_t hash_value ( map_location const &  a)

Moved out of inline because of the boost dependency.

Definition at line 63 of file location.cpp.

References h, map_location::x, and map_location::y.

static bool is_vertically_higher_than ( const map_location m1,
const map_location m2 
)
static

Definition at line 211 of file location.cpp.

References is_even(), is_odd(), map_location::x, and map_location::y.

Referenced by map_location::get_relative_dir().

std::ostream& operator<< ( std::ostream &  s,
map_location const &  l 
)

Dumps a position on a stream, for debug purposes.

Definition at line 37 of file location.cpp.

References map_location::x, and map_location::y.

std::ostream& operator<< ( std::ostream &  s,
std::vector< map_location > const &  v 
)

Dumps a vector of positions on a stream, for debug purposes.

Definition at line 41 of file location.cpp.

References i.

void read_locations ( const config cfg,
std::vector< map_location > &  locs 
)

Parse x,y keys of a config into a vector of locations.

Throws bad_lexical_cast if it fails to parse.

Definition at line 413 of file location.cpp.

References read_locations_helper(), and utils::split().

Referenced by fix_rename_command(), actions::shroud_clearing_action::shroud_clearing_action(), soundsource::sourcespec::sourcespec(), and SYNCED_COMMAND_HANDLER_FUNCTION().

static map_location read_locations_helper ( const std::string xi,
const std::string yi 
)
static

Definition at line 408 of file location.cpp.

Referenced by read_locations().

void write_location_range ( const std::set< map_location > &  locs,
config cfg 
)

Write a set of locations into a config using ranges, adding keys x=x1,..,xn and y=y1a-y1b,..,yna-ynb.

Definition at line 371 of file location.cpp.

References i.

Referenced by tod_manager::to_config(), and team::write().

void write_locations ( const std::vector< map_location > &  locs,
config cfg 
)

Write a vector of locations into a config adding keys x=x1,x2,..,xn and y=y1,y2,..,yn.

Definition at line 425 of file location.cpp.

References i.

Referenced by replay_helper::get_movement(), actions::shroud_clearing_action::write(), and soundsource::positional_source::write_config().