From 34e386d0c2d4ae844d50185f70bba945960bad62 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 15 Aug 2011 02:52:07 +0300 Subject: Add warp menu item for gms in navigation items. --- src/gui/popupmenu.cpp | 13 +++++++++++++ src/net/adminhandler.h | 1 + src/net/ea/adminhandler.cpp | 6 ++++++ src/net/ea/adminhandler.h | 2 ++ src/net/manaserv/adminhandler.cpp | 5 +++++ src/net/manaserv/adminhandler.h | 2 ++ 6 files changed, 29 insertions(+) diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index c95864396..a7c008684 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -502,6 +502,11 @@ void PopupMenu::showPopup(int x, int y, MapItem *mapItem) mBrowserBox->addRow(strprintf("@@rename map|%s@@", _("Rename"))); mBrowserBox->addRow(strprintf("@@remove map|%s@@", _("Remove"))); + if (player_node && player_node->isGM()) + { + mBrowserBox->addRow("##3---"); + mBrowserBox->addRow(strprintf("@@warp map|%s@@", _("Warp"))); + } mBrowserBox->addRow("##3---"); mBrowserBox->addRow(strprintf("@@cancel|%s@@", _("Cancel"))); @@ -1144,6 +1149,14 @@ void PopupMenu::handleLink(const std::string &link, if (chatWindow) chatWindow->clearTab(); } + else if (link == "warp map" && mMapItem) + { + if (Game::instance()) + { + Net::getAdminHandler()->warp(Game::instance()->getCurrentMapName(), + mMapItem->getX(), mMapItem->getY()); + } + } else if (link == "remove map" && mMapItem) { if (viewport) diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 2d7eccebf..d063c4eb1 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -53,6 +53,7 @@ class AdminHandler virtual void mute(int playerId, int type, int limit) = 0; + virtual void warp(std::string map, int x, int y) = 0; // TODO }; diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp index 5440d14d0..bdd43b3f8 100644 --- a/src/net/ea/adminhandler.cpp +++ b/src/net/ea/adminhandler.cpp @@ -63,4 +63,10 @@ void AdminHandler::mute(int playerId A_UNUSED, int type A_UNUSED, return; // Still looking into this } +void AdminHandler::warp(std::string map, int x, int y) +{ + Net::getChatHandler()->talk(strprintf( + "@warp %s %d %d", map.c_str(), x, y)); +} + } // namespace Ea diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h index 6f77c0e18..fcf1e25b2 100644 --- a/src/net/ea/adminhandler.h +++ b/src/net/ea/adminhandler.h @@ -51,6 +51,8 @@ class AdminHandler : public Net::AdminHandler virtual void unban(const std::string &name); virtual void mute(int playerId, int type, int limit); + + virtual void warp(std::string map, int x, int y); }; } // namespace Ea diff --git a/src/net/manaserv/adminhandler.cpp b/src/net/manaserv/adminhandler.cpp index 72e7c7ca8..2c76e99a3 100644 --- a/src/net/manaserv/adminhandler.cpp +++ b/src/net/manaserv/adminhandler.cpp @@ -91,4 +91,9 @@ void AdminHandler::mute(int playerId A_UNUSED, int type A_UNUSED, // TODO } +void AdminHandler::warp(std::string map, int x, int y) +{ + // TODO +} + } // namespace ManaServ diff --git a/src/net/manaserv/adminhandler.h b/src/net/manaserv/adminhandler.h index a91841085..65e9ea2b0 100644 --- a/src/net/manaserv/adminhandler.h +++ b/src/net/manaserv/adminhandler.h @@ -58,6 +58,8 @@ class AdminHandler : public Net::AdminHandler void unban(const std::string &name); void mute(int playerId, int type, int limit); + + void warp(std::string map, int x, int y); }; } // namespace ManaServ -- cgit v1.2.3-70-g09d2