diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-20 16:14:12 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-20 16:14:12 +0000 |
commit | 2fe42d32c6d368a66586c605cc1b38ee8d85ed1d (patch) | |
tree | 705a76dffde116ddbffb5cba9aa45e4b0700f280 /src/net/chathandler.cpp | |
parent | 292f3e50a59b06bf129893b352466d7d54fa3d71 (diff) | |
download | mana-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/chathandler.cpp')
-rw-r--r-- | src/net/chathandler.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp index d6f822f8..795b2a27 100644 --- a/src/net/chathandler.cpp +++ b/src/net/chathandler.cpp @@ -52,25 +52,25 @@ ChatHandler::ChatHandler() handledMessages = _messages; } -void ChatHandler::handleMessage(MessageIn *msg) +void ChatHandler::handleMessage(MessageIn &msg) { Being *being; std::string chatMsg; Sint16 chatMsgLength; - switch (msg->getId()) + switch (msg.getId()) { // Received speech from being case SMSG_BEING_CHAT: - chatMsgLength = msg->readShort() - 8; - being = beingManager->findBeing(msg->readLong()); + chatMsgLength = msg.readShort() - 8; + being = beingManager->findBeing(msg.readLong()); if (!being || chatMsgLength <= 0) { break; } - chatMsg = msg->readString(chatMsgLength); + chatMsg = msg.readString(chatMsgLength); chatWindow->chatLog(chatMsg, BY_OTHER); chatMsg.erase(0, chatMsg.find(" : ", 0) + 3); being->setSpeech(chatMsg, SPEECH_TIME); @@ -78,16 +78,16 @@ void ChatHandler::handleMessage(MessageIn *msg) case SMSG_PLAYER_CHAT: case SMSG_GM_CHAT: - chatMsgLength = msg->readShort() - 4; + chatMsgLength = msg.readShort() - 4; if (chatMsgLength <= 0) { break; } - chatMsg = msg->readString(chatMsgLength); + chatMsg = msg.readString(chatMsgLength); - if (msg->getId() == SMSG_PLAYER_CHAT) + if (msg.getId() == SMSG_PLAYER_CHAT) { chatWindow->chatLog(chatMsg, BY_PLAYER); @@ -105,13 +105,13 @@ void ChatHandler::handleMessage(MessageIn *msg) break; case SMSG_WHO_ANSWER: - chatWindow->chatLog("Online users: " + toString(msg->readLong()), + chatWindow->chatLog("Online users: " + toString(msg.readLong()), BY_SERVER); break; case 0x010c: // Display MVP player - msg->readLong(); // id + msg.readLong(); // id chatWindow->chatLog("MVP player", BY_SERVER); break; } |