summaryrefslogtreecommitdiff
path: root/src/text.cpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2017-12-14 14:09:07 +0100
committerPaweł Redman <pawel.redman@gmail.com>2017-12-14 14:09:07 +0100
commit154004ae6ac3747769648511cdc77e7171c684d8 (patch)
treea85cd8be5ee9c83e31f028ee9ffdf0ea1269e4ce /src/text.cpp
parent12143c33141a9c35e8eb01609062655f560b4bc1 (diff)
The gamelog, being reworking combat.
Diffstat (limited to 'src/text.cpp')
-rw-r--r--src/text.cpp61
1 files changed, 48 insertions, 13 deletions
diff --git a/src/text.cpp b/src/text.cpp
index b689c99..ad6af83 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -2,24 +2,59 @@
namespace text {
-const wchar_t *unit_no_path;
-const wchar_t *unit_blocked;
+language_t language = LANG_ENGLISH;
-static void load_strings_pl(void)
+static const char *human_names[] =
{
- unit_no_path = L"Nie wiem, jak się tam dostać.";
- unit_blocked = L"Coś stoi na mojej drodze.";
-}
+ "Kowalski", "Jackson", "Carter", "O'Neill", "Hammond", "Mitchell"
+};
+
+#define count(A) (sizeof(A) / sizeof((A)[0]))
-void load_strings(std::string lang)
+static std::string get_english(index_t index)
{
- if (lang == "pl") {
- load_strings_pl();
- return;
- }
+ switch (index) {
+ case SAY_BLOCKED:
+ return "Something is in my way.";
+
+ case SAY_NO_PATH:
+ return "I can't get there.";
+
+ case UNIT_ALIEN:
+ return "Alien";
+
+ case UNIT_HUMAN:
+ return human_names[rand() % count(human_names)];
+
+ case UNIT_DEATH:
+ return "Death";
+
+ case UNIT_ATTACK:
+ return "attacks";
- unit_no_path = L"I don't know how to get there.";
- unit_blocked = L"Something's in my way.";
+ case UNIT_MISS:
+ return "miss";
+
+ case UNIT_CRITICAL_MISS:
+ return "critical miss";
+
+ case UNIT_HIT:
+ return "hit";
+
+ case UNIT_CRITICAL_HIT:
+ return "critical hit";
+
+ case UNIT_DAMAGE:
+ return "deals damage to";
+ }
}
+std::string get(index_t index)
+{
+ switch (language) {
+ default:
+ return get_english(index);
+ }
}
+
+} // namespace text