summaryrefslogtreecommitdiff
path: root/src/gui/widgets/chattab.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-19 01:31:14 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-19 01:33:40 +0300
commite9c84384d8d0e5b91678eb4722ae30bd3693703f (patch)
tree6f30e3d8500f9b0c4620a6c5393df498a04c0a0c /src/gui/widgets/chattab.cpp
parent0a068a5f08b1805d5b385b8f81aaf3c7199bff06 (diff)
downloadManaVerse-e9c84384d8d0e5b91678eb4722ae30bd3693703f.tar.gz
ManaVerse-e9c84384d8d0e5b91678eb4722ae30bd3693703f.tar.bz2
ManaVerse-e9c84384d8d0e5b91678eb4722ae30bd3693703f.tar.xz
ManaVerse-e9c84384d8d0e5b91678eb4722ae30bd3693703f.zip
Add help search commands (?text).
Example: ?warps It will open help page about warps.
Diffstat (limited to 'src/gui/widgets/chattab.cpp')
-rw-r--r--src/gui/widgets/chattab.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 5f97cd613..fa61f0dcd 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -30,6 +30,8 @@
#include "logger.h"
#include "sound.h"
+#include "gui/helpwindow.h"
+
#include "gui/widgets/browserbox.h"
#include "gui/widgets/scrollarea.h"
#include "gui/widgets/itemlinkhandler.h"
@@ -379,11 +381,18 @@ void ChatTab::chatInput(const std::string &message)
if (commandHandler)
commandHandler->replaceVars(msg);
- // Prepare ordinary message
- if (msg[0] != '/')
- handleInput(msg);
- else
- handleCommand(std::string(msg, 1));
+ switch (msg[0])
+ {
+ case '/':
+ handleCommand(std::string(msg, 1));
+ break;
+ case '?':
+ handleHelp(std::string(msg, 1));
+ break;
+ default:
+ handleInput(msg);
+ break;
+ }
}
void ChatTab::scroll(int amount)
@@ -414,6 +423,12 @@ void ChatTab::handleCommand(const std::string &msg)
commandHandler->handleCommands(msg, this);
}
+void ChatTab::handleHelp(const std::string &msg)
+{
+ if (commandHandler)
+ helpWindow->search(msg);
+}
+
bool ChatTab::handleCommands(const std::string &type, const std::string &args)
{
// need split to commands and call each