diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-23 23:21:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-23 23:21:32 +0300 |
commit | 63c072892b781d7661c505853ef8775eec593c7c (patch) | |
tree | 05829bdd38927fb60ea678dae57640be1fc197fb /src | |
parent | b700c6dde6b34b3f5ec3cbd492ffc490bbfef922 (diff) | |
download | plus-63c072892b781d7661c505853ef8775eec593c7c.tar.gz plus-63c072892b781d7661c505853ef8775eec593c7c.tar.bz2 plus-63c072892b781d7661c505853ef8775eec593c7c.tar.xz plus-63c072892b781d7661c505853ef8775eec593c7c.zip |
In gamemodifiers combine macro addModifier and stringModifier.
Diffstat (limited to 'src')
-rw-r--r-- | src/gamemodifiers.cpp | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp index b25a7a4e6..2db410884 100644 --- a/src/gamemodifiers.cpp +++ b/src/gamemodifiers.cpp @@ -42,9 +42,15 @@ #include "debug.h" -#define addModifier(name, sz) \ - static const unsigned m##name##Size = sz; \ - static const char *const m##name##Strings[] = +#define addModifier(name1, name2, sz, ...) \ + static const unsigned m##name1##Size = sz; \ + static const char *const m##name1##Strings[] = \ + __VA_ARGS__; \ + std::string GameModifiers::get##name1##String() \ + { \ + return gettext(getVarItem(&m##name1##Strings[0], \ + settings.name2, m##name1##Size)); \ + } #define addModifier2(name1, name2, str, sz, ...) \ static const unsigned m##name1##Size = sz; \ @@ -61,13 +67,6 @@ settings.name2, m##name1##Size)); \ } -#define stringModifier(name1, name2) \ - std::string GameModifiers::get##name1##String() \ - { \ - return gettext(getVarItem(&m##name1##Strings[0], \ - settings.name2, m##name1##Size)); \ - } - #define changeMethod(name1, name2, str) \ void GameModifiers::change##name1(const bool forward) \ { \ @@ -139,7 +138,7 @@ const char *GameModifiers::getVarItem(const char *const *const arr, return arr[sz]; } -addModifier(MoveType, 5) +addModifier(MoveType, moveType, 5, { // TRANSLATORS: move type in status bar N_("(D) default moves"), @@ -153,7 +152,7 @@ addModifier(MoveType, 5) N_("(d) double normal + crazy"), // TRANSLATORS: move type in status bar N_("(?) unknown move") -}; +}) void GameModifiers::changeMoveType(const bool forward) { @@ -162,8 +161,6 @@ void GameModifiers::changeMoveType(const bool forward) &GameModifiers::getMoveTypeString, 0, false, forward); } -stringModifier(MoveType, moveType) - static const unsigned mCrazyMoveTypeSize = 11; void GameModifiers::changeCrazyMoveType(const bool forward) @@ -355,7 +352,7 @@ addModifier2(ImitationMode, imitationMode, "imitationMode", 2, N_("(?) imitation") }) -addModifier(GameModifiers, 2) +addModifier(GameModifiers, disableGameModifiers, 2, { // TRANSLATORS: game modifiers state in status bar N_("Game modifiers are enabled"), @@ -363,7 +360,7 @@ addModifier(GameModifiers, 2) N_("Game modifiers are disabled"), // TRANSLATORS: game modifiers state in status bar N_("Game modifiers are unknown") -}; +}) void GameModifiers::changeGameModifiers() { @@ -372,9 +369,7 @@ void GameModifiers::changeGameModifiers() UpdateStatusListener::distributeEvent(); } -stringModifier(GameModifiers, disableGameModifiers) - -addModifier(MapDrawType, 7) +addModifier(MapDrawType, mapDrawType, 7, { // TRANSLATORS: map view type in status bar N_("(N) normal map view"), @@ -392,11 +387,9 @@ addModifier(MapDrawType, 7) N_("(b) black & white map view"), // TRANSLATORS: pickup size in status bar N_("(?) map view") -}; - -stringModifier(MapDrawType, mapDrawType) +}) -addModifier(AwayMode, 2) +addModifier(AwayMode, awayMode, 2, { // TRANSLATORS: away type in status bar N_("(O) on keyboard"), @@ -404,7 +397,7 @@ addModifier(AwayMode, 2) N_("(A) away"), // TRANSLATORS: away type in status bar N_("(?) away") -}; +}) void GameModifiers::changeAwayMode() { @@ -447,9 +440,7 @@ void GameModifiers::changeAwayMode() } } -stringModifier(AwayMode, awayMode) - -addModifier(CameraMode, 2) +addModifier(CameraMode, cameraMode, 2, { // TRANSLATORS: camera mode in status bar N_("(G) game camera mode"), @@ -457,6 +448,4 @@ addModifier(CameraMode, 2) N_("(F) free camera mode"), // TRANSLATORS: camera mode in status bar N_("(?) away") -}; - -stringModifier(CameraMode, cameraMode) +}) |