From 03a455e35fffa43b9f5e5ede0b192aa35fd73013 Mon Sep 17 00:00:00 2001 From: fendrin Date: Mon, 9 Jun 2014 16:09:27 +0200 Subject: [PATCH] Getter for translated names of the hex field directions. --- src/map_location.cpp | 22 ++++++++++++++++++++++ src/map_location.hpp | 1 + 2 files changed, 23 insertions(+) diff --git a/src/map_location.cpp b/src/map_location.cpp index 6e6c85f49a0a..733f391efc81 100644 --- a/src/map_location.cpp +++ b/src/map_location.cpp @@ -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) @@ -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) diff --git a/src/map_location.hpp b/src/map_location.hpp index 6e84f9b9e500..fa91655279fd 100644 --- a/src/map_location.hpp +++ b/src/map_location.hpp @@ -54,6 +54,7 @@ struct map_location { */ static std::vector 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) {}