From 3d85a00ff2a33e22ba63d0b7dfc156d8076933e1 Mon Sep 17 00:00:00 2001 From: Tametomo Date: Wed, 15 Apr 2009 20:36:46 +0200 Subject: Trim out (npc) tag from NPC names in PopupMenu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generally, it's good to tack on this tag onto nearly everything, but for popup options, it looks a tad tacky. Signed-off-by: Tametomo Signed-off-by: Bjørn Lindeijer --- src/gui/popupmenu.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index ef1990f8..5142482f 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -78,7 +78,10 @@ void PopupMenu::showPopup(int x, int y, Being *being) if (being->getType() != Being::UNKNOWN) mBrowserBox->addRow(_("@@name|Add name to chat@@")); - const std::string &name = being->getName(); + const std::string &name = being->getType() == Being::NPC ? + being->getName().substr(0, being->getName().size() + - 6) : being->getName(); + switch (being->getType()) { case Being::PLAYER: @@ -304,7 +307,10 @@ void PopupMenu::handleLink(const std::string &link) else if (link == "name" && being) { - chatWindow->addInputText(being->getName()); + const std::string &name = being->getType() == Being::NPC ? + being->getName().substr(0, + being->getName().size() - 6) : being->getName(); + chatWindow->addInputText(name); } else if (link == "admin-kick" && -- cgit v1.2.3-70-g09d2