diff options
Diffstat (limited to 'src/text.cpp')
-rw-r--r-- | src/text.cpp | 61 |
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 |