summaryrefslogtreecommitdiff
path: root/src/net/eathena/bankhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-23 17:36:35 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-23 17:36:35 +0300
commit5beba12b38c13c222322af111e17ed1aada62daf (patch)
treea0261be40596bc0babdb553d95601f23a35ed421 /src/net/eathena/bankhandler.cpp
parent6690099a0156a2c842e77bf8bd7a306ee917a74a (diff)
downloadmanaplus-5beba12b38c13c222322af111e17ed1aada62daf.tar.gz
manaplus-5beba12b38c13c222322af111e17ed1aada62daf.tar.bz2
manaplus-5beba12b38c13c222322af111e17ed1aada62daf.tar.xz
manaplus-5beba12b38c13c222322af111e17ed1aada62daf.zip
Move receive code from bankhandler into separate file.
Diffstat (limited to 'src/net/eathena/bankhandler.cpp')
-rw-r--r--src/net/eathena/bankhandler.cpp34
1 files changed, 4 insertions, 30 deletions
diff --git a/src/net/eathena/bankhandler.cpp b/src/net/eathena/bankhandler.cpp
index e4dff0710..1897b7a9a 100644
--- a/src/net/eathena/bankhandler.cpp
+++ b/src/net/eathena/bankhandler.cpp
@@ -26,6 +26,7 @@
#include "listeners/banklistener.h"
+#include "net/eathena/bank.h"
#include "net/eathena/messageout.h"
#include "net/eathena/protocol.h"
@@ -55,15 +56,15 @@ void BankHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_BANK_STATUS:
- processBankStatus(msg);
+ Bank::processBankStatus(msg);
break;
case SMSG_BANK_DEPOSIT:
- processBankDeposit(msg);
+ Bank::processBankDeposit(msg);
break;
case SMSG_BANK_WITHDRAW:
- processBankWithdraw(msg);
+ Bank::processBankWithdraw(msg);
break;
default:
@@ -91,33 +92,6 @@ void BankHandler::check() const
outMsg.writeInt32(0, "account id");
}
-void BankHandler::processBankStatus(Net::MessageIn &msg)
-{
- const int money = static_cast<int>(msg.readInt64("money"));
- msg.readInt16("reason");
- BankListener::distributeEvent(money);
-}
-
-void BankHandler::processBankDeposit(Net::MessageIn &msg)
-{
- const int reason = msg.readInt16("reason");
- const int money = static_cast<int>(msg.readInt64("money"));
- msg.readInt32("balance");
- BankListener::distributeEvent(money);
- if (reason)
- NotifyManager::notify(NotifyTypes::BANK_DEPOSIT_FAILED);
-}
-
-void BankHandler::processBankWithdraw(Net::MessageIn &msg)
-{
- const int reason = msg.readInt16("reason");
- const int money = static_cast<int>(msg.readInt64("money"));
- msg.readInt32("balance");
- BankListener::distributeEvent(money);
- if (reason)
- NotifyManager::notify(NotifyTypes::BANK_WITHDRAW_FAILED);
-}
-
void BankHandler::open() const
{
createOutPacket(CMSG_BANK_OPEN);