diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-12-17 19:51:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-12-17 19:51:59 +0300 |
commit | 58c319a56a70588b59868099c659f70209a60be1 (patch) | |
tree | 8f964df390f54834bf3a6b4b9d2eeeec66d1b3f8 /src | |
parent | 2bd61993e4b8cb190fbbbcf620f4901636404d48 (diff) | |
download | manaverse-58c319a56a70588b59868099c659f70209a60be1.tar.gz manaverse-58c319a56a70588b59868099c659f70209a60be1.tar.bz2 manaverse-58c319a56a70588b59868099c659f70209a60be1.tar.xz manaverse-58c319a56a70588b59868099c659f70209a60be1.zip |
Remove default parameters from localplayer.
Diffstat (limited to 'src')
-rw-r--r-- | src/being/crazymoves.cpp | 2 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 44 | ||||
-rw-r--r-- | src/being/localplayer.h | 47 | ||||
-rw-r--r-- | src/net/ea/playerrecv.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/beingrecv.cpp | 8 | ||||
-rw-r--r-- | src/progs/manaplus/actions/actions.cpp | 12 | ||||
-rw-r--r-- | src/progs/manaplus/actions/commands.cpp | 2 | ||||
-rw-r--r-- | src/progs/manaplus/actions/move.cpp | 2 | ||||
-rw-r--r-- | src/progs/manaplus/gui/viewport.cpp | 8 |
10 files changed, 75 insertions, 56 deletions
diff --git a/src/being/crazymoves.cpp b/src/being/crazymoves.cpp index 5fb093d9d..e2d960aa4 100644 --- a/src/being/crazymoves.cpp +++ b/src/being/crazymoves.cpp @@ -806,7 +806,7 @@ void CrazyMoves::crazyMoveA() else if (mMoveProgram[settings.crazyMoveState] == 'p') { settings.crazyMoveState ++; - localPlayer->pickUpItems(); + localPlayer->pickUpItems(0); } // emote else if (mMoveProgram[settings.crazyMoveState] == 'e' diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 206f1f1ca..e12bdbdf4 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -334,7 +334,7 @@ void LocalPlayer::logic() } if (mKeepAttacking && (mTarget != nullptr)) - attack(mTarget, true); + attack(mTarget, true, false); } } @@ -466,10 +466,12 @@ void LocalPlayer::nextTile() pickUp(mPickUpTarget); } - if (mGoingToTarget && (mTarget != nullptr) && withinAttackRange(mTarget)) + if (mGoingToTarget && + mTarget != nullptr && + withinAttackRange(mTarget, false, 0)) { mAction = BeingAction::STAND; - attack(mTarget, true); + attack(mTarget, true, false); mGoingToTarget = false; mPath.clear(); return; @@ -780,7 +782,8 @@ bool LocalPlayer::emote(const uint8_t emotion) return true; } -void LocalPlayer::attack(Being *const target, const bool keep, +void LocalPlayer::attack(Being *const target, + const bool keep, const bool dontChangeEquipment) { mKeepAttacking = keep; @@ -841,7 +844,7 @@ void LocalPlayer::attack(Being *const target, const bool keep, } if (!keep) - stopAttack(); + stopAttack(false); } void LocalPlayer::stopAttack(const bool keepAttack) @@ -1190,7 +1193,8 @@ void LocalPlayer::addJobMessage(const int64_t change) addMessageToQueue(strprintf("%s %s", xpStr.c_str(), // TRANSLATORS: this is job experience - _("job"))); + _("job")), + UserColorId::EXP_INFO); } } else @@ -1198,7 +1202,8 @@ void LocalPlayer::addJobMessage(const int64_t change) addMessageToQueue(strprintf("%s %s", xpStr.c_str(), // TRANSLATORS: this is job experience - _("job"))); + _("job")), + UserColorId::EXP_INFO); } } } @@ -1210,7 +1215,8 @@ void LocalPlayer::addXpMessage(const int64_t change) addMessageToQueue(strprintf("%s %s", toString(CAST_U64(change)).c_str(), // TRANSLATORS: get xp message - _("xp"))); + _("xp")), + UserColorId::EXP_INFO); } } @@ -1223,7 +1229,8 @@ void LocalPlayer::addHomunXpMessage(const int change) _("Homun"), change, // TRANSLATORS: get xp message - _("xp"))); + _("xp")), + UserColorId::EXP_INFO); } } @@ -1232,7 +1239,8 @@ void LocalPlayer::addHpMessage(const int change) if (change != 0 && mMessages.size() < 20) { // TRANSLATORS: get hp message - addMessageToQueue(strprintf("%d %s", change, _("hp"))); + addMessageToQueue(strprintf("%d %s", change, _("hp")), + UserColorId::EXP_INFO); } } @@ -1241,7 +1249,8 @@ void LocalPlayer::addSpMessage(const int change) if (change != 0 && mMessages.size() < 20) { // TRANSLATORS: get hp message - addMessageToQueue(strprintf("%d %s", change, _("mana"))); + addMessageToQueue(strprintf("%d %s", change, _("mana")), + UserColorId::EXP_INFO); } } @@ -2268,7 +2277,8 @@ int LocalPlayer::getAttackRange2() const return range; } -void LocalPlayer::attack2(Being *const target, const bool keep, +void LocalPlayer::attack2(Being *const target, + const bool keep, const bool dontChangeEquipment) { if (!dontChangeEquipment && (target != nullptr)) @@ -2283,12 +2293,12 @@ void LocalPlayer::attack2(Being *const target, const bool keep, (withinAttackRange(target, broken, broken ? 1 : 0) && getPathLength(target) <= getAttackRange2())) { - attack(target, keep); + attack(target, keep, false); if (settings.attackType == 2) { if (target == nullptr) { - if (pickUpItems()) + if (pickUpItems(0)) return; } else @@ -2301,14 +2311,14 @@ void LocalPlayer::attack2(Being *const target, const bool keep, { if (settings.attackType == 2) { - if (pickUpItems()) + if (pickUpItems(0)) return; } setTarget(target); if (target->getType() != ActorType::Npc) { mKeepAttacking = true; - moveToTarget(); + moveToTarget(-1); } } } @@ -2526,7 +2536,7 @@ void LocalPlayer::followMoveTo(const Being *const being, setTarget(b); } } - moveToTarget(); + moveToTarget(-1); setNextDest(x2, y2); break; default: diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 11ac545bc..a262a6651 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -56,7 +56,7 @@ class LocalPlayer final : public Being, * Constructor. */ explicit LocalPlayer(const BeingId id, - const BeingTypeId subType = BeingTypeId_zero); + const BeingTypeId subType); A_DELETE_COPY(LocalPlayer) @@ -103,15 +103,17 @@ class LocalPlayer final : public Being, int getAttackRange2() const A_WARN_UNUSED; - void attack(Being *const target = nullptr, const bool keep = false, - const bool dontChangeEquipment = false); + void attack(Being *const target, + const bool keep, + const bool dontChangeEquipment); - void attack2(Being *const target = nullptr, const bool keep = false, - const bool dontChangeEquipment = false); + void attack2(Being *const target, + const bool keep, + const bool dontChangeEquipment); void setGroupId(const int id) override final; - void stopAttack(const bool keepAttack = false); + void stopAttack(const bool keepAttack); void untarget(); @@ -154,13 +156,13 @@ class LocalPlayer final : public Being, * Returns whether the target is in range to attack */ bool withinAttackRange(const Being *const target, - const bool fixDistance = false, - const int addRange = 0) const A_WARN_UNUSED; + const bool fixDistance, + const int addRange) const A_WARN_UNUSED; /** * Stops the player dead in his tracks */ - void stopWalking(const bool sendToServer = true); + void stopWalking(const bool sendToServer); bool toggleSit() const; @@ -205,18 +207,19 @@ class LocalPlayer final : public Being, void moveByDirection(const unsigned char dir); - bool pickUpItems(int pickUpType = 0); + bool pickUpItems(int pickUpType); void move(const int dX, const int dY); - void moveToTarget(int dist = -1); + void moveToTarget(int dist); void moveToHome(); bool isReachable(Being *const being, - const int maxCost = 0) A_WARN_UNUSED; + const int maxCost) A_WARN_UNUSED; - bool isReachable(const int x, const int y, + bool isReachable(const int x, + const int y, const bool allowCollision) const A_WARN_UNUSED; void setHome(); @@ -253,12 +256,17 @@ class LocalPlayer final : public Being, const unsigned char dir); void imitateOutfit(const Being *const player, - const int sprite = -1) const; + const int sprite) const; - void followMoveTo(const Being *const being, const int x, const int y); + void followMoveTo(const Being *const being, + const int x, + const int y); - void followMoveTo(const Being *const being, const int x1, const int y1, - const int x2, const int y2); + void followMoveTo(const Being *const being, + const int x1, + const int y1, + const int x2, + const int y2); bool allowAction() A_WARN_UNUSED; @@ -275,8 +283,7 @@ class LocalPlayer final : public Being, void setMap(Map *const map) override final; void addMessageToQueue(const std::string &message, - const UserColorIdT color - = UserColorId::EXP_INFO); + const UserColorIdT color); /** * Called when a option (set with config.addListener()) is changed @@ -385,7 +392,7 @@ class LocalPlayer final : public Being, void updateStatus() const; void setTestParticle(const std::string &fileName, - const bool updateHash = true); + const bool updateHash); int getLastAttackX() const override final { return mTarget != nullptr ? mTarget->mX : mLastAttackX; } diff --git a/src/net/ea/playerrecv.cpp b/src/net/ea/playerrecv.cpp index 2f0e5782f..493e80a5e 100644 --- a/src/net/ea/playerrecv.cpp +++ b/src/net/ea/playerrecv.cpp @@ -73,7 +73,7 @@ void PlayerRecv::processPlayerWarp(Net::MessageIn &msg) * to changeMap, as it deletes all beings. */ if (localPlayer != nullptr) - localPlayer->stopAttack(); + localPlayer->stopAttack(false); Game *const game = Game::instance(); if (game == nullptr) diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index ff67669d4..30c6a932e 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -1598,7 +1598,7 @@ void BeingRecv::processBeingResurrect(Net::MessageIn &msg) // If this is player's current target, clear it. if (dstBeing == localPlayer->getTarget()) - localPlayer->stopAttack(); + localPlayer->stopAttack(false); if (dstBeing == localPlayer && deathNotice != nullptr) { @@ -1844,7 +1844,7 @@ void BeingRecv::processBeingSlide(Net::MessageIn &msg) return; if (localPlayer == dstBeing) { - localPlayer->stopAttack(); + localPlayer->stopAttack(false); localPlayer->navigateClean(); if (viewport != nullptr) viewport->returnCamera(); diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp index b4e1df298..874c5069f 100644 --- a/src/net/tmwa/beingrecv.cpp +++ b/src/net/tmwa/beingrecv.cpp @@ -363,7 +363,7 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg) } dstBeing->setHairColor(hairColor); } - localPlayer->imitateOutfit(dstBeing); + localPlayer->imitateOutfit(dstBeing, -1); uint16_t x, y; msg.readCoordinates(x, y, dir, "position"); @@ -507,7 +507,7 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg) } dstBeing->setHairColor(hairColor); } - localPlayer->imitateOutfit(dstBeing); + localPlayer->imitateOutfit(dstBeing, -1); uint16_t x, y; msg.readCoordinates(x, y, dir, "position"); @@ -651,7 +651,7 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg) } dstBeing->setHairColor(hairColor); } - localPlayer->imitateOutfit(dstBeing); + localPlayer->imitateOutfit(dstBeing, -1); uint16_t srcX, srcY, dstX, dstY; msg.readCoordinatePair(srcX, srcY, dstX, dstY, "moving path"); @@ -1298,7 +1298,7 @@ void BeingRecv::processBeingResurrect(Net::MessageIn &msg) // If this is player's current target, clear it. if (dstBeing == localPlayer->getTarget()) - localPlayer->stopAttack(); + localPlayer->stopAttack(false); if (dstBeing == localPlayer && deathNotice != nullptr) { diff --git a/src/progs/manaplus/actions/actions.cpp b/src/progs/manaplus/actions/actions.cpp index d71ba50a5..67eefc568 100644 --- a/src/progs/manaplus/actions/actions.cpp +++ b/src/progs/manaplus/actions/actions.cpp @@ -672,7 +672,7 @@ impHandler(pickup) const std::string args = event.args; if (args.empty()) { - localPlayer->pickUpItems(); + localPlayer->pickUpItems(0); } else { @@ -837,7 +837,7 @@ impHandler0(stopAttack) { if (localPlayer != nullptr) { - localPlayer->stopAttack(); + localPlayer->stopAttack(false); // not consume if target attack key pressed if (inputManager.isActionActive(InputAction::TARGET_ATTACK)) return false; @@ -885,7 +885,7 @@ impHandler(attack) else localPlayer->setTarget(target); if (target != nullptr) - localPlayer->attack(target, true); + localPlayer->attack(target, true, false); return true; } @@ -925,7 +925,7 @@ impHandler(targetAttack) localPlayer, 90, ActorType::Monster, AllowSort_true); } - localPlayer->attack2(target, newTarget); + localPlayer->attack2(target, newTarget, false); return true; } return false; @@ -940,7 +940,7 @@ impHandler0(attackHuman) if (target != nullptr) { localPlayer->setTarget(target); - localPlayer->attack2(target, true); + localPlayer->attack2(target, true, false); } return true; } @@ -956,7 +956,7 @@ impHandler0(stopSit) { if (localPlayer != nullptr) { - localPlayer->stopAttack(); + localPlayer->stopAttack(false); // not consume if target attack key pressed if (inputManager.isActionActive(InputAction::TARGET_ATTACK)) return false; diff --git a/src/progs/manaplus/actions/commands.cpp b/src/progs/manaplus/actions/commands.cpp index 765d1ceb1..985a17a5f 100644 --- a/src/progs/manaplus/actions/commands.cpp +++ b/src/progs/manaplus/actions/commands.cpp @@ -843,7 +843,7 @@ impHandler(testParticle) { if (localPlayer != nullptr) { - localPlayer->setTestParticle(event.args); + localPlayer->setTestParticle(event.args, true); return true; } return false; diff --git a/src/progs/manaplus/actions/move.cpp b/src/progs/manaplus/actions/move.cpp index d2be4de7e..ea4088f61 100644 --- a/src/progs/manaplus/actions/move.cpp +++ b/src/progs/manaplus/actions/move.cpp @@ -176,7 +176,7 @@ impHandler0(moveToTarget) !inputManager.isActionActive(InputAction::TARGET_ATTACK) && !inputManager.isActionActive(InputAction::ATTACK)) { - localPlayer->moveToTarget(); + localPlayer->moveToTarget(-1); return true; } return false; diff --git a/src/progs/manaplus/gui/viewport.cpp b/src/progs/manaplus/gui/viewport.cpp index de7571c7c..2ae57f170 100644 --- a/src/progs/manaplus/gui/viewport.cpp +++ b/src/progs/manaplus/gui/viewport.cpp @@ -467,7 +467,8 @@ bool Viewport::leftMouseAction() case ActorType::SkillUnit: if (!stopAttack) { - if (localPlayer->withinAttackRange(mHoverBeing) || + if (localPlayer->withinAttackRange(mHoverBeing, + false, 0) || inputManager.isActionActive(InputAction::ATTACK)) { validateSpeed(); @@ -475,7 +476,8 @@ bool Viewport::leftMouseAction() { localPlayer->attack(mHoverBeing, !inputManager.isActionActive( - InputAction::STOP_ATTACK)); + InputAction::STOP_ATTACK), + false); return true; } } @@ -531,7 +533,7 @@ bool Viewport::leftMouseAction() localPlayer->canMove()) { validateSpeed(); - localPlayer->stopAttack(); + localPlayer->stopAttack(false); localPlayer->cancelFollow(); mPlayerFollowMouse = mAllowMoveByMouse; if (mPlayerFollowMouse) |