summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-02-22 16:49:38 -0700
committerJared Adams <jaxad0127@gmail.com>2010-02-22 16:53:32 -0700
commit00cbc7490641a697dbedb85b3b2ff3f75893b7ff (patch)
treea8ac366342a9138063eefca13ea2440042b32b84
parentdc3b7dc6001c64bd9473518299c74f292b521516 (diff)
downloadmana-client-00cbc7490641a697dbedb85b3b2ff3f75893b7ff.tar.gz
mana-client-00cbc7490641a697dbedb85b3b2ff3f75893b7ff.tar.bz2
mana-client-00cbc7490641a697dbedb85b3b2ff3f75893b7ff.tar.xz
mana-client-00cbc7490641a697dbedb85b3b2ff3f75893b7ff.zip
Change chat autocompletion to be more flexible
Reviewed-by: Chuck Miller
-rw-r--r--src/gui/chat.cpp10
-rw-r--r--src/gui/widgets/chattab.cpp5
-rw-r--r--src/gui/widgets/chattab.h15
-rw-r--r--src/gui/widgets/whispertab.cpp5
-rw-r--r--src/gui/widgets/whispertab.h2
-rw-r--r--src/guild.cpp2
-rw-r--r--src/guild.h2
-rw-r--r--src/net/ea/gui/partytab.cpp11
-rw-r--r--src/net/ea/gui/partytab.h4
-rw-r--r--src/party.cpp2
-rw-r--r--src/party.h2
11 files changed, 18 insertions, 42 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 3a47cd16..954ee3f0 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -521,15 +521,9 @@ void ChatWindow::autoComplete()
ChatTab *cTab = static_cast<ChatTab*>(mChatTabs->getSelectedTab());
std::vector<std::string> nameList;
- if (cTab && cTab->getType() == ChatTab::PARTY)
- {
- Party *p = player_node->getParty();
-
- if (p) // Shouldn't be needed, but lets be safe
- p->getNames(nameList);
+ cTab->getAutoCompleteList(nameList);
+ newName = autoComplete(nameList, name);
- newName = autoComplete(nameList, name);
- }
if (newName == "")
{
beingManager->getPlayerNames(nameList, true);
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index d2221255..ee4197eb 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -275,11 +275,6 @@ void ChatTab::handleCommand(const std::string &msg)
commandHandler->handleCommand(msg, this);
}
-int ChatTab::getType() const
-{
- return INPUT;
-}
-
void ChatTab::addRow(std::string &line)
{
std::string::size_type idx = 0;
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index 8fa0ab71..3a4133bb 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -48,14 +48,6 @@ enum
class ChatTab : public Tab
{
public:
- enum Type
- {
- UNKNOWN,
- INPUT,
- WHISPER,
- PARTY
- };
-
/**
* Constructor.
*/
@@ -119,11 +111,6 @@ class ChatTab : public Tab
const std::string &args)
{ return false; }
- /**
- * Returns type of the being.
- */
- virtual int getType() const;
-
protected:
friend class ChatWindow;
friend class WhisperWindow;
@@ -134,6 +121,8 @@ class ChatTab : public Tab
virtual void handleCommand(const std::string &msg);
+ virtual void getAutoCompleteList(std::vector<std::string>&) const {}
+
void addRow(std::string &line);
ScrollArea *mScrollArea;
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index 9707953e..124b3165 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -114,8 +114,3 @@ bool WhisperTab::handleCommand(const std::string &type,
return true;
}
-
-int WhisperTab::getType() const
-{
- return ChatTab::WHISPER;
-}
diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h
index 146ea5c5..447a8fe0 100644
--- a/src/gui/widgets/whispertab.h
+++ b/src/gui/widgets/whispertab.h
@@ -39,8 +39,6 @@ class WhisperTab : public ChatTab
bool handleCommand(const std::string &type,
const std::string &args);
- int getType() const;
-
protected:
friend class ChatWindow;
diff --git a/src/guild.cpp b/src/guild.cpp
index d4cc76be..b4ecaa7e 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -211,7 +211,7 @@ bool Guild::isMember(const std::string &name) const
return false;
}
-void Guild::getNames(std::vector<std::string> &names) const
+const void Guild::getNames(std::vector<std::string> &names) const
{
names.clear();
MemberList::const_iterator it = mMembers.begin(),
diff --git a/src/guild.h b/src/guild.h
index dfb7862f..640e495e 100644
--- a/src/guild.h
+++ b/src/guild.h
@@ -149,7 +149,7 @@ public:
bool isMember(const std::string &name) const;
- void getNames(std::vector<std::string> &names) const;
+ const void getNames(std::vector<std::string> &names) const;
static Guild *getGuild(int id);
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index 6f2ff65a..27e5b2d9 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -19,9 +19,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "partytab.h"
+#include "net/ea/gui/partytab.h"
#include "commandhandler.h"
+#include "localplayer.h"
+#include "party.h"
#include "gui/palette.h"
@@ -196,9 +198,12 @@ bool PartyTab::handleCommand(const std::string &type, const std::string &args)
return true;
}
-int PartyTab::getType() const
+void PartyTab::getAutoCompleteList(std::vector<std::string> &names) const
{
- return ChatTab::PARTY;
+ Party *p = player_node->getParty();
+
+ if (p)
+ p->getNames(names);
}
} // namespace EAthena
diff --git a/src/net/ea/gui/partytab.h b/src/net/ea/gui/partytab.h
index da225a07..af111836 100644
--- a/src/net/ea/gui/partytab.h
+++ b/src/net/ea/gui/partytab.h
@@ -39,10 +39,10 @@ class PartyTab : public ChatTab
bool handleCommand(const std::string &type, const std::string &args);
- int getType() const;
-
protected:
void handleInput(const std::string &msg);
+
+ virtual void getAutoCompleteList(std::vector<std::string>&) const;
};
extern PartyTab *partyTab;
diff --git a/src/party.cpp b/src/party.cpp
index 8dc6dd38..a8e18b2d 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -230,7 +230,7 @@ bool Party::isMember(const std::string &name) const
return false;
}
-void Party::getNames(std::vector<std::string> &names) const
+const void Party::getNames(std::vector<std::string> &names) const
{
names.clear();
MemberList::const_iterator it = mMembers.begin(),
diff --git a/src/party.h b/src/party.h
index b1aec179..e109d7b6 100644
--- a/src/party.h
+++ b/src/party.h
@@ -153,7 +153,7 @@ public:
bool isMember(const std::string &name) const;
- void getNames(std::vector<std::string> &names) const;
+ const void getNames(std::vector<std::string> &names) const;
static Party *getParty(int id);