diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/commandhandler.cpp | 21 | ||||
-rw-r--r-- | src/commandhandler.h | 5 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 4 | ||||
-rw-r--r-- | src/localplayer.h | 2 |
6 files changed, 32 insertions, 4 deletions
@@ -2,6 +2,8 @@ * src/commandhandler.hpp, src/commandhandler.cpp: Added help for each command based on mantis bug #359, thanks to Scraggy. + * src/localplayer.cpp, src/commandhandler.cpp, src/gui/popupmenu.cpp, + src/commandhandler.h, src/localplayer.h: Added /party command. 2008-07-05 David Athay <ko2fan@gmail.com> diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 7e20deff..1dadc236 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -26,6 +26,7 @@ #include "channelmanager.h" #include "channel.h" #include "game.h" +#include "localplayer.h" #include "gui/chat.h" #include "net/chatserver/chatserver.h" #include "net/gameserver/player.h" @@ -90,6 +91,10 @@ void CommandHandler::handleCommand(const std::string &command) { handleClear(); } + else if (type == "party") + { + handleParty(args); + } else { chatWindow->chatLog("Unknown command"); @@ -120,6 +125,7 @@ void CommandHandler::handleHelp(const std::string &args) chatWindow->chatLog("/quit > Leave a channel"); chatWindow->chatLog("/admin > Send a command to the server (GM only)"); chatWindow->chatLog("/clear > Clears this window"); + chatWindow->chatLog("/party > Invite a user to party"); chatWindow->chatLog("For more information, type /help <command>"); } else if (args == "admin") @@ -164,6 +170,13 @@ void CommandHandler::handleHelp(const std::string &args) chatWindow->chatLog("If the <nick> has spaces in it, enclose it in " "double quotes (\")."); } + else if (args == "party") + { + chatWindow->chatLog("Command: /party <nick>"); + chatWindow->chatLog("This command invites <nick> to party with you."); + chatWindow->chatLog("If the <nick> has spaces in it, enclose it in " + "double quotes (\")."); + } else if (args == "topic") { chatWindow->chatLog("Command: /topic <message>"); @@ -279,3 +292,11 @@ void CommandHandler::handleClear() { chatWindow->clearTab(chatWindow->getFocused()); } + +void CommandHandler::handleParty(const std::string &args) +{ + if (args != "") + { + player_node->inviteToParty(args); + } +} diff --git a/src/commandhandler.h b/src/commandhandler.h index ef6da33d..5c019450 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -108,6 +108,11 @@ class CommandHandler */ void handleClear(); + /** + * Handle a party command. + */ + void handleParty(const std::string &args); + }; extern CommandHandler *commandHandler; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 01f48ccc..2888382b 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -150,7 +150,7 @@ void PopupMenu::handleLink(const std::string& link) // Add player to your party else if (link == "party") { - player_node->inviteToParty(mBeing); + player_node->inviteToParty(mBeing->getName()); } /* diff --git a/src/localplayer.cpp b/src/localplayer.cpp index dbcb1d42..00ea6a49 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -149,9 +149,9 @@ void LocalPlayer::inviteToGuild(Being *being) } } -void LocalPlayer::inviteToParty(Being *being) +void LocalPlayer::inviteToParty(const std::string &name) { - Net::ChatServer::Party::invitePlayer(being->getName()); + Net::ChatServer::Party::invitePlayer(name); } void LocalPlayer::clearInventory() diff --git a/src/localplayer.h b/src/localplayer.h index 64dec1b2..0b4b66ed 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -162,7 +162,7 @@ class LocalPlayer : public Player /** * Invite a player to join their party */ - void inviteToParty(Being *being); + void inviteToParty(const std::string &name); void clearInventory(); void setInvItem(int index, int id, int amount); |