diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-20 00:44:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-20 12:38:53 +0300 |
commit | bfb23727b86d05cbf4190ab1c36d6b32c2b85f77 (patch) | |
tree | 13ea684c20302e20ac355db9e12fa8f4262eeeff /src | |
parent | e081ded6fba48fed7da637076ceddb4dc8b40e03 (diff) | |
download | manaplus-bfb23727b86d05cbf4190ab1c36d6b32c2b85f77.tar.gz manaplus-bfb23727b86d05cbf4190ab1c36d6b32c2b85f77.tar.bz2 manaplus-bfb23727b86d05cbf4190ab1c36d6b32c2b85f77.tar.xz manaplus-bfb23727b86d05cbf4190ab1c36d6b32c2b85f77.zip |
Simplify yellow bars action.
Diffstat (limited to 'src')
-rw-r--r-- | src/actionmanager.cpp | 93 |
1 files changed, 27 insertions, 66 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index 593f3f6da..71e9a48b2 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -88,6 +88,22 @@ #define impHandler(name) bool name(const InputEvent &event) #define impHandler0(name) bool name(const InputEvent &event A_UNUSED) +#define callYellowBar(name) \ + if (player_node) \ + { \ + player_node->name(true); \ + return true; \ + } \ + return false; + +#define callYellowBarCond(name) \ + if (player_node && !player_node->getDisableGameModifiers()) \ + { \ + player_node->name(true); \ + return true; \ + } \ + return false; + extern ShortcutWindow *spellShortcutWindow; extern std::string tradePartnerName; extern QuitDialog *quitDialog; @@ -384,12 +400,7 @@ impHandler0(dropItem) impHandler0(switchQuickDrop) { - if (player_node && !player_node->getDisableGameModifiers()) - { - player_node->changeQuickDropCounter(true); - return true; - } - return false; + callYellowBarCond(changeQuickDropCounter) } impHandler0(heal) @@ -442,22 +453,12 @@ impHandler0(itenplz) impHandler0(changeCrazyMove) { - if (player_node) - { - player_node->changeCrazyMoveType(true); - return true; - } - return false; + callYellowBar(changeCrazyMoveType); } impHandler0(changePickupType) { - if (player_node) - { - player_node->changePickUpType(true); - return true; - } - return false; + callYellowBar(changePickUpType); } impHandler0(moveToTarget) @@ -496,52 +497,27 @@ impHandler0(setHome) impHandler0(changeMoveType) { - if (player_node) - { - player_node->invertDirection(true); - return true; - } - return false; + callYellowBar(invertDirection); } impHandler0(changeAttackWeaponType) { - if (player_node) - { - player_node->changeAttackWeaponType(true); - return true; - } - return false; + callYellowBar(changeAttackWeaponType); } impHandler0(changeAttackType) { - if (player_node) - { - player_node->changeAttackType(true); - return true; - } - return false; + callYellowBar(changeAttackType); } impHandler0(changeFollowMode) { - if (player_node) - { - player_node->changeFollowMode(true); - return true; - } - return false; + callYellowBar(changeFollowMode); } impHandler0(changeImitationMode) { - if (player_node) - { - player_node->changeImitationMode(true); - return true; - } - return false; + callYellowBar(changeImitationMode); } impHandler0(magicAttack) @@ -556,32 +532,17 @@ impHandler0(magicAttack) impHandler0(changeMagicAttack) { - if (player_node) - { - player_node->switchMagicAttack(true); - return true; - } - return false; + callYellowBar(switchMagicAttack); } impHandler0(changePvpMode) { - if (player_node) - { - player_node->switchPvpAttack(true); - return true; - } - return false; + callYellowBar(switchPvpAttack); } impHandler0(changeMoveToTarget) { - if (player_node) - { - player_node->changeMoveToTargetType(true); - return true; - } - return false; + callYellowBar(changeMoveToTargetType); } impHandler0(copyEquippedToOutfit) |