Map Location: specialize steam operator for direction enum
This commit is contained in:
parent
c815e1d23a
commit
c5069a6036
2 changed files with 11 additions and 0 deletions
|
@ -37,6 +37,7 @@ std::ostream &operator<<(std::ostream &s, const map_location& l) {
|
|||
s << (l.wml_x()) << ',' << (l.wml_y());
|
||||
return s;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &s, const std::vector<map_location>& v) {
|
||||
std::vector<map_location>::const_iterator i = v.begin();
|
||||
for(; i!= v.end(); ++i) {
|
||||
|
@ -45,6 +46,13 @@ std::ostream &operator<<(std::ostream &s, const std::vector<map_location>& v) {
|
|||
return s;
|
||||
}
|
||||
|
||||
/** Print a direction to stream. */
|
||||
std::ostream& operator<<(std::ostream& s, map_location::direction dir)
|
||||
{
|
||||
s << map_location::write_direction(dir);
|
||||
return s;
|
||||
}
|
||||
|
||||
map_location::map_location(const config_attribute_value& x, const config_attribute_value& y, wml_loc)
|
||||
: map_location(x.to_int(), y.to_int(), wml_loc{})
|
||||
{
|
||||
|
|
|
@ -234,6 +234,9 @@ std::ostream &operator<<(std::ostream &s, const map_location& l);
|
|||
/** Dumps a vector of positions on a stream, for debug purposes. */
|
||||
std::ostream &operator<<(std::ostream &s, const std::vector<map_location>& v);
|
||||
|
||||
/** Print a direction's string representation to stream. */
|
||||
std::ostream& operator<<(std::ostream& s, map_location::direction dir);
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<map_location> {
|
||||
|
|
Loading…
Add table
Reference in a new issue