From ddf3a130e1db0417d2dad77f69d6aa95028024d6 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Dec 2017 01:47:44 +0300 Subject: Remove default parameter from PlayerInfo::setAttribute. --- src/being/playerinfo.h | 2 +- src/gui/widgets/attrs/changedisplay.cpp | 3 +- src/gui/windows/statuswindow.cpp | 9 ++-- src/net/ea/playerrecv.cpp | 4 +- src/net/eathena/inventoryrecv.cpp | 6 ++- src/net/eathena/playerhandler.cpp | 60 ++++++++++++++++++------- src/net/eathena/playerrecv.cpp | 10 +++-- src/net/tmwa/playerhandler.cpp | 77 ++++++++++++++++++++++++--------- src/net/tmwa/playerrecv.cpp | 3 +- 9 files changed, 127 insertions(+), 47 deletions(-) diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h index 5528a1c3d..504b7d1d2 100644 --- a/src/being/playerinfo.h +++ b/src/being/playerinfo.h @@ -103,7 +103,7 @@ namespace PlayerInfo */ void setAttribute(const AttributesT id, const int64_t value, - const Notify notify = Notify_true); + const Notify notify); int getSkillLevel(const int id) A_WARN_UNUSED; diff --git a/src/gui/widgets/attrs/changedisplay.cpp b/src/gui/widgets/attrs/changedisplay.cpp index e1af1eb76..213abc3d5 100644 --- a/src/gui/widgets/attrs/changedisplay.cpp +++ b/src/gui/widgets/attrs/changedisplay.cpp @@ -97,7 +97,8 @@ void ChangeDisplay::action(const ActionEvent &event) const int newpoints = PlayerInfo::getAttribute( Attributes::PLAYER_CHAR_POINTS) - cnt; PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, - newpoints); + newpoints, + Notify_true); const int newbase = PlayerInfo::getStatBase(mId) + cnt; PlayerInfo::setStatBase(mId, newbase); diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index 092e401c2..c144fdc57 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -350,7 +350,8 @@ void StatusWindow::attributeChanged(const AttributesT id, lvl = CAST_S32((expNeed - 20000) / 150); blocked = true; PlayerInfo::setAttribute(Attributes::PLAYER_JOB_LEVEL, - lvl); + lvl, + Notify_true); blocked = false; } } @@ -363,9 +364,11 @@ void StatusWindow::attributeChanged(const AttributesT id, lvl ++; blocked = true; PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP_NEEDED, - 20000 + lvl * 150); + 20000 + lvl * 150, + Notify_true); PlayerInfo::setAttribute(Attributes::PLAYER_JOB_LEVEL, - lvl); + lvl, + Notify_true); blocked = false; } diff --git a/src/net/ea/playerrecv.cpp b/src/net/ea/playerrecv.cpp index edc604907..2f0e5782f 100644 --- a/src/net/ea/playerrecv.cpp +++ b/src/net/ea/playerrecv.cpp @@ -183,7 +183,9 @@ void PlayerRecv::processPlayerStatUpdate4(Net::MessageIn &msg) static_cast(type)); const int points = PlayerInfo::getAttribute( Attributes::PLAYER_CHAR_POINTS) + oldValue - value; - PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, points); + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, + points, + Notify_true); NotifyManager::notify(NotifyTypes::SKILL_RAISE_ERROR); } diff --git a/src/net/eathena/inventoryrecv.cpp b/src/net/eathena/inventoryrecv.cpp index ead74ad63..30ff720eb 100644 --- a/src/net/eathena/inventoryrecv.cpp +++ b/src/net/eathena/inventoryrecv.cpp @@ -912,9 +912,11 @@ void InventoryRecv::processCartInfo(Net::MessageIn &msg) msg.readInt16("cart items used"); const int size = msg.readInt16("max cart items"); PlayerInfo::setAttribute(Attributes::CART_TOTAL_WEIGHT, - msg.readInt32("cart weight")); + msg.readInt32("cart weight"), + Notify_true); PlayerInfo::setAttribute(Attributes::CART_MAX_WEIGHT, - msg.readInt32("max cart weight")); + msg.readInt32("max cart weight"), + Notify_true); if (mCartItems.empty()) return; diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index 1091fd454..e98331a28 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -529,10 +529,14 @@ void PlayerHandler::setStat(Net::MessageIn &msg, PlayerInfo::setStatMod(Attributes::PLAYER_WALK_SPEED, 0); break; case Sp::BASEEXP: - PlayerInfo::setAttribute(Attributes::PLAYER_EXP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_EXP, + base, + Notify_true); break; case Sp::JOBEXP: - PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP, + base, + Notify_true); break; case Sp::KARMA: PlayerInfo::setStatBase(Attributes::PLAYER_KARMA, base); @@ -543,7 +547,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, PlayerInfo::setStatMod(Attributes::PLAYER_MANNER, 0); break; case Sp::HP: - PlayerInfo::setAttribute(Attributes::PLAYER_HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_HP, + base, + Notify_true); if (localPlayer->isInParty() && (Party::getParty(1) != nullptr)) { PartyMember *const m = Party::getParty(1) @@ -557,7 +563,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, } break; case Sp::MAXHP: - PlayerInfo::setAttribute(Attributes::PLAYER_MAX_HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MAX_HP, + base, + Notify_true); if (localPlayer->isInParty() && (Party::getParty(1) != nullptr)) { @@ -571,16 +579,24 @@ void PlayerHandler::setStat(Net::MessageIn &msg, } break; case Sp::SP: - PlayerInfo::setAttribute(Attributes::PLAYER_MP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MP, + base, + Notify_true); break; case Sp::MAXSP: - PlayerInfo::setAttribute(Attributes::PLAYER_MAX_MP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MAX_MP, + base, + Notify_true); break; case Sp::STATUSPOINT: - PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, base); + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, + base, + Notify_true); break; case Sp::BASELEVEL: - PlayerInfo::setAttribute(Attributes::PLAYER_BASE_LEVEL, base); + PlayerInfo::setAttribute(Attributes::PLAYER_BASE_LEVEL, + base, + Notify_true); if (localPlayer != nullptr) { localPlayer->setLevel(base); @@ -588,7 +604,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, } break; case Sp::SKILLPOINT: - PlayerInfo::setAttribute(Attributes::PLAYER_SKILL_POINTS, base); + PlayerInfo::setAttribute(Attributes::PLAYER_SKILL_POINTS, + base, + Notify_true); if (skillDialog != nullptr) skillDialog->update(); break; @@ -625,20 +643,30 @@ void PlayerHandler::setStat(Net::MessageIn &msg, UnitsDb::formatCurrency(oldMoney - newMoney).c_str()); } - PlayerInfo::setAttribute(Attributes::MONEY, newMoney); + PlayerInfo::setAttribute(Attributes::MONEY, + newMoney, + Notify_true); break; } case Sp::NEXTBASEEXP: - PlayerInfo::setAttribute(Attributes::PLAYER_EXP_NEEDED, base); + PlayerInfo::setAttribute(Attributes::PLAYER_EXP_NEEDED, + base, + Notify_true); break; case Sp::NEXTJOBEXP: - PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP_NEEDED, base); + PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP_NEEDED, + base, + Notify_true); break; case Sp::WEIGHT: - PlayerInfo::setAttribute(Attributes::TOTAL_WEIGHT, base); + PlayerInfo::setAttribute(Attributes::TOTAL_WEIGHT, + base, + Notify_true); break; case Sp::MAXWEIGHT: - PlayerInfo::setAttribute(Attributes::MAX_WEIGHT, base); + PlayerInfo::setAttribute(Attributes::MAX_WEIGHT, + base, + Notify_true); break; case Sp::USTR: statusWindow->setPointsNeeded(Attributes::PLAYER_STR, base); @@ -704,7 +732,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, PlayerInfo::updateAttrs(); break; case Sp::JOBLEVEL: - PlayerInfo::setAttribute(Attributes::PLAYER_JOB_LEVEL, base); + PlayerInfo::setAttribute(Attributes::PLAYER_JOB_LEVEL, + base, + Notify_true); break; default: diff --git a/src/net/eathena/playerrecv.cpp b/src/net/eathena/playerrecv.cpp index 436852091..7aad0440a 100644 --- a/src/net/eathena/playerrecv.cpp +++ b/src/net/eathena/playerrecv.cpp @@ -77,7 +77,8 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) { BLOCK_START("PlayerRecv::processPlayerStatUpdate5") PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, - msg.readInt16("char points")); + msg.readInt16("char points"), + Notify_true); unsigned int val = msg.readUInt8("str"); PlayerInfo::setStatBase(Attributes::PLAYER_STR, val); @@ -185,7 +186,8 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) msg.readInt16("crit/10")); PlayerInfo::setAttribute(Attributes::PLAYER_ATTACK_DELAY, - msg.readInt16("attack speed")); + msg.readInt16("attack speed"), + Notify_true); msg.readInt16("plus speed = 0"); BLOCK_END("PlayerRecv::processPlayerStatUpdate5") @@ -282,7 +284,9 @@ void PlayerRecv::processPlayerHeal(Net::MessageIn &msg) { const int base = PlayerInfo::getAttribute(Attributes::PLAYER_HP) + amount; - PlayerInfo::setAttribute(Attributes::PLAYER_HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_HP, + base, + Notify_true); if (localPlayer->isInParty() && (Party::getParty(1) != nullptr)) { PartyMember *const m = Party::getParty(1) diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index ef1b704a8..27cfc4bf4 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -230,21 +230,35 @@ void PlayerHandler::setStat(Net::MessageIn &msg, PlayerInfo::setStatMod(Attributes::PLAYER_WALK_SPEED, 0); break; case Sp::BASEEXP: - PlayerInfo::setAttribute(Attributes::PLAYER_EXP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_EXP, + base, + Notify_true); break; case Sp::JOBEXP: - PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP, + base, + Notify_true); break; case Sp::KARMA: - PlayerInfo::setStatBase(Attributes::PLAYER_KARMA, base); - PlayerInfo::setStatMod(Attributes::PLAYER_KARMA, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_KARMA, + base, + Notify_true); + PlayerInfo::setStatMod(Attributes::PLAYER_KARMA, + 0, + Notify_true); break; case Sp::MANNER: - PlayerInfo::setStatBase(Attributes::PLAYER_MANNER, base); - PlayerInfo::setStatMod(Attributes::PLAYER_MANNER, 0); + PlayerInfo::setStatBase(Attributes::PLAYER_MANNER, + base, + Notify_true); + PlayerInfo::setStatMod(Attributes::PLAYER_MANNER, + 0, + Notify_true); break; case Sp::HP: - PlayerInfo::setAttribute(Attributes::PLAYER_HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_HP, + base, + Notify_true); if (localPlayer->isInParty() && (Party::getParty(1) != nullptr)) { PartyMember *const m = Party::getParty(1) @@ -258,7 +272,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, } break; case Sp::MAXHP: - PlayerInfo::setAttribute(Attributes::PLAYER_MAX_HP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MAX_HP, + base, + Notify_true); if (localPlayer->isInParty() && (Party::getParty(1) != nullptr)) { @@ -272,16 +288,24 @@ void PlayerHandler::setStat(Net::MessageIn &msg, } break; case Sp::SP: - PlayerInfo::setAttribute(Attributes::PLAYER_MP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MP, + base, + Notify_true); break; case Sp::MAXSP: - PlayerInfo::setAttribute(Attributes::PLAYER_MAX_MP, base); + PlayerInfo::setAttribute(Attributes::PLAYER_MAX_MP, + base, + Notify_true); break; case Sp::STATUSPOINT: - PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, base); + PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, + base, + Notify_true); break; case Sp::BASELEVEL: - PlayerInfo::setAttribute(Attributes::PLAYER_BASE_LEVEL, base); + PlayerInfo::setAttribute(Attributes::PLAYER_BASE_LEVEL, + base, + Notify_true); if (localPlayer != nullptr) { localPlayer->setLevel(base); @@ -289,7 +313,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, } break; case Sp::SKILLPOINT: - PlayerInfo::setAttribute(Attributes::PLAYER_SKILL_POINTS, base); + PlayerInfo::setAttribute(Attributes::PLAYER_SKILL_POINTS, + base, + Notify_true); if (skillDialog != nullptr) skillDialog->update(); break; @@ -326,20 +352,30 @@ void PlayerHandler::setStat(Net::MessageIn &msg, UnitsDb::formatCurrency(oldMoney - newMoney).c_str()); } - PlayerInfo::setAttribute(Attributes::MONEY, newMoney); + PlayerInfo::setAttribute(Attributes::MONEY, + newMoney, + Notify_true); break; } case Sp::NEXTBASEEXP: - PlayerInfo::setAttribute(Attributes::PLAYER_EXP_NEEDED, base); + PlayerInfo::setAttribute(Attributes::PLAYER_EXP_NEEDED, + base, + Notify_true); break; case Sp::JOB_MOD: - PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP_NEEDED, base); + PlayerInfo::setAttribute(Attributes::PLAYER_JOB_EXP_NEEDED, + base, + Notify_true); break; case Sp::WEIGHT: - PlayerInfo::setAttribute(Attributes::TOTAL_WEIGHT, base); + PlayerInfo::setAttribute(Attributes::TOTAL_WEIGHT, + base, + Notify_true); break; case Sp::MAXWEIGHT: - PlayerInfo::setAttribute(Attributes::MAX_WEIGHT, base); + PlayerInfo::setAttribute(Attributes::MAX_WEIGHT, + base, + Notify_true); break; case Sp::USTR: statusWindow->setPointsNeeded(Attributes::PLAYER_STR, base); @@ -359,7 +395,6 @@ void PlayerHandler::setStat(Net::MessageIn &msg, case Sp::ULUK: statusWindow->setPointsNeeded(Attributes::PLAYER_LUK, base); break; - case Sp::ATK1: PlayerInfo::setStatBase(Attributes::PLAYER_ATK, base); PlayerInfo::updateAttrs(); @@ -405,7 +440,9 @@ void PlayerHandler::setStat(Net::MessageIn &msg, PlayerInfo::updateAttrs(); break; case Sp::JOBLEVEL: - PlayerInfo::setAttribute(Attributes::PLAYER_JOB_LEVEL, base); + PlayerInfo::setAttribute(Attributes::PLAYER_JOB_LEVEL, + base, + Notify_true); break; case Sp::GM_LEVEL: localPlayer->setGroupId(base); diff --git a/src/net/tmwa/playerrecv.cpp b/src/net/tmwa/playerrecv.cpp index b6b23403f..4bd0f7f88 100644 --- a/src/net/tmwa/playerrecv.cpp +++ b/src/net/tmwa/playerrecv.cpp @@ -38,7 +38,8 @@ void PlayerRecv::processPlayerStatUpdate5(Net::MessageIn &msg) { BLOCK_START("PlayerRecv::processPlayerStatUpdate5") PlayerInfo::setAttribute(Attributes::PLAYER_CHAR_POINTS, - msg.readInt16("char points")); + msg.readInt16("char points"), + Notify_true); unsigned int val = msg.readUInt8("str"); PlayerInfo::setStatBase(Attributes::PLAYER_STR, val); -- cgit v1.2.3-60-g2f50