diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-11-01 20:04:43 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-11-01 20:04:43 +0100 |
commit | 38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad (patch) | |
tree | 81d0e898790264114683cca9cfd3355bea114415 /src/commandhandler.cpp | |
parent | c5e341f7b5f5e4efcabd09e00e177bb873db8097 (diff) | |
parent | 1f69108501c4bf51f3adac9ffbf7a7631fb12b9a (diff) | |
download | mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.gz mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.bz2 mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.tar.xz mana-38f7cd9a9a49dc91b1c2e69b48308bd16d4b5aad.zip |
Merge branch '0.5' of gitorious.org:mana/mana
Conflicts:
src/being.cpp
src/client.cpp
src/commandhandler.cpp
src/gui/setup_video.cpp
src/gui/socialwindow.cpp
src/gui/viewport.cpp
src/gui/widgets/browserbox.cpp
src/gui/widgets/itemcontainer.cpp
src/imageparticle.cpp
src/localplayer.cpp
src/localplayer.h
src/map.cpp
src/net/tmwa/beinghandler.cpp
src/particle.cpp
src/particle.h
src/player.cpp
src/player.h
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r-- | src/commandhandler.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 878180e6..f3947bd9 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -21,6 +21,7 @@ #include "commandhandler.h" +#include "actorspritemanager.h" #include "channelmanager.h" #include "channel.h" #include "game.h" @@ -46,7 +47,8 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) { std::string::size_type pos = command.find(' '); std::string type(command, 0, pos); - std::string args(command, pos == std::string::npos ? command.size() : pos + 1); + std::string args(command, pos == std::string::npos ? + command.size() : pos + 1); if (type == "help") // Do help before tabs so they can't override it { @@ -120,6 +122,10 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab) { handlePresent(args, tab); } + else if (type == "showip" && Net::getNetworkType() == ServerInfo::TMWATHENA) + { + handleShowIp(args, tab); + } else { tab->chatLog(_("Unknown command.")); @@ -462,6 +468,35 @@ void CommandHandler::handleToggle(const std::string &args, ChatTab *tab) } } +void CommandHandler::handleShowIp(const std::string &args, ChatTab *tab) +{ + if (args.empty()) + { + tab->chatLog(player_node->getShowIp() ? + _("Show IP: On") : _("Show IP: Off")); + return; + } + + char opt = parseBoolean(args); + + switch (opt) + { + case 0: + tab->chatLog(_("Show IP: Off")); + player_node->setShowIp(false); + break; + case 1: + tab->chatLog(_("Show IP: On")); + player_node->setShowIp(true); + break; + case -1: + tab->chatLog(strprintf(BOOLEAN_OPTIONS, "showip")); + return; + } + + actorSpriteManager->updatePlayerNames(); +} + void CommandHandler::handlePresent(const std::string &args, ChatTab *tab) { chatWindow->doPresent(); |