From a87db81b6b7551a248e31e2850577aefda092538 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 May 2015 20:58:21 +0300 Subject: Replace most bools usage in playerinfo to strong typed bools. --- src/net/ea/playerhandler.cpp | 12 ++++++------ src/net/ea/playerhandler.h | 2 +- src/net/ea/tradehandler.cpp | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/net/ea') diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 121a6284c..0003a0a7e 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -171,7 +171,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg) return; } - playerHandler->setStat(msg, type, value, NoStat, true); + playerHandler->setStat(msg, type, value, NoStat, Notify_true); BLOCK_END("PlayerHandler::processPlayerStatUpdate1") } @@ -180,7 +180,7 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) BLOCK_START("PlayerHandler::processPlayerStatUpdate2") const int type = msg.readInt16("type"); const int value = msg.readInt32("value"); - playerHandler->setStat(msg, type, value, NoStat, true); + playerHandler->setStat(msg, type, value, NoStat, Notify_true); BLOCK_END("PlayerHandler::processPlayerStatUpdate2") } @@ -191,7 +191,7 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) const int base = msg.readInt32("base"); const int bonus = msg.readInt32("bonus"); - playerHandler->setStat(msg, type, base, bonus, false); + playerHandler->setStat(msg, type, base, bonus, Notify_false); BLOCK_END("PlayerHandler::processPlayerStatUpdate3") } @@ -211,7 +211,7 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) NotifyManager::notify(NotifyTypes::SKILL_RAISE_ERROR); } - playerHandler->setStat(msg, type, value, NoStat, true); + playerHandler->setStat(msg, type, value, NoStat, Notify_true); BLOCK_END("PlayerHandler::processPlayerStatUpdate4") } @@ -221,7 +221,7 @@ void PlayerHandler::processPlayerStatUpdate6(Net::MessageIn &msg) const int type = msg.readInt16("type"); const int value = msg.readUInt8("value"); if (statusWindow) - playerHandler->setStat(msg, type, value, NoStat, true); + playerHandler->setStat(msg, type, value, NoStat, Notify_true); BLOCK_END("PlayerHandler::processPlayerStatUpdate6") } @@ -258,7 +258,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, const int type, const int base, const int mod, - const bool notify) const + const Notify notify) const { switch (type) { diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 3e32fbf1a..760f52af7 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -59,7 +59,7 @@ class PlayerHandler notfinal : public Net::PlayerHandler const int type, const int base, const int mod, - const bool notify) const override; + const Notify notify) const override; static const int NoStat = INT_MAX; diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 5bdf42775..9c6f8f387 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -103,7 +103,7 @@ void TradeHandler::processTradeResponseContinue(const uint8_t type) tradeWindow->setVisible(false); // tradeWindow->clear(); } - PlayerInfo::setTrading(false); + PlayerInfo::setTrading(Trading_false); break; case 5: NotifyManager::notify(NotifyTypes::TRADE_CANCELLED_BUSY, @@ -135,7 +135,7 @@ void TradeHandler::processTradeCancel(Net::MessageIn &msg A_UNUSED) tradeWindow->setVisible(false); tradeWindow->reset(); } - PlayerInfo::setTrading(false); + PlayerInfo::setTrading(Trading_false); } void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED) @@ -146,7 +146,7 @@ void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED) tradeWindow->setVisible(false); tradeWindow->reset(); } - PlayerInfo::setTrading(false); + PlayerInfo::setTrading(Trading_false); } void TradeHandler::processTradeRequestContinue(const std::string &partner) @@ -154,14 +154,14 @@ void TradeHandler::processTradeRequestContinue(const std::string &partner) if (player_relations.hasPermission(partner, PlayerRelation::TRADE)) { - if (PlayerInfo::isTrading() || confirmDlg) + if (PlayerInfo::isTrading() == Trading_true || confirmDlg) { tradeHandler->respond(false); return; } tradePartnerName = partner; - PlayerInfo::setTrading(true); + PlayerInfo::setTrading(Trading_true); if (tradeWindow) { if (tradePartnerName.empty() || tradeWindow->getAutoTradeNick() -- cgit v1.2.3-60-g2f50