diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-20 20:58:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-21 00:18:17 +0300 |
commit | 744b9d6689b67779a1d17c6d3de7cd016ca1033b (patch) | |
tree | 8c7f235ec6ffd1f00bd6865a355be3f731b30395 /src/gamemodifiers.cpp | |
parent | c42d25a77f5bd7bcd04636abded20452a753fa6d (diff) | |
download | manaverse-744b9d6689b67779a1d17c6d3de7cd016ca1033b.tar.gz manaverse-744b9d6689b67779a1d17c6d3de7cd016ca1033b.tar.bz2 manaverse-744b9d6689b67779a1d17c6d3de7cd016ca1033b.tar.xz manaverse-744b9d6689b67779a1d17c6d3de7cd016ca1033b.zip |
move "change move" option into gamemodifiers.
Diffstat (limited to 'src/gamemodifiers.cpp')
-rw-r--r-- | src/gamemodifiers.cpp | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp index 3aa5b3b0f..aea2fa6d6 100644 --- a/src/gamemodifiers.cpp +++ b/src/gamemodifiers.cpp @@ -21,11 +21,16 @@ #include "gamemodifiers.h" #include "configuration.h" +#include "settings.h" + +#include "being/localplayer.h" #include "gui/widgets/tabs/chattab.h" #include "listeners/updatestatuslistener.h" +#include "utils/gettext.h" + #include "debug.h" GameModifiers *modifiers = nullptr; @@ -39,12 +44,12 @@ GameModifiers::~GameModifiers() } void GameModifiers::changeMode(unsigned *restrict const var, - const unsigned limit, - const char *restrict const conf, - std::string (GameModifiers::*const func)(), - const unsigned def, - const bool save, - const bool forward) + const unsigned limit, + const char *restrict const conf, + std::string (GameModifiers::*const func)(), + const unsigned def, + const bool save, + const bool forward) { if (!var) return; @@ -70,3 +75,43 @@ void GameModifiers::changeMode(unsigned *restrict const var, if (str.size() > 4) debugMsg(str.substr(4)); } + +const char *GameModifiers::getVarItem(const char *const *const arr, + const unsigned index, + const unsigned sz) +{ + if (index < sz) + return arr[index]; + return arr[sz]; +} + +static const unsigned moveTypeSize = 5; + +void GameModifiers::changeMoveType(const bool forward) +{ + player_node->setMoveState(0); + changeMode(&settings.moveType, moveTypeSize, "invertMoveDirection", + &GameModifiers::getMoveTypeString, 0, false, forward); +} + +static const char *const moveTypeStrings[] = +{ + // TRANSLATORS: move type in status bar + N_("(D) default moves"), + // TRANSLATORS: move type in status bar + N_("(I) invert moves"), + // TRANSLATORS: move type in status bar + N_("(c) moves with some crazy moves"), + // TRANSLATORS: move type in status bar + N_("(C) moves with crazy moves"), + // TRANSLATORS: move type in status bar + N_("(d) double normal + crazy"), + // TRANSLATORS: move type in status bar + N_("(?) unknown move") +}; + +std::string GameModifiers::getMoveTypeString() +{ + return gettext(getVarItem(&moveTypeStrings[0], + settings.moveType, moveTypeSize)); +} |