From b643a5c48d53dbeca7672e3c8b5182f9d698abcb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 3 Jun 2015 14:31:43 +0300 Subject: Convert PacketShare enum into strong typed enum. --- src/net/ea/partyhandler.cpp | 48 ++++++++++++++++++++++----------------------- src/net/ea/partyhandler.h | 14 ++++++------- 2 files changed, 30 insertions(+), 32 deletions(-) (limited to 'src/net/ea') diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index 1af9ba7ef..6b0be87e9 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -45,14 +45,14 @@ namespace Ea { Party *taParty = nullptr; -Net::PartyShare::Type PartyHandler::mShareExp = Net::PartyShare::UNKNOWN; -Net::PartyShare::Type PartyHandler::mShareItems = Net::PartyShare::UNKNOWN; +PartyShareT PartyHandler::mShareExp = PartyShare::UNKNOWN; +PartyShareT PartyHandler::mShareItems = PartyShare::UNKNOWN; PartyHandler::PartyHandler() : Net::PartyHandler() { - mShareExp = Net::PartyShare::UNKNOWN; - mShareItems = Net::PartyShare::UNKNOWN; + mShareExp = PartyShare::UNKNOWN; + mShareItems = PartyShare::UNKNOWN; taParty = Party::getParty(1); } @@ -84,27 +84,27 @@ void PartyHandler::processPartyCreate(Net::MessageIn &msg) } void PartyHandler::processPartySettingsContinue(Net::MessageIn &msg, - const int16_t exp, - const int16_t item) + const PartyShareT exp, + const PartyShareT item) { switch (exp) { - case Net::PartyShare::YES: - if (mShareExp == Net::PartyShare::YES) + case PartyShare::YES: + if (mShareExp == PartyShare::YES) break; - mShareExp = Net::PartyShare::YES; + mShareExp = PartyShare::YES; NotifyManager::notify(NotifyTypes::PARTY_EXP_SHARE_ON); break; - case Net::PartyShare::NO: - if (mShareExp == Net::PartyShare::NO) + case PartyShare::NO: + if (mShareExp == PartyShare::NO) break; - mShareExp = Net::PartyShare::NO; + mShareExp = PartyShare::NO; NotifyManager::notify(NotifyTypes::PARTY_EXP_SHARE_OFF); break; - case Net::PartyShare::NOT_POSSIBLE: - if (mShareExp == Net::PartyShare::NOT_POSSIBLE) + case PartyShare::NOT_POSSIBLE: + if (mShareExp == PartyShare::NOT_POSSIBLE) break; - mShareExp = Net::PartyShare::NOT_POSSIBLE; + mShareExp = PartyShare::NOT_POSSIBLE; NotifyManager::notify(NotifyTypes::PARTY_EXP_SHARE_ERROR); break; default: @@ -114,22 +114,22 @@ void PartyHandler::processPartySettingsContinue(Net::MessageIn &msg, switch (item) { - case Net::PartyShare::YES: - if (mShareItems == Net::PartyShare::YES) + case PartyShare::YES: + if (mShareItems == PartyShare::YES) break; - mShareItems = Net::PartyShare::YES; + mShareItems = PartyShare::YES; NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_ON); break; - case Net::PartyShare::NO: - if (mShareItems == Net::PartyShare::NO) + case PartyShare::NO: + if (mShareItems == PartyShare::NO) break; - mShareItems = Net::PartyShare::NO; + mShareItems = PartyShare::NO; NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_OFF); break; - case Net::PartyShare::NOT_POSSIBLE: - if (mShareItems == Net::PartyShare::NOT_POSSIBLE) + case PartyShare::NOT_POSSIBLE: + if (mShareItems == PartyShare::NOT_POSSIBLE) break; - mShareItems = Net::PartyShare::NOT_POSSIBLE; + mShareItems = PartyShare::NOT_POSSIBLE; NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_ERROR); break; default: diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h index 12dec8c6c..453aced1d 100644 --- a/src/net/ea/partyhandler.h +++ b/src/net/ea/partyhandler.h @@ -44,12 +44,10 @@ class PartyHandler notfinal : public Net::PartyHandler void join(const int partyId) const override final; - Net::PartyShare::Type getShareExperience() - const override final A_WARN_UNUSED + PartyShareT getShareExperience() const override final A_WARN_UNUSED { return mShareExp; } - Net::PartyShare::Type getShareItems() - const override final A_WARN_UNUSED + PartyShareT getShareItems() const override final A_WARN_UNUSED { return mShareItems; } static void reload(); @@ -68,11 +66,11 @@ class PartyHandler notfinal : public Net::PartyHandler static void processPartyUpdateCoords(Net::MessageIn &msg); static void processPartySettingsContinue(Net::MessageIn &msg, - const int16_t exp, - const int16_t item); + const PartyShareT exp, + const PartyShareT item); - static Net::PartyShare::Type mShareExp; - static Net::PartyShare::Type mShareItems; + static PartyShareT mShareExp; + static PartyShareT mShareItems; }; extern Party *taParty; -- cgit v1.2.3-60-g2f50