Skip to content

Commit

Permalink
Getter for translated names of the hex field directions.
Browse files Browse the repository at this point in the history
  • Loading branch information
fendrin committed Jun 9, 2014
1 parent b7ef64c commit 03a455e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/map_location.cpp
Expand Up @@ -27,6 +27,7 @@
#include "formula_string_utils.hpp"
#include "map.hpp"
#include "resources.hpp"
#include "gettext.hpp"

#define ERR_CF LOG_STREAM(err, config)
#define LOG_G LOG_STREAM(info, general)
Expand Down Expand Up @@ -104,6 +105,27 @@ std::string map_location::write_direction(map_location::DIRECTION dir)
}
}

std::string map_location::write_translated_direction(map_location::DIRECTION dir)
{
switch(dir) {
case NORTH:
return _("North");
case NORTH_EAST:
return _("North East");
case NORTH_WEST:
return _("North West");
case SOUTH:
return _("South");
case SOUTH_EAST:
return _("South East");
case SOUTH_WEST:
return _("South West");
default:
return std::string();

}
}

map_location::map_location(const config& cfg, const variable_set *variables) :
x(-1000),
y(-1000)
Expand Down
1 change: 1 addition & 0 deletions src/map_location.hpp
Expand Up @@ -54,6 +54,7 @@ struct map_location {
*/
static std::vector<DIRECTION> parse_directions(const std::string& str);
static std::string write_direction(DIRECTION dir);
static std::string write_translated_direction(DIRECTION dir);

map_location() : x(-1000), y(-1000) {}
map_location(int x, int y) : x(x), y(y) {}
Expand Down

0 comments on commit 03a455e

Please sign in to comment.