diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-17 11:34:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-17 11:34:24 +0300 |
commit | 8cf91f6df71db6a2c7ca114cc3a7c6666f63c4d0 (patch) | |
tree | c55088930bdf1ff0b7fe1f4d6f9219ca6c55e9c9 /src | |
parent | 4eaedf092bc504fae492827b1a89e7bbaac20263 (diff) | |
download | plus-8cf91f6df71db6a2c7ca114cc3a7c6666f63c4d0.tar.gz plus-8cf91f6df71db6a2c7ca114cc3a7c6666f63c4d0.tar.bz2 plus-8cf91f6df71db6a2c7ca114cc3a7c6666f63c4d0.tar.xz plus-8cf91f6df71db6a2c7ca114cc3a7c6666f63c4d0.zip |
Remove getter for playerHandler.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/actions.cpp | 2 | ||||
-rw-r--r-- | src/actions/move.cpp | 16 | ||||
-rw-r--r-- | src/actormanager.cpp | 4 | ||||
-rw-r--r-- | src/being/being.cpp | 11 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 72 | ||||
-rw-r--r-- | src/being/playerinfo.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 14 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 20 | ||||
-rw-r--r-- | src/gui/windows/whoisonline.cpp | 4 | ||||
-rw-r--r-- | src/listeners/playerdeathlistener.h | 4 | ||||
-rw-r--r-- | src/net/net.cpp | 6 | ||||
-rw-r--r-- | src/net/net.h | 2 | ||||
-rw-r--r-- | src/net/playerhandler.h | 2 | ||||
-rw-r--r-- | src/spellmanager.cpp | 2 |
16 files changed, 79 insertions, 91 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 6c8c49ca6..b857f0f10 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -347,7 +347,7 @@ impHandler0(itenplz) { if (actorManager) { - if (Net::getPlayerHandler() && Net::getPlayerHandler()->canUseMagic() + if (playerHandler && playerHandler->canUseMagic() && PlayerInfo::getAttribute(Attributes::MP) >= 3) { actorManager->itenplz(); diff --git a/src/actions/move.cpp b/src/actions/move.cpp index 28b51cfe2..cc4c27b6c 100644 --- a/src/actions/move.cpp +++ b/src/actions/move.cpp @@ -160,8 +160,8 @@ impHandler0(directUp) // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { localPlayer->setDirection(BeingDirection::UP); - if (Net::getPlayerHandler()) - Net::getPlayerHandler()->setDirection(BeingDirection::UP); + if (playerHandler) + playerHandler->setDirection(BeingDirection::UP); } } return true; @@ -178,9 +178,9 @@ impHandler0(directDown) // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { localPlayer->setDirection(BeingDirection::DOWN); - if (Net::getPlayerHandler()) + if (playerHandler) { - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::DOWN); } } @@ -199,9 +199,9 @@ impHandler0(directLeft) // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { localPlayer->setDirection(BeingDirection::LEFT); - if (Net::getPlayerHandler()) + if (playerHandler) { - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::LEFT); } } @@ -220,9 +220,9 @@ impHandler0(directRight) // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { localPlayer->setDirection(BeingDirection::RIGHT); - if (Net::getPlayerHandler()) + if (playerHandler) { - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::RIGHT); } } diff --git a/src/actormanager.cpp b/src/actormanager.cpp index a42e466bc..2b91a30df 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -1180,7 +1180,7 @@ void ActorManager::healTarget() const void ActorManager::heal(const Being *const target) const { if (!localPlayer || !chatWindow || !localPlayer->isAlive() - || !Net::getPlayerHandler()->canUseMagic()) + || !playerHandler->canUseMagic()) { return; } @@ -1259,7 +1259,7 @@ void ActorManager::heal(const Being *const target) const void ActorManager::itenplz() const { if (!localPlayer || !chatWindow || !localPlayer->isAlive() - || !Net::getPlayerHandler()->canUseMagic()) + || !playerHandler->canUseMagic()) { return; } diff --git a/src/being/being.cpp b/src/being/being.cpp index 303e9f8f9..e0aa5f29c 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -164,8 +164,8 @@ Being::Being(const int id, mIsGM(false), mType(type), mSpeechBubble(nullptr), - mWalkSpeed(Net::getPlayerHandler()->getDefaultWalkSpeed()), - mSpeed(Net::getPlayerHandler()->getDefaultWalkSpeed().x), + mWalkSpeed(playerHandler->getDefaultWalkSpeed()), + mSpeed(playerHandler->getDefaultWalkSpeed().x), mIp(), mSpriteRemap(new int[20]), mSpriteHide(new int[20]), @@ -325,14 +325,9 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) mYDiff = mInfo->getSortOffsetY(); const int speed = mInfo->getWalkSpeed(); if (!speed) - { - setWalkSpeed(Net::getPlayerHandler() - ->getDefaultWalkSpeed()); - } + setWalkSpeed(playerHandler->getDefaultWalkSpeed()); else - { setWalkSpeed(Vector(speed, speed, 0)); - } } } else if (mType == ActorType::Player) diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index a97d56128..23a8063ca 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -561,7 +561,7 @@ void LocalPlayer::setDestination(const int x, const int y) { if (settings.moveType != 1) { - Net::getPlayerHandler()->setDestination(x, y, mDirection); + playerHandler->setDestination(x, y, mDirection); Being::setDestination(x, y); } else @@ -576,16 +576,16 @@ void LocalPlayer::setDestination(const int x, const int y) if (mDirection & BeingDirection::RIGHT) newDir |= BeingDirection::LEFT; - Net::getPlayerHandler()->setDestination(x, y, newDir); + playerHandler->setDestination(x, y, newDir); // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { setDirection(newDir); - Net::getPlayerHandler()->setDirection(newDir); + playerHandler->setDirection(newDir); } Being::setDestination(x, y); - Net::getPlayerHandler()->setDestination(x, y, mDirection); + playerHandler->setDestination(x, y, mDirection); } } } @@ -647,7 +647,7 @@ void LocalPlayer::startWalking(const unsigned char dir) // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { - Net::getPlayerHandler()->setDirection(dir); + playerHandler->setDirection(dir); setDirection(dir); } } @@ -664,7 +664,7 @@ void LocalPlayer::stopWalking(const bool sendToServer) static_cast<int>(getPosition().y)); if (sendToServer) { - Net::getPlayerHandler()->setDestination( + playerHandler->setDestination( static_cast<int>(getPosition().x), static_cast<int>(getPosition().y), -1); } @@ -701,7 +701,7 @@ bool LocalPlayer::toggleSit() const return true; } - Net::getPlayerHandler()->changeAction(newAction); + playerHandler->changeAction(newAction); return true; } @@ -710,7 +710,7 @@ bool LocalPlayer::updateSit() const if (!PacketLimiter::limitPackets(PACKET_SIT)) return false; - Net::getPlayerHandler()->changeAction(mAction); + playerHandler->changeAction(mAction); return true; } @@ -719,7 +719,7 @@ bool LocalPlayer::emote(const uint8_t emotion) if (!PacketLimiter::limitPackets(PACKET_EMOTE)) return false; - Net::getPlayerHandler()->emote(emotion); + playerHandler->emote(emotion); return true; } @@ -769,7 +769,7 @@ void LocalPlayer::attack(Being *const target, const bool keep, if (!dontChangeEquipment) changeEquipmentBeforeAttack(target); - Net::getPlayerHandler()->attack(target->getId(), mServerAttack); + playerHandler->attack(target->getId(), mServerAttack); } if (!keep) @@ -782,7 +782,7 @@ void LocalPlayer::stopAttack(const bool keepAttack) return; if (mServerAttack && mAction == BeingAction::ATTACK) - Net::getPlayerHandler()->stopAttack(); + playerHandler->stopAttack(); untarget(); if (!keepAttack || !mAttackNext) @@ -1035,7 +1035,7 @@ void LocalPlayer::statChanged(const int id, const int oldVal1, const int oldVal2) { - if (!mShowJobExp || id != Net::getPlayerHandler()->getJobLocation()) + if (!mShowJobExp || id != playerHandler->getJobLocation()) return; const std::pair<int, int> exp = PlayerInfo::getStatExperience(id); @@ -1206,7 +1206,7 @@ void LocalPlayer::moveToHome() const Vector pos = mHomes[(*iter).first]; if (mX == pos.x && mY == pos.y) { - Net::getPlayerHandler()->setDestination( + playerHandler->setDestination( static_cast<int>(pos.x), static_cast<int>(pos.y), static_cast<int>(mDirection)); @@ -1353,25 +1353,25 @@ void LocalPlayer::crazyMove1() { setWalkingDir(BeingDirection::UP); setDirection(BeingDirection::LEFT); - Net::getPlayerHandler()->setDirection(BeingDirection::LEFT); + playerHandler->setDirection(BeingDirection::LEFT); } else if (mDirection == BeingDirection::LEFT) { setWalkingDir(BeingDirection::LEFT); setDirection(BeingDirection::DOWN); - Net::getPlayerHandler()->setDirection(BeingDirection::DOWN); + playerHandler->setDirection(BeingDirection::DOWN); } else if (mDirection == BeingDirection::DOWN) { setWalkingDir(BeingDirection::DOWN); setDirection(BeingDirection::RIGHT); - Net::getPlayerHandler()->setDirection(BeingDirection::RIGHT); + playerHandler->setDirection(BeingDirection::RIGHT); } else if (mDirection == BeingDirection::RIGHT) { setWalkingDir(BeingDirection::RIGHT); setDirection(BeingDirection::UP); - Net::getPlayerHandler()->setDirection(BeingDirection::UP); + playerHandler->setDirection(BeingDirection::UP); } } @@ -1387,28 +1387,28 @@ void LocalPlayer::crazyMove2() { setWalkingDir(BeingDirection::UP | BeingDirection::LEFT); setDirection(BeingDirection::RIGHT); - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::DOWN | BeingDirection::RIGHT); } else if (mDirection == BeingDirection::RIGHT) { setWalkingDir(BeingDirection::UP | BeingDirection::RIGHT); setDirection(BeingDirection::DOWN); - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::DOWN | BeingDirection::LEFT); } else if (mDirection == BeingDirection::DOWN) { setWalkingDir(BeingDirection::DOWN | BeingDirection::RIGHT); setDirection(BeingDirection::LEFT); - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::UP | BeingDirection::LEFT); } else if (mDirection == BeingDirection::LEFT) { setWalkingDir(BeingDirection::DOWN | BeingDirection::LEFT); setDirection(BeingDirection::UP); - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::UP | BeingDirection::RIGHT); } } @@ -1444,7 +1444,7 @@ void LocalPlayer::crazyMove3() // return; setDirection(BeingDirection::DOWN); - Net::getPlayerHandler()->setDirection(BeingDirection::DOWN); + playerHandler->setDirection(BeingDirection::DOWN); } void LocalPlayer::crazyMove4() @@ -1670,7 +1670,7 @@ void LocalPlayer::crazyMove9() mCrazyMoveState = 2; if (!allowAction()) return; - Net::getPlayerHandler()->changeAction(BeingAction::SIT); + playerHandler->changeAction(BeingAction::SIT); break; case 2: mCrazyMoveState = 3; @@ -1786,7 +1786,7 @@ void LocalPlayer::crazyMoveA() // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { setDirection(BeingDirection::DOWN); - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::DOWN); } break; @@ -1794,7 +1794,7 @@ void LocalPlayer::crazyMoveA() // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { setDirection(BeingDirection::UP); - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::UP); } break; @@ -1802,7 +1802,7 @@ void LocalPlayer::crazyMoveA() // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { setDirection(BeingDirection::LEFT); - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::LEFT); } break; @@ -1810,7 +1810,7 @@ void LocalPlayer::crazyMoveA() // if (PacketLimiter::limitPackets(PACKET_DIRECTION)) { setDirection(BeingDirection::RIGHT); - Net::getPlayerHandler()->setDirection( + playerHandler->setDirection( BeingDirection::RIGHT); } break; @@ -1836,7 +1836,7 @@ void LocalPlayer::crazyMoveA() break; } setDirection(dir); - Net::getPlayerHandler()->setDirection(dir); + playerHandler->setDirection(dir); } break; case 'R': @@ -1861,7 +1861,7 @@ void LocalPlayer::crazyMoveA() break; } setDirection(dir); - Net::getPlayerHandler()->setDirection(dir); + playerHandler->setDirection(dir); } break; case 'b': @@ -1886,7 +1886,7 @@ void LocalPlayer::crazyMoveA() break; } setDirection(dir); - Net::getPlayerHandler()->setDirection(dir); + playerHandler->setDirection(dir); } break; case '0': @@ -2191,7 +2191,7 @@ void LocalPlayer::specialMove(const unsigned char direction) void LocalPlayer::magicAttack() const { if (!chatWindow || !isAlive() - || !Net::getPlayerHandler()->canUseMagic()) + || !playerHandler->canUseMagic()) { return; } @@ -2690,7 +2690,7 @@ void LocalPlayer::targetMoved() const if (!PacketLimiter::limitPackets(PACKET_ATTACK)) return; logger->log("LocalPlayer::targetMoved"); - Net::getPlayerHandler()->attack(mTarget->getId(), mServerAttack); + playerHandler->attack(mTarget->getId(), mServerAttack); } } */ @@ -2851,7 +2851,7 @@ void LocalPlayer::imitateAction(const Being *const being, if (!mPlayerImitated.empty() && being->getName() == mPlayerImitated) { setAction(action); - Net::getPlayerHandler()->changeAction(action); + playerHandler->changeAction(action); } } @@ -2879,12 +2879,12 @@ void LocalPlayer::imitateDirection(const Being *const being, dir2 |= BeingDirection::UP; setDirection(dir2); - Net::getPlayerHandler()->setDirection(dir2); + playerHandler->setDirection(dir2); } else { setDirection(dir); - Net::getPlayerHandler()->setDirection(dir); + playerHandler->setDirection(dir); } } } @@ -3238,7 +3238,7 @@ void LocalPlayer::updateStatus() const if (mInactive) status |= BeingFlag::INACTIVE; - Net::getPlayerHandler()->updateStatus(status); + playerHandler->updateStatus(status); } } diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index 3768b6e35..6ab9015e6 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -326,7 +326,7 @@ void pickUpItem(const FloorItem *const item, const bool sfx) { if (sfx) ItemSoundManager::playSfx(item, ItemSoundEvent::PICKUP); - Net::getPlayerHandler()->pickUp(item); + playerHandler->pickUp(item); } // --- Misc ------------------------------------------------------------------- @@ -362,7 +362,7 @@ void setTrading(const bool trading) void updateAttrs() { - const Net::PlayerHandler *const handler = Net::getPlayerHandler(); + const Net::PlayerHandler *const handler = playerHandler; if (!handler) return; const int attr = handler->getAttackLocation(); diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 318c89332..bf839e058 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -921,7 +921,7 @@ void ChatWindow::statChanged(const int id, if (!mShowBattleEvents || !config.getBoolValue("showJobExp")) return; - if (id != Net::getPlayerHandler()->getJobLocation()) + if (id != playerHandler->getJobLocation()) return; const std::pair<int, int> exp = PlayerInfo::getStatExperience(id); diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index ba4aaf8c7..a02ea3f1e 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -71,13 +71,13 @@ MiniStatusWindow::MiniStatusWindow() : "hpprogressbar.xml", "hpprogressbar_fill.xml", "hp bar", _("health bar"))), mMpBar(gameHandler->canUseMagicBar() - ? createBar(0, 100, 0, Net::getPlayerHandler()->canUseMagic() + ? createBar(0, 100, 0, playerHandler->canUseMagic() ? Theme::MP_BAR : Theme::NO_MP_BAR, - Net::getPlayerHandler()->canUseMagic() + playerHandler->canUseMagic() ? Theme::PROG_MP : Theme::PROG_NO_MP, - Net::getPlayerHandler()->canUseMagic() + playerHandler->canUseMagic() ? "mpprogressbar.xml" : "nompprogressbar.xml", - Net::getPlayerHandler()->canUseMagic() + playerHandler->canUseMagic() ? "mpprogressbar_fill.xml" : "nompprogressbar_fill.xml", // TRANSLATORS: status bar name "mp bar", _("mana bar")) : nullptr), @@ -122,7 +122,7 @@ MiniStatusWindow::MiniStatusWindow() : if (gameHandler->canUseMagicBar() && statusWindow) statusWindow->updateMPBar(mMpBar); - const int job = Net::getPlayerHandler()->getJobLocation() + const int job = playerHandler->getJobLocation() && serverConfig.getValueBool("showJob", true); StatusWindow::updateXPBar(mXpBar); @@ -383,12 +383,12 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event) else if (event.getSource() == mJobBar) { const std::pair<int, int> exp = PlayerInfo::getStatExperience( - Net::getPlayerHandler()->getJobLocation()); + playerHandler->getJobLocation()); // TRANSLATORS: job bar label const std::string level = strprintf(_("Job level: %d"), PlayerInfo::getStatBase( - Net::getPlayerHandler()->getJobLocation())); + playerHandler->getJobLocation())); if (exp.first > exp.second) { diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 782dfee70..759efe7cf 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -111,10 +111,7 @@ void SkillDialog::action(const ActionEvent &event) if (tab) { if (const SkillInfo *const info = tab->getSelectedInfo()) - { - Net::getPlayerHandler()->increaseSkill( - static_cast<uint16_t>(info->id)); - } + playerHandler->increaseSkill(static_cast<uint16_t>(info->id)); } } else if (eventId == "sel") diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 08480cdd4..072e915ee 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -129,7 +129,7 @@ StatusWindow::StatusWindow() : getThemeColor(Theme::XP_BAR_OUTLINE)); const bool magicBar = gameHandler->canUseMagicBar(); - const int job = Net::getPlayerHandler()->getJobLocation() + const int job = playerHandler->getJobLocation() && serverConfig.getValueBool("showJob", true); if (magicBar) @@ -137,7 +137,7 @@ StatusWindow::StatusWindow() : max = PlayerInfo::getAttribute(Attributes::MAX_MP); // TRANSLATORS: status window label mMpLabel = new Label(this, _("MP:")); - const bool useMagic = Net::getPlayerHandler()->canUseMagic(); + const bool useMagic = playerHandler->canUseMagic(); mMpBar = new ProgressBar(this, max ? static_cast<float>( PlayerInfo::getAttribute(Attributes::MAX_MP)) / static_cast<float>(max) : static_cast<float>(0), @@ -217,7 +217,7 @@ StatusWindow::StatusWindow() : place(0, 6, mCharacterPointsLabel, 5); place(0, 5, mCopyButton); - if (Net::getPlayerHandler()->canCorrectAttributes()) + if (playerHandler->canCorrectAttributes()) { mCorrectionPointsLabel = new Label(this, "C"); place(0, 7, mCorrectionPointsLabel, 5); @@ -265,7 +265,7 @@ void StatusWindow::statChanged(const int id, if (blocked) return; - if (id == Net::getPlayerHandler()->getJobLocation()) + if (id == playerHandler->getJobLocation()) { if (mJobLvlLabel) { @@ -462,7 +462,7 @@ void StatusWindow::updateMPBar(ProgressBar *const bar, if (maxMp > 0) prog = static_cast<float>(mp) / static_cast<float>(maxMp); - if (Net::getPlayerHandler()->canUseMagic()) + if (playerHandler->canUseMagic()) { bar->setColor(getThemeColor(Theme::MP_BAR), getThemeColor(Theme::MP_BAR_OUTLINE)); @@ -523,7 +523,7 @@ void StatusWindow::updateJobBar(ProgressBar *const bar, const bool percent) return; const std::pair<int, int> exp = PlayerInfo::getStatExperience( - Net::getPlayerHandler()->getJobLocation()); + playerHandler->getJobLocation()); updateProgressBar(bar, exp.first, exp.second, percent); } @@ -754,7 +754,7 @@ ChangeDisplay::ChangeDisplay(const Widget2 *const widget, place(6, 0, mInc); place(7, 0, mPoints); - if (Net::getPlayerHandler()->canCorrectAttributes()) + if (playerHandler->canCorrectAttributes()) { // TRANSLATORS: status window label (minus sign) mDec = new Button(this, _("-"), "dec", this); @@ -793,7 +793,7 @@ void ChangeDisplay::setPointsNeeded(const int needed) void ChangeDisplay::action(const ActionEvent &event) { - if (Net::getPlayerHandler()->canCorrectAttributes() && + if (playerHandler->canCorrectAttributes() && event.getSource() == mDec) { const int newcorrpoints = PlayerInfo::getAttribute( @@ -807,7 +807,7 @@ void ChangeDisplay::action(const ActionEvent &event) const int newbase = PlayerInfo::getStatBase(mId) - 1; PlayerInfo::setStatBase(mId, newbase); - Net::getPlayerHandler()->decreaseAttribute(mId); + playerHandler->decreaseAttribute(mId); } else if (event.getSource() == mInc) { @@ -828,7 +828,7 @@ void ChangeDisplay::action(const ActionEvent &event) for (unsigned f = 0; f < mInc->getClickCount(); f ++) { - Net::getPlayerHandler()->increaseAttribute(mId); + playerHandler->increaseAttribute(mId); if (cnt != 1) SDL_Delay(100); } diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index eb44a0081..a4ea81bfa 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -601,7 +601,7 @@ void WhoIsOnline::download() else { if (PacketLimiter::limitPackets(PACKET_ONLINELIST)) - Net::getPlayerHandler()->requestOnlineList(); + playerHandler->requestOnlineList(); } } @@ -701,7 +701,7 @@ void WhoIsOnline::action(const ActionEvent &event) if (PacketLimiter::limitPackets(PACKET_ONLINELIST)) { mUpdateTimer = cur_time; - Net::getPlayerHandler()->requestOnlineList(); + playerHandler->requestOnlineList(); } } } diff --git a/src/listeners/playerdeathlistener.h b/src/listeners/playerdeathlistener.h index 67eb031a0..9f7974ae2 100644 --- a/src/listeners/playerdeathlistener.h +++ b/src/listeners/playerdeathlistener.h @@ -45,8 +45,8 @@ struct PlayerDeathListener final : public ActionListener { void action(const ActionEvent &event A_UNUSED) { - if (Net::getPlayerHandler()) - Net::getPlayerHandler()->respawn(); + if (playerHandler) + playerHandler->respawn(); deathNotice = nullptr; DialogsManager::closeDialogs(); diff --git a/src/net/net.cpp b/src/net/net.cpp index aee04a8e4..f11e4c3b6 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -56,6 +56,7 @@ namespace Net class NpcHandler; class PartyHandler; class PetHandler; + class PlayerHandler; } Net::AdminHandler *adminHandler = nullptr; @@ -81,11 +82,6 @@ Net::CashShopHandler *cashShopHandler = nullptr; Net::FamilyHandler *familyHandler = nullptr; Net::BankHandler *bankHandler = nullptr; -Net::PlayerHandler *Net::getPlayerHandler() -{ - return playerHandler; -} - Net::SkillHandler *Net::getSkillHandler() { return skillHandler; diff --git a/src/net/net.h b/src/net/net.h index f0611114f..7ddfd4364 100644 --- a/src/net/net.h +++ b/src/net/net.h @@ -36,12 +36,10 @@ namespace Net { -class PlayerHandler; class SkillHandler; class TradeHandler; class ServerFeatures; -PlayerHandler *getPlayerHandler() A_WARN_UNUSED; SkillHandler *getSkillHandler() A_WARN_UNUSED; TradeHandler *getTradeHandler() A_WARN_UNUSED; ServerFeatures *getServerFeatures() A_WARN_UNUSED; diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index 7f02ab625..fa4df6da3 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.h @@ -103,4 +103,6 @@ class PlayerHandler notfinal } // namespace Net +extern Net::PlayerHandler *playerHandler; + #endif // NET_PLAYERHANDLER_H diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index e5d8166ce..b569ba7eb 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -142,7 +142,7 @@ void SpellManager::invoke(const int spellId) const return; if (spell->getCommandType() == TEXT_COMMAND_TEXT - || (Net::getPlayerHandler()->canUseMagic() + || (playerHandler->canUseMagic() && PlayerInfo::getSkillLevel(SKILL_MAGIC) >= static_cast<signed>(spell->getBaseLvl()) && PlayerInfo::getSkillLevel(static_cast<int>( |