summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-21 23:04:11 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-21 23:04:11 +0300
commitc544a5ebb53d51fa98392188d2b44dc6ec27c390 (patch)
tree030bef947a6a4a0b1c302b67013555f54834d49d /src
parenteed7ef561a9d590d507255118132676f868b1bd3 (diff)
downloadplus-c544a5ebb53d51fa98392188d2b44dc6ec27c390.tar.gz
plus-c544a5ebb53d51fa98392188d2b44dc6ec27c390.tar.bz2
plus-c544a5ebb53d51fa98392188d2b44dc6ec27c390.tar.xz
plus-c544a5ebb53d51fa98392188d2b44dc6ec27c390.zip
move "change attack type" option into gamemodifiers.
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp4
-rw-r--r--src/actionmanager.h2
-rw-r--r--src/being/localplayer.cpp35
-rw-r--r--src/being/localplayer.h9
-rw-r--r--src/gamemodifiers.cpp31
-rw-r--r--src/gamemodifiers.h4
-rw-r--r--src/gui/popups/statuspopup.cpp2
-rw-r--r--src/gui/windows/statuswindow.cpp2
-rw-r--r--src/input/inputactionmap.h2
-rw-r--r--src/settings.h2
10 files changed, 45 insertions, 48 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index bbf3c9571..1ceca4a1c 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -542,9 +542,9 @@ impHandler0(magicAttack)
return false;
}
-impHandler0(changeMagicAttack)
+impHandler0(changeMagicAttackType)
{
- callYellowBar(switchMagicAttack);
+ callYellowBar2(changeMagicAttackType);
}
impHandler0(changePvpMode)
diff --git a/src/actionmanager.h b/src/actionmanager.h
index 0286ba3cf..e4ec0d3f0 100644
--- a/src/actionmanager.h
+++ b/src/actionmanager.h
@@ -64,7 +64,7 @@ namespace ActionManager
decHandler(changeFollowMode);
decHandler(changeImitationMode);
decHandler(magicAttack);
- decHandler(changeMagicAttack);
+ decHandler(changeMagicAttackType);
decHandler(changePvpMode);
decHandler(changeMoveToTarget);
decHandler(copyEquippedToOutfit);
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 035697a73..84768e443 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -115,7 +115,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
mGMLevel(0),
mCrazyMoveState(0),
mMoveState(0),
- mMagicAttackType(config.getIntValue("magicAttackType")),
mPvpAttackType(config.getIntValue("pvpAttackType")),
mImitationMode(config.getIntValue("imitationMode")),
mLastTargetX(0),
@@ -1287,36 +1286,6 @@ std::string LocalPlayer::getMapDrawTypeString()
viewport->getMapDrawType(), debugPathSize));
}
-const unsigned magicAttackSize = 5;
-
-void LocalPlayer::switchMagicAttack(const bool forward)
-{
- changeMode(&mMagicAttackType, magicAttackSize, "magicAttackType",
- &LocalPlayer::getMagicAttackString, 0, true, forward);
-}
-
-static const char *const magicAttackStrings[] =
-{
- // TRANSLATORS: magic attack in status bar
- N_("(f) use #flar for magic attack"),
- // TRANSLATORS: magic attack in status bar
- N_("(c) use #chiza for magic attack"),
- // TRANSLATORS: magic attack in status bar
- N_("(I) use #ingrav for magic attack"),
- // TRANSLATORS: magic attack in status bar
- N_("(F) use #frillyar for magic attack"),
- // TRANSLATORS: magic attack in status bar
- N_("(U) use #upmarmu for magic attack"),
- // TRANSLATORS: magic attack in status bar
- N_("(?) magic attack")
-};
-
-std::string LocalPlayer::getMagicAttackString()
-{
- return gettext(getVarItem(&magicAttackStrings[0],
- mMagicAttackType, magicAttackSize));
-}
-
const unsigned pvpAttackSize = 4;
void LocalPlayer::switchPvpAttack(const bool forward)
@@ -2445,7 +2414,7 @@ void LocalPlayer::magicAttack() const
return;
}
- switch (mMagicAttackType)
+ switch (settings.magicAttackType)
{
// flar W00
case 0:
@@ -3463,7 +3432,7 @@ void LocalPlayer::resetYellowBar()
settings.followMode = config.resetIntValue("followMode");
settings.attackWeaponType = config.resetIntValue("attackWeaponType");
settings.attackType = config.resetIntValue("attackType");
- mMagicAttackType = config.resetIntValue("magicAttackType");
+ settings.magicAttackType = config.resetIntValue("magicAttackType");
mPvpAttackType = config.resetIntValue("pvpAttackType");
settings.quickDropCounter = config.resetIntValue("quickDropCounter");
settings.pickUpType = config.resetIntValue("pickUpType");
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 835e85dbe..354339016 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -203,13 +203,8 @@ class LocalPlayer final : public Being,
void setCrazyMoveState(const unsigned int n)
{ mCrazyMoveState = n; }
- void switchMagicAttack(const bool forward);
-
void switchPvpAttack(const bool forward);
- int getMagicAttackType() const A_WARN_UNUSED
- { return mMagicAttackType; }
-
int getPvpAttackType() const A_WARN_UNUSED
{ return mPvpAttackType; }
@@ -414,8 +409,6 @@ class LocalPlayer final : public Being,
static std::string getMapDrawTypeString();
- std::string getMagicAttackString();
-
std::string getPvpAttackString();
std::string getImitationModeString();
@@ -486,8 +479,6 @@ class LocalPlayer final : public Being,
unsigned int mCrazyMoveState;
// move state. used if mMoveType == 2
unsigned int mMoveState;
- // magic attack type
- unsigned int mMagicAttackType;
// pvp attack type
unsigned int mPvpAttackType;
unsigned int mImitationMode;
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index 3f2650659..87dcd5aa7 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -44,6 +44,7 @@ GameModifiers::GameModifiers()
settings.attackType = config.getIntValue("attackType");
settings.quickDropCounter = config.getIntValue("quickDropCounter");
settings.pickUpType = config.getIntValue("pickUpType");
+ settings.magicAttackType = config.getIntValue("magicAttackType");
}
GameModifiers::~GameModifiers()
@@ -350,3 +351,33 @@ std::string GameModifiers::getPickUpTypeString()
return gettext(getVarItem(&pickUpTypeStrings[0],
settings.pickUpType, pickUpTypeSize));
}
+
+const unsigned magicAttackSize = 5;
+
+void GameModifiers::changeMagicAttackType(const bool forward)
+{
+ changeMode(&settings.magicAttackType, magicAttackSize, "magicAttackType",
+ &GameModifiers::getMagicAttackString, 0, true, forward);
+}
+
+static const char *const magicAttackStrings[] =
+{
+ // TRANSLATORS: magic attack in status bar
+ N_("(f) use #flar for magic attack"),
+ // TRANSLATORS: magic attack in status bar
+ N_("(c) use #chiza for magic attack"),
+ // TRANSLATORS: magic attack in status bar
+ N_("(I) use #ingrav for magic attack"),
+ // TRANSLATORS: magic attack in status bar
+ N_("(F) use #frillyar for magic attack"),
+ // TRANSLATORS: magic attack in status bar
+ N_("(U) use #upmarmu for magic attack"),
+ // TRANSLATORS: magic attack in status bar
+ N_("(?) magic attack")
+};
+
+std::string GameModifiers::getMagicAttackString()
+{
+ return gettext(getVarItem(&magicAttackStrings[0],
+ settings.magicAttackType, magicAttackSize));
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index b08955588..cfb8e4210 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -58,6 +58,8 @@ class GameModifiers final
void changePickUpType(const bool forward);
+ void changeMagicAttackType(const bool forward);
+
void setQuickDropCounter(const int n);
std::string getMoveTypeString();
@@ -76,6 +78,8 @@ class GameModifiers final
std::string getPickUpTypeString();
+ std::string getMagicAttackString();
+
protected:
static const char *getVarItem(const char *const *const arr,
const unsigned index,
diff --git a/src/gui/popups/statuspopup.cpp b/src/gui/popups/statuspopup.cpp
index 0c7dc3bae..4612844a8 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -158,7 +158,7 @@ void StatusPopup::updateLabels() const
InputAction::CHANGE_PICKUP_TYPE);
setLabelText(8, LocalPlayer::getMapDrawTypeString(),
InputAction::PATHFIND);
- setLabelText(9, player_node->getMagicAttackString(),
+ setLabelText(9, modifiers->getMagicAttackString(),
InputAction::SWITCH_MAGIC_ATTACK);
setLabelText(10, player_node->getPvpAttackString(),
InputAction::SWITCH_PVP_ATTACK);
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 29d899711..27e47e1ad 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -649,7 +649,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
.append(" ").append(translateLetter2(
modifiers->getAttackWeaponTypeString()))
.append(translateLetter2(modifiers->getAttackTypeString()))
- .append(translateLetter2(player_node->getMagicAttackString()))
+ .append(translateLetter2(modifiers->getMagicAttackString()))
.append(translateLetter2(player_node->getPvpAttackString()))
.append(" ").append(translateLetter2(
modifiers->getQuickDropCounterString()))
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index cb1278d08..94bfb070a 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -1746,7 +1746,7 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputType::KEYBOARD, SDLK_COMMA,
InputType::UNKNOWN, InputAction::NO_VALUE,
Input::GRP_DEFAULT,
- &ActionManager::changeMagicAttack,
+ &ActionManager::changeMagicAttackType,
InputAction::NO_VALUE, 50,
InputCondition::GAME | InputCondition::VALIDSPEED
| InputCondition::EMODS},
diff --git a/src/settings.h b/src/settings.h
index e224eafb9..21b53fb7b 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -60,6 +60,7 @@ class Settings final
attackType(0U),
quickDropCounter(0U),
pickUpType(0U),
+ magicAttackType(0U),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -94,6 +95,7 @@ class Settings final
unsigned int attackType;
unsigned int quickDropCounter;
unsigned int pickUpType;
+ unsigned int magicAttackType;
bool persistentIp;
bool limitFps;
bool inputFocused;