summaryrefslogtreecommitdiff
path: root/src/gamemodifiers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gamemodifiers.cpp')
-rw-r--r--src/gamemodifiers.cpp57
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));
+}