summaryrefslogtreecommitdiff
path: root/src/net/manaserv/partyhandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-02-08 14:40:04 -0700
committerJared Adams <jaxad0127@gmail.com>2010-02-08 14:43:51 -0700
commit8a31e96d8534d402db9cd48183c0b15732f7d95e (patch)
tree885d83febf301c1289c3bf7f83bf9dca89e0347c /src/net/manaserv/partyhandler.cpp
parentbc5c031e43eff506c925682349dd2a52b89d6565 (diff)
downloadmana-client-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.gz
mana-client-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.bz2
mana-client-8a31e96d8534d402db9cd48183c0b15732f7d95e.tar.xz
mana-client-8a31e96d8534d402db9cd48183c0b15732f7d95e.zip
Merge PartyWindow and GuildWindow into SocialWindow
Diffstat (limited to 'src/net/manaserv/partyhandler.cpp')
-rw-r--r--src/net/manaserv/partyhandler.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp
index cec33fc4..da97374b 100644
--- a/src/net/manaserv/partyhandler.cpp
+++ b/src/net/manaserv/partyhandler.cpp
@@ -21,13 +21,13 @@
#include "net/manaserv/partyhandler.h"
-#include "gui/partywindow.h"
-
-#include "gui/widgets/chattab.h"
-
#include "log.h"
#include "localplayer.h"
+#include "gui/socialwindow.h"
+
+#include "gui/widgets/chattab.h"
+
#include "net/manaserv/connection.h"
#include "net/manaserv/messagein.h"
#include "net/manaserv/messageout.h"
@@ -38,13 +38,16 @@
#include <iostream>
+#define PARTY_ID 1
+
extern Net::PartyHandler *partyHandler;
namespace ManaServ {
extern Connection *chatServerConnection;
-PartyHandler::PartyHandler()
+PartyHandler::PartyHandler():
+ mParty(Party::getParty(PARTY_ID))
{
static const Uint16 _messages[] = {
CPMSG_PARTY_INVITE_RESPONSE,
@@ -74,15 +77,14 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
case CPMSG_PARTY_INVITED:
{
- std::string inviter = msg.readString();
- partyWindow->showPartyInvite(inviter);
+ socialWindow->showPartyInvite(msg.readString());
} break;
case CPMSG_PARTY_ACCEPT_INVITE_RESPONSE:
{
if (msg.readInt8() == ERRMSG_OK)
{
- player_node->setInParty(true);
+ //
localChatTab->chatLog(_("Joined party."));
}
}
@@ -91,7 +93,8 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
{
if (msg.readInt8() == ERRMSG_OK)
{
- player_node->setInParty(false);
+ mParty->clearMembers();
+ player_node->setParty(NULL);
}
} break;
@@ -103,15 +106,16 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
localChatTab->chatLog(strprintf(_("%s joined the party."),
name.c_str()));
- if (!player_node->isInParty())
- player_node->setInParty(true);
+ if (id == player_node->getId())
+ player_node->setParty(mParty);
- partyWindow->updateMember(id, name);
+ PartyMember *member = new PartyMember(PARTY_ID, id, name);
+ mParty->addMember(member);
} break;
case CPMSG_PARTY_MEMBER_LEFT:
{
- partyWindow->removeMember(msg.readString());
+ mParty->removeMember(msg.readString());
} break;
case CPMSG_PARTY_REJECTED: