diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-06 00:28:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-06 01:56:21 +0300 |
commit | 3acb4aa3b1248719a3896b419600864a68c65908 (patch) | |
tree | 33c77fb54bdb45140252064d11fcd5f7664e2adf | |
parent | 97868ad421f8587ffedda5392ac0af2c3fecc7bb (diff) | |
download | plus-3acb4aa3b1248719a3896b419600864a68c65908.tar.gz plus-3acb4aa3b1248719a3896b419600864a68c65908.tar.bz2 plus-3acb4aa3b1248719a3896b419600864a68c65908.tar.xz plus-3acb4aa3b1248719a3896b419600864a68c65908.zip |
eathena: impliment packet SMSG_CHAT_ROOM_DESTROY.
-rw-r--r-- | src/actions/commands.cpp | 2 | ||||
-rw-r--r-- | src/actormanager.cpp | 20 | ||||
-rw-r--r-- | src/actormanager.h | 2 | ||||
-rw-r--r-- | src/net/eathena/chathandler.cpp | 6 |
4 files changed, 25 insertions, 5 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 04a69fddd..9b3b2aca2 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -898,7 +898,7 @@ impHandler(joinChatRoom) #endif } -impHandler(leaveChatRoom) +impHandler0(leaveChatRoom) { #ifdef EATHENA_SUPPORT chatHandler->leaveChatRoom(); diff --git a/src/actormanager.cpp b/src/actormanager.cpp index d4748fce2..954fe087f 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -53,6 +53,7 @@ #include "net/playerhandler.h" #include "net/serverfeatures.h" +#include "resources/chatobject.h" #include "resources/iteminfo.h" #include "resources/db/itemdb.h" @@ -1807,10 +1808,27 @@ Being *ActorManager::cloneBeing(const Being *const srcBeing, dstBeing->setSprite(slot, spriteId, "", color, false); } const int hairSlot = charServerHandler->hairSprite(); - const int hairStyle = -srcBeing->getSpriteID(hairSlot); + const int hairStyle = -srcBeing->getSpriteID(hairSlot); const unsigned char hairColor = srcBeing->getHairColor(); dstBeing->setSprite(hairSlot, hairStyle * -1, ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); dstBeing->setHairColor(hairColor); return dstBeing; } + +void ActorManager::removeRoom(const int chatId) +{ + for_actors + { + ActorSprite *const actor = *it; + if (actor && actor->getType() != ActorType::Player) + { + Being *const being = static_cast<Being*>(actor); + const ChatObject *const chat = being->getChat(); + if (chat && chat->chatId == chatId) + { + being->setChat(nullptr); + } + } + } +} diff --git a/src/actormanager.h b/src/actormanager.h index 411129e3b..2484d3e3a 100644 --- a/src/actormanager.h +++ b/src/actormanager.h @@ -317,6 +317,8 @@ class ActorManager final: public ConfigListener void updateEffects(const std::map<int, int> &addEffects, const std::set<int> &removeEffects) const; + void removeRoom(const int chatId); + protected: bool validateBeing(const Being *const aroundBeing, Being *const being, diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp index a8f9709ed..e35fcbc8b 100644 --- a/src/net/eathena/chathandler.cpp +++ b/src/net/eathena/chathandler.cpp @@ -704,7 +704,7 @@ void ChatHandler::processChatRoomJoinAck(Net::MessageIn &msg) obj->currentUsers = oldChat->currentUsers; obj->type = oldChat->type; obj->title = oldChat->title; - obj->update(); +// obj->update(); localPlayer->setChat(obj); } @@ -926,8 +926,8 @@ void ChatHandler::processChatRoomCreateAck(Net::MessageIn &msg) void ChatHandler::processChatRoomDestroy(Net::MessageIn &msg) { - UNIMPLIMENTEDPACKET; - msg.readInt32("chat id"); + const int chatId = msg.readInt32("chat id"); + actorManager->removeRoom(chatId); } void ChatHandler::processChatRoomJoinFailed(Net::MessageIn &msg) |