From 5beba12b38c13c222322af111e17ed1aada62daf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 23 Aug 2015 17:36:35 +0300 Subject: Move receive code from bankhandler into separate file. --- src/net/eathena/bankhandler.cpp | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'src/net/eathena/bankhandler.cpp') 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(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(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(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); -- cgit v1.2.3-70-g09d2