diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-09 11:22:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-09 11:22:55 +0300 |
commit | a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8 (patch) | |
tree | c522855a48126a165ab189dc2adcb0c21de6bcdc /src/net | |
parent | 19ba46eb71edb10615cb02d30bb8163c277a146a (diff) | |
download | plus-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.gz plus-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.bz2 plus-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.xz plus-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.zip |
Add missing buy fail reasons.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index f2252d1fe..14378de4a 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -170,18 +170,34 @@ void BuySellHandler::processNpcSell(Net::MessageIn &msg) const void BuySellHandler::processNpcBuyResponse(Net::MessageIn &msg) const { - if (msg.readUInt8("response") == 0U) + const uint8_t response = msg.readUInt8("response"); + if (response == 0U) { NotifyManager::notify(NotifyTypes::BUY_DONE); + return; } - else + // Reset player money since buy dialog already assumed purchase + // would go fine + if (mBuyDialog) + mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); + switch (response) { - // Reset player money since buy dialog already assumed purchase - // would go fine - if (mBuyDialog) - mBuyDialog->setMoney(PlayerInfo::getAttribute(Attributes::MONEY)); - NotifyManager::notify(NotifyTypes::BUY_FAILED); - } + case 1: + NotifyManager::notify(NotifyTypes::BUY_FAILED_NO_MONEY); + break; + + case 2: + NotifyManager::notify(NotifyTypes::BUY_FAILED_OVERWEIGHT); + break; + + case 3: + NotifyManager::notify(NotifyTypes::BUY_FAILED_TOO_MANY_ITEMS); + break; + + default: + NotifyManager::notify(NotifyTypes::BUY_FAILED); + break; + }; } } // namespace Ea |