summaryrefslogtreecommitdiff
path: root/src/net/buysellhandler.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-20 16:14:12 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-08-20 16:14:12 +0000
commit2fe42d32c6d368a66586c605cc1b38ee8d85ed1d (patch)
tree705a76dffde116ddbffb5cba9aa45e4b0700f280 /src/net/buysellhandler.cpp
parent292f3e50a59b06bf129893b352466d7d54fa3d71 (diff)
downloadmana-2fe42d32c6d368a66586c605cc1b38ee8d85ed1d.tar.gz
mana-2fe42d32c6d368a66586c605cc1b38ee8d85ed1d.tar.bz2
mana-2fe42d32c6d368a66586c605cc1b38ee8d85ed1d.tar.xz
mana-2fe42d32c6d368a66586c605cc1b38ee8d85ed1d.zip
Changed MessageHandler::handleMessage to take a reference instead of a pointer.
Removed unused Packet class. Added stub for handling GPMSG_BEING_ENTER.
Diffstat (limited to 'src/net/buysellhandler.cpp')
-rw-r--r--src/net/buysellhandler.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp
index 3b5fc87d..173c59d2 100644
--- a/src/net/buysellhandler.cpp
+++ b/src/net/buysellhandler.cpp
@@ -54,10 +54,10 @@ BuySellHandler::BuySellHandler()
handledMessages = _messages;
}
-void BuySellHandler::handleMessage(MessageIn *msg)
+void BuySellHandler::handleMessage(MessageIn &msg)
{
int n_items;
- switch (msg->getId())
+ switch (msg.getId())
{
case SMSG_NPC_BUY_SELL_CHOICE:
buyDialog->setVisible(false);
@@ -65,38 +65,38 @@ void BuySellHandler::handleMessage(MessageIn *msg)
sellDialog->setVisible(false);
sellDialog->reset();
buySellDialog->setVisible(true);
- current_npc = dynamic_cast<NPC*>(beingManager->findBeing(msg->readLong()));
+ current_npc = dynamic_cast<NPC*>(beingManager->findBeing(msg.readLong()));
break;
case SMSG_NPC_BUY:
- msg->readShort(); // length
- n_items = (msg->getLength() - 4) / 11;
+ msg.readShort(); // length
+ n_items = (msg.getLength() - 4) / 11;
buyDialog->reset();
buyDialog->setMoney(player_node->mMoney);
buyDialog->setVisible(true);
for (int k = 0; k < n_items; k++)
{
- Sint32 value = msg->readLong();
- msg->readLong(); // DCvalue
- msg->readByte(); // type
- Sint16 itemId = msg->readShort();
+ Sint32 value = msg.readLong();
+ msg.readLong(); // DCvalue
+ msg.readByte(); // type
+ Sint16 itemId = msg.readShort();
buyDialog->addItem(itemId, value);
}
break;
case SMSG_NPC_SELL:
- msg->readShort(); // length
- n_items = (msg->getLength() - 4) / 10;
+ msg.readShort(); // length
+ n_items = (msg.getLength() - 4) / 10;
if (n_items > 0) {
sellDialog->reset();
sellDialog->setVisible(true);
for (int k = 0; k < n_items; k++)
{
- Sint16 index = msg->readShort();
- Sint32 value = msg->readLong();
- msg->readLong(); // OCvalue
+ Sint16 index = msg.readShort();
+ Sint32 value = msg.readLong();
+ msg.readLong(); // OCvalue
Item *item = player_node->getInvItem(index);
if (item && !(item->isEquipped())) {
@@ -111,7 +111,7 @@ void BuySellHandler::handleMessage(MessageIn *msg)
break;
case SMSG_NPC_BUY_RESPONSE:
- if (msg->readByte() == 0) {
+ if (msg.readByte() == 0) {
chatWindow->chatLog("Thanks for buying", BY_SERVER);
} else {
chatWindow->chatLog("Unable to buy", BY_SERVER);
@@ -119,7 +119,7 @@ void BuySellHandler::handleMessage(MessageIn *msg)
break;
case SMSG_NPC_SELL_RESPONSE:
- if (msg->readByte() == 0) {
+ if (msg.readByte() == 0) {
chatWindow->chatLog("Thanks for selling", BY_SERVER);
} else {
chatWindow->chatLog("Unable to sell", BY_SERVER);