diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/popupmenu.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.cpp | 19 | ||||
-rw-r--r-- | src/gui/widgets/tabbedarea.h | 4 | ||||
-rw-r--r-- | src/localplayer.cpp | 8 | ||||
-rw-r--r-- | src/localplayer.h | 7 | ||||
-rw-r--r-- | src/net/chatserver/party.cpp | 14 | ||||
-rw-r--r-- | src/net/chatserver/party.h | 5 | ||||
-rw-r--r-- | src/net/partyhandler.cpp | 23 | ||||
-rw-r--r-- | src/net/protocol.h | 7 |
9 files changed, 44 insertions, 50 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index dfd85815..1098cd3a 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -82,7 +82,7 @@ void PopupMenu::showPopup(int x, int y, Being *being) //mBrowserBox->addRow("@@follow|Follow " + name + "@@"); //mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@"); mBrowserBox->addRow(strprintf(_("@@guild|Invite %s@@"), name.c_str())); - //mBrowserBox->addRow(strprintf(_("@@party|Invite %s to join your party@@"), name.c_str())); + mBrowserBox->addRow(strprintf(_("@@party|Invite %s to join your party@@"), name.c_str())); } break; @@ -144,15 +144,14 @@ void PopupMenu::handleLink(const std::string& link) mBeing != NULL && mBeing->getType() == Being::PLAYER) { - player_node->invite(mBeing); + player_node->inviteToGuild(mBeing); } - /* // Add player to your party else if (link == "party") { + player_node->inviteToParty(mBeing); } - */ /* // Follow Player action diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index cf486971..a36688e2 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -130,22 +130,3 @@ void TabbedArea::removeTab(gcn::Tab *tab) adjustSize(); adjustTabPositions(); } - -void TabbedArea::adjustSize() -{ - int maxTabHeight = 0; - unsigned int i; - for (i = 0; i < mTabs.size(); i++) - { - if (mTabs[i].first->getHeight() > maxTabHeight) - { - maxTabHeight = mTabs[i].first->getHeight(); - } - } - - mTabContainer->setSize(getWidth() - getFrameSize(), maxTabHeight); - - mWidgetContainer->setPosition(1, maxTabHeight + 1); - mWidgetContainer->setSize(getWidth() - getFrameSize(), - getHeight() - maxTabHeight - getFrameSize()); -} diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index b822d9c9..0c5d18f7 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -66,10 +66,6 @@ class TabbedArea : public gcn::TabbedArea */ void removeTab(gcn::Tab *tab); - /** - * Overload adjustSize as it seems faulty - */ - void adjustSize(); }; #endif diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 6f03a46d..1e61e59d 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -36,6 +36,7 @@ #include "net/gameserver/player.h" #include "net/chatserver/guild.h" +#include "net/chatserver/party.h" #include "gui/gui.h" @@ -132,7 +133,7 @@ bool LocalPlayer::checkInviteRights(const std::string &guildName) return false; } -void LocalPlayer::invite(Being *being) +void LocalPlayer::inviteToGuild(Being *being) { // TODO: Allow user to choose which guild to invite being to // For now, just invite to the first guild you have permissions to invite with @@ -148,6 +149,11 @@ void LocalPlayer::invite(Being *being) } } +void LocalPlayer::inviteToParty(Being *being) +{ + Net::ChatServer::Party::invitePlayer(being->getName()); +} + void LocalPlayer::clearInventory() { mEquipment->clear(); diff --git a/src/localplayer.h b/src/localplayer.h index 832b7eb4..099a5f81 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -157,7 +157,12 @@ class LocalPlayer : public Player /** * Invite a player to join guild */ - void invite(Being* being); + void inviteToGuild(Being *being); + + /** + * Invite a player to join their party + */ + void inviteToParty(Being *being); void clearInventory(); void setInvItem(int index, int id, int amount); diff --git a/src/net/chatserver/party.cpp b/src/net/chatserver/party.cpp index 8d6fd7c2..e09803de 100644 --- a/src/net/chatserver/party.cpp +++ b/src/net/chatserver/party.cpp @@ -32,22 +32,14 @@ #include "../../log.h" -void Net::ChatServer::Party::createParty() -{ - logger->log("Sending PCMSG_PARTY_CREATE"); - MessageOut msg(PCMSG_PARTY_CREATE); - - Net::ChatServer::connection->send(msg); -} - void Net::ChatServer::Party::invitePlayer(const std::string &name) { logger->log("Sending PCMSG_PARTY_INVITE"); -// MessageOut msg(PCMSG_GUILD_INVITE); + MessageOut msg(PCMSG_PARTY_INVITE); -// msg.writeString(name); + msg.writeString(name); -// Net::ChatServer::connection->send(msg); + Net::ChatServer::connection->send(msg); } void Net::ChatServer::Party::acceptInvite(const std::string &name) diff --git a/src/net/chatserver/party.h b/src/net/chatserver/party.h index 6f404583..f1bd7a7f 100644 --- a/src/net/chatserver/party.h +++ b/src/net/chatserver/party.h @@ -34,11 +34,6 @@ namespace Net namespace Party { /** - * Create party - */ - void createParty(); - - /** * Invite a player to the party. */ void invitePlayer(const std::string &name); diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp index 91f0014e..527797e3 100644 --- a/src/net/partyhandler.cpp +++ b/src/net/partyhandler.cpp @@ -40,7 +40,9 @@ PartyHandler::PartyHandler() { static const Uint16 _messages[] = { - CPMSG_PARTY_CREATE_RESPONSE, + CPMSG_PARTY_INVITE_RESPONSE, + CPMSG_PARTY_INVITED, + CPMSG_PARTY_ACCEPT_INVITE_RESPONSE, CPMSG_PARTY_QUIT_RESPONSE, 0 }; @@ -52,14 +54,29 @@ void PartyHandler::handleMessage(MessageIn &msg) { switch (msg.getId()) { - case CPMSG_PARTY_CREATE_RESPONSE: + case CPMSG_PARTY_INVITE_RESPONSE: { if (msg.readInt8() == ERRMSG_OK) { - player_node->setInParty(true); + if (!player_node->getInParty()) + player_node->setInParty(true); } } break; + case CPMSG_PARTY_INVITED: + { + //TODO: Show dialog to player asking to join party + std::string inviter = msg.readString(); + } break; + + case CPMSG_PARTY_ACCEPT_INVITE_RESPONSE: + { + if (msg.readInt8() == ERRMSG_OK) + { + player_node->setInParty(true); + } + } + case CPMSG_PARTY_QUIT_RESPONSE: { if (msg.readInt8() == ERRMSG_OK) diff --git a/src/net/protocol.h b/src/net/protocol.h index 5aab202c..e26e9ed5 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -148,8 +148,11 @@ enum { CPMSG_GUILD_REJOIN = 0x0371, // S name, W guild, B rights, W channel // Party - PCMSG_PARTY_CREATE = 0x03A0, // - - CPMSG_PARTY_CREATE_RESPONSE = 0x03A1, // B error + PCMSG_PARTY_INVITE = 0x03A0, // 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 PCMSG_PARTY_QUIT = 0x03AA, // - CPMSG_PARTY_QUIT_RESPONSE = 0x03AB, // B error |