summaryrefslogtreecommitdiff
path: root/src/gamemodifiers.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-23 17:14:13 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-23 17:14:13 +0300
commit139a87ebc3fc14dbb9e51442d19863a974e889fc (patch)
treeebb30fa7f0ef5606049b5c58a20d5fc85a38b724 /src/gamemodifiers.cpp
parent9f05a455bc052317260d859f82e80d36f4f21991 (diff)
downloadmv-139a87ebc3fc14dbb9e51442d19863a974e889fc.tar.gz
mv-139a87ebc3fc14dbb9e51442d19863a974e889fc.tar.bz2
mv-139a87ebc3fc14dbb9e51442d19863a974e889fc.tar.xz
mv-139a87ebc3fc14dbb9e51442d19863a974e889fc.zip
In gamemodifiers combine stringModifier and changeMethod.
Diffstat (limited to 'src/gamemodifiers.cpp')
-rw-r--r--src/gamemodifiers.cpp44
1 files changed, 20 insertions, 24 deletions
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index 8c3e56e64..3c68646b6 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -60,6 +60,18 @@
&GameModifiers::get##name1##String, 0, true, forward); \
}
+#define changeMethod2(name1, name2, str) \
+ void GameModifiers::change##name1(const bool forward) \
+ { \
+ changeMode(&settings.name2, m##name1##Size, str, \
+ &GameModifiers::get##name1##String, 0, true, forward); \
+ } \
+ std::string GameModifiers::get##name1##String() \
+ { \
+ return gettext(getVarItem(&m##name1##Strings[0], \
+ settings.name2, m##name1##Size)); \
+ }
+
GameModifiers *modifiers = nullptr;
GameModifiers::GameModifiers()
@@ -211,9 +223,7 @@ addModifier(MoveToTargetType, 13)
N_("(?) move to target")
};
-changeMethod(MoveToTargetType, moveToTargetType, "moveToTargetType")
-
-stringModifier(MoveToTargetType, moveToTargetType)
+changeMethod2(MoveToTargetType, moveToTargetType, "moveToTargetType")
addModifier(FollowMode, 4)
{
@@ -229,9 +239,7 @@ addModifier(FollowMode, 4)
N_("(?) unknown follow")
};
-changeMethod(FollowMode, followMode, "followMode")
-
-stringModifier(FollowMode, followMode)
+changeMethod2(FollowMode, followMode, "followMode")
addModifier(AttackWeaponType, 4)
{
@@ -247,9 +255,7 @@ addModifier(AttackWeaponType, 4)
N_("(?) attack")
};
-changeMethod(AttackWeaponType, attackWeaponType, "attackWeaponType")
-
-stringModifier(AttackWeaponType, attackWeaponType)
+changeMethod2(AttackWeaponType, attackWeaponType, "attackWeaponType")
addModifier(AttackType, 4)
{
@@ -265,9 +271,7 @@ addModifier(AttackType, 4)
N_("(?) attack")
};
-changeMethod(AttackType, attackType, "attackType")
-
-stringModifier(AttackType, attackType)
+changeMethod2(AttackType, attackType, "attackType")
const unsigned mQuickDropCounterSize = 31;
@@ -316,9 +320,7 @@ addModifier(PickUpType, 7)
N_("(?) pick up")
};
-changeMethod(PickUpType, pickUpType, "pickUpType")
-
-stringModifier(PickUpType, pickUpType)
+changeMethod2(PickUpType, pickUpType, "pickUpType")
addModifier(MagicAttackType, 5)
{
@@ -336,9 +338,7 @@ addModifier(MagicAttackType, 5)
N_("(?) magic attack")
};
-changeMethod(MagicAttackType, magicAttackType, "magicAttackType")
-
-stringModifier(MagicAttackType, magicAttackType)
+changeMethod2(MagicAttackType, magicAttackType, "magicAttackType")
addModifier(PvpAttackType, 4)
{
@@ -354,9 +354,7 @@ addModifier(PvpAttackType, 4)
N_("(?) pvp attack")
};
-changeMethod(PvpAttackType, pvpAttackType, "pvpAttackType")
-
-stringModifier(PvpAttackType, pvpAttackType)
+changeMethod2(PvpAttackType, pvpAttackType, "pvpAttackType")
addModifier(ImitationMode, 2)
{
@@ -368,9 +366,7 @@ addModifier(ImitationMode, 2)
N_("(?) imitation")
};
-changeMethod(ImitationMode, imitationMode, "imitationMode")
-
-stringModifier(ImitationMode, imitationMode)
+changeMethod2(ImitationMode, imitationMode, "imitationMode")
addModifier(GameModifiers, 2)
{