From 5624bb7719cbed3b0eaa93cf5b55906ab9ad83a5 Mon Sep 17 00:00:00 2001 From: David Athay Date: Thu, 13 Nov 2008 18:12:37 +0000 Subject: Added avatars to party window --- src/net/partyhandler.cpp | 26 ++++++++++++++++++++++---- src/net/protocol.h | 6 ++++-- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'src/net') diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp index f3a2e2f5..af5190a3 100644 --- a/src/net/partyhandler.cpp +++ b/src/net/partyhandler.cpp @@ -41,6 +41,8 @@ PartyHandler::PartyHandler() CPMSG_PARTY_INVITED, CPMSG_PARTY_ACCEPT_INVITE_RESPONSE, CPMSG_PARTY_QUIT_RESPONSE, + CPMSG_PARTY_NEW_MEMBER, + CPMSG_PARTY_MEMBER_LEFT, 0 }; handledMessages = _messages; @@ -55,10 +57,7 @@ void PartyHandler::handleMessage(MessageIn &msg) { if (msg.readInt8() == ERRMSG_OK) { - if (!player_node->getInParty()) - player_node->setInParty(true); - std::string memberName = msg.readString(); - partyWindow->addPartyMember(memberName); + } } break; @@ -73,6 +72,7 @@ void PartyHandler::handleMessage(MessageIn &msg) if (msg.readInt8() == ERRMSG_OK) { player_node->setInParty(true); + chatWindow->chatLog("Joined party"); } } @@ -83,5 +83,23 @@ void PartyHandler::handleMessage(MessageIn &msg) player_node->setInParty(false); } } break; + + case CPMSG_PARTY_NEW_MEMBER: + { + int id = msg.readInt16(); + std::string name = msg.readString(); + + chatWindow->chatLog(name + " joined the party"); + + if (!player_node->getInParty()) + player_node->setInParty(true); + + partyWindow->addPartyMember(name); + } break; + + case CPMSG_PARTY_MEMBER_LEFT: + { + partyWindow->removePartyMember(msg.readString()); + } break; } } diff --git a/src/net/protocol.h b/src/net/protocol.h index c0bffb50..2ed414a8 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -157,12 +157,14 @@ enum { // Party PCMSG_PARTY_INVITE = 0x03A0, // S name - CPMSG_PARTY_INVITE_RESPONSE = 0x03A1, // B error, S name + CPMSG_PARTY_INVITE_RESPONSE = 0x03A1, // B error CPMSG_PARTY_INVITED = 0x03A2, // S name PCMSG_PARTY_ACCEPT_INVITE = 0x03A5, // S name - CPMSG_PARTY_ACCEPT_INVITE_RESPONSE = 0x03A6, // B error + CPMSG_PARTY_ACCEPT_INVITE_RESPONSE = 0x03A6, // B error, { S name } PCMSG_PARTY_QUIT = 0x03AA, // - CPMSG_PARTY_QUIT_RESPONSE = 0x03AB, // B error + CPMSG_PARTY_NEW_MEMBER = 0x03B0, // W being id, S name + CPMSG_PARTY_MEMBER_LEFT = 0x03B1, // W being id // Chat CPMSG_ERROR = 0x0401, // B error -- cgit v1.2.3-70-g09d2