summaryrefslogtreecommitdiff
path: root/src/actorspritemanager.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-09-25 03:15:26 +0200
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-09-25 03:15:26 +0200
commit661d16e98c62dfff40f481177bf3f1a0c58c2124 (patch)
treea415866c4c94a0a0c53045a47220ca413ae9c5c9 /src/actorspritemanager.cpp
parent758d80263b1647c712c0e0cdd3dfca9945a1bb7e (diff)
parent7d0738df0d139af3175fcc1fec5b9be4a467f4f4 (diff)
downloadmana-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.gz
mana-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.bz2
mana-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.xz
mana-661d16e98c62dfff40f481177bf3f1a0c58c2124.zip
Merge branch '1.0'
Conflicts: src/actorspritemanager.h src/beingmanager.cpp src/game.cpp src/gui/beingpopup.cpp src/gui/chat.cpp src/gui/chat.h src/gui/inventorywindow.h src/gui/itempopup.cpp src/gui/socialwindow.cpp src/gui/statuswindow.cpp src/gui/widgets/chattab.cpp src/gui/widgets/chattab.h src/net/tmwa/inventoryhandler.cpp src/net/tmwa/partyhandler.cpp src/party.cpp src/sound.cpp src/utils/stringutils.cpp src/utils/stringutils.h
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r--src/actorspritemanager.cpp64
1 files changed, 48 insertions, 16 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 88618ccd..5d038a18 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -52,8 +52,50 @@ class FindBeingFunctor
ActorSprite::Type type;
} beingFinder;
+class PlayerNamesLister : public AutoCompleteLister
+{
+ void getAutoCompleteList(std::vector<std::string>& names) const
+ {
+ names.clear();
+
+ const ActorSprites &mActors = actorSpriteManager->getAll();
+ for_actors
+ {
+ if ((*it)->getType() == ActorSprite::FLOOR_ITEM)
+ continue;
+
+ Being *being = static_cast<Being*>(*it);
+ if (being->getType() == Being::PLAYER && being->getName() != "")
+ names.push_back(being->getName());
+ }
+ }
+};
+
+class PlayerNPCNamesLister : public AutoCompleteLister
+{
+ void getAutoCompleteList(std::vector<std::string>& names) const
+ {
+ names.clear();
+
+ const ActorSprites &mActors = actorSpriteManager->getAll();
+ for_actors
+ {
+ if ((*it)->getType() == ActorSprite::FLOOR_ITEM)
+ continue;
+
+ Being *being = static_cast<Being*>(*it);
+ if ((being->getType() == Being::PLAYER
+ || being->getType() == Being::NPC)
+ && being->getName() != "")
+ names.push_back(being->getName());
+ }
+ }
+};
+
ActorSpriteManager::ActorSpriteManager()
{
+ mPlayerNames = new PlayerNamesLister;
+ mPlayerNPCNames = new PlayerNPCNamesLister;
}
ActorSpriteManager::~ActorSpriteManager()
@@ -278,24 +320,14 @@ bool ActorSpriteManager::hasActorSprite(ActorSprite *actor) const
return false;
}
-void ActorSpriteManager::getPlayerNames(std::vector<std::string> &names,
- bool npcNames)
+AutoCompleteLister *ActorSpriteManager::getPlayerNameLister()
{
- names.clear();
-
- for_actors
- {
- if ((*it)->getType() == ActorSprite::FLOOR_ITEM)
- continue;
+ return mPlayerNames;
+}
- Being *being = static_cast<Being*>(*it);
- if ((being->getType() == ActorSprite::PLAYER
- || (being->getType() == ActorSprite::NPC && npcNames))
- && being->getName() != "")
- {
- names.push_back(being->getName());
- }
- }
+AutoCompleteLister *ActorSpriteManager::getPlayerNPCNameLister()
+{
+ return mPlayerNPCNames;
}
void ActorSpriteManager::updatePlayerNames()