From 0278a66e30a3f2df0932ee501b5e5dc09b1a23ce Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 28 Sep 2014 15:04:05 +0300 Subject: Show portal names in popup if portal not present at map. --- src/actormanager.cpp | 4 ++++ src/being/being.cpp | 3 +++ src/net/ea/beinghandler.cpp | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/actormanager.cpp b/src/actormanager.cpp index a27cd0f34..d920d63ac 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -253,6 +253,10 @@ Being *ActorManager::createBeing(const int id, if (localPlayer) localPlayer->checkNewName(being); } + else if (type == ActorType::Portal) + { + beingHandler->requestNameById(id); + } if (type == ActorType::Player) { if (botCheckerWindow) diff --git a/src/being/being.cpp b/src/being/being.cpp index 0779be63b..3cc51ef9d 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -233,6 +233,9 @@ Being::Being(const int id, mGotComment = true; } + if (mType == ActorType::Portal) + mShowName = false; + config.addListener("visiblenames", this); reReadConfig(); diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index f9fdf3c38..fe42daedc 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -33,10 +33,14 @@ #include "particle/particle.h" +#include "gui/viewport.h" + #include "gui/windows/botcheckerwindow.h" #include "gui/windows/socialwindow.h" #include "gui/windows/killstats.h" +#include "resources/mapitemtype.h" + #include "resources/map/map.h" #include "debug.h" @@ -331,7 +335,20 @@ void BeingHandler::processNameResponse(Net::MessageIn &msg) const } else { - dstBeing->setName(msg.readString(24, "name")); + const std::string name = msg.readString(24, "name"); + if (dstBeing->getType() != ActorType::Portal) + { + dstBeing->setName(name); + } + else if (viewport) + { + Map *const map = viewport->getMap(); + if (map) + { + map->addPortalTile(name, MapItemType::PORTAL, + dstBeing->getTileX(), dstBeing->getTileY()); + } + } dstBeing->updateGuild(); dstBeing->addToCache(); -- cgit v1.2.3-60-g2f50