summaryrefslogtreecommitdiff
path: root/src/net/ea/buysellhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-09 11:22:55 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-09 11:22:55 +0300
commita2ffd7da11831cc063f25ed6bb9f6be50c3b20e8 (patch)
treec522855a48126a165ab189dc2adcb0c21de6bcdc /src/net/ea/buysellhandler.cpp
parent19ba46eb71edb10615cb02d30bb8163c277a146a (diff)
downloadplus-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.gz
plus-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.bz2
plus-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.tar.xz
plus-a2ffd7da11831cc063f25ed6bb9f6be50c3b20e8.zip
Add missing buy fail reasons.
Diffstat (limited to 'src/net/ea/buysellhandler.cpp')
-rw-r--r--src/net/ea/buysellhandler.cpp32
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