diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-20 13:41:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-22 00:08:12 +0300 |
commit | 5a8b8f4ad56914e1c75acd29807897ba1433c96f (patch) | |
tree | 4e29e8fee3e794ba4b69e383d3f0e12e6e8d62e0 /src/net/ea | |
parent | 54ee7d240a8ab3a328d0f3f06f3b9627d4727c90 (diff) | |
download | manaplus-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.gz manaplus-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.bz2 manaplus-5a8b8f4ad56914e1c75acd29807897ba1433c96f.tar.xz manaplus-5a8b8f4ad56914e1c75acd29807897ba1433c96f.zip |
add netcode support for channels (for now evol only).
for now any channel ignored and used as general tab.
also change netcode version to 8.
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/adminhandler.cpp | 3 | ||||
-rw-r--r-- | src/net/ea/chathandler.cpp | 29 | ||||
-rw-r--r-- | src/net/ea/chathandler.h | 6 |
3 files changed, 29 insertions, 9 deletions
diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp index f6450a225..ca3fd034d 100644 --- a/src/net/ea/adminhandler.cpp +++ b/src/net/ea/adminhandler.cpp @@ -31,7 +31,8 @@ namespace Ea { -const std::string GENERAL_CHANNEL = "\000\000\000"; +//const std::string GENERAL_CHANNEL = "\000\000\000"; +const std::string GENERAL_CHANNEL = ""; void AdminHandler::kickName(const std::string &name) { diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 7be94ca3e..3a2c6ec2e 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -258,15 +258,25 @@ void ChatHandler::processWhisper(Net::MessageIn &msg) } } -void ChatHandler::processBeingChat(Net::MessageIn &msg) +void ChatHandler::processBeingChat(Net::MessageIn &msg, const bool channels) { if (!actorSpriteManager) return; - const int chatMsgLength = msg.readInt16() - 8; + int chatMsgLength = msg.readInt16() - 8; Being *const being = actorSpriteManager->findBeing(msg.readInt32()); + if (!being) + return; + + if (channels) + { + chatMsgLength -= 3; + msg.readInt8(); // channel + msg.readInt8(); // channel + msg.readInt8(); // channel + } - if (!being || chatMsgLength <= 0) + if (chatMsgLength <= 0) return; std::string chatMsg = msg.readRawString(chatMsgLength); @@ -307,10 +317,17 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg) } } -void ChatHandler::processChat(Net::MessageIn &msg, bool normalChat) +void ChatHandler::processChat(Net::MessageIn &msg, bool normalChat, + bool channels) { - const int chatMsgLength = msg.readInt16() - 4; - + int chatMsgLength = msg.readInt16() - 4; + if (channels) + { + chatMsgLength -= 3; + msg.readInt8(); // channel + msg.readInt8(); // channel + msg.readInt8(); // channel + } if (chatMsgLength <= 0) return; diff --git a/src/net/ea/chathandler.h b/src/net/ea/chathandler.h index 301289084..c9bdd3029 100644 --- a/src/net/ea/chathandler.h +++ b/src/net/ea/chathandler.h @@ -75,9 +75,11 @@ class ChatHandler : public Net::ChatHandler virtual void processWhisper(Net::MessageIn &msg); - virtual void processBeingChat(Net::MessageIn &msg); + virtual void processBeingChat(Net::MessageIn &msg, + const bool channels); - virtual void processChat(Net::MessageIn &msg, bool normalChat); + virtual void processChat(Net::MessageIn &msg, bool normalChat, + bool channels); virtual void processMVP(Net::MessageIn &msg); |