summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-06 17:19:32 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-06 17:20:00 +0300
commit88697bc3503090194877b241b987ddc751034166 (patch)
tree6e515b6ca60d7866d352baa670558786a505bcdd /src
parent21e0c15d56438f2d7f3e15736c00dd8b8ac6bd1c (diff)
downloadmanaverse-88697bc3503090194877b241b987ddc751034166.tar.gz
manaverse-88697bc3503090194877b241b987ddc751034166.tar.bz2
manaverse-88697bc3503090194877b241b987ddc751034166.tar.xz
manaverse-88697bc3503090194877b241b987ddc751034166.zip
Add strong typed bool type NpcNames.
Diffstat (limited to 'src')
-rw-r--r--src/actormanager.cpp9
-rw-r--r--src/actormanager.h2
-rw-r--r--src/enums/simpletypes.h1
-rw-r--r--src/gui/widgets/tabs/socialplayerstab.h4
-rw-r--r--src/gui/windows/chatwindow.cpp2
-rw-r--r--src/utils/chatutils.cpp2
6 files changed, 12 insertions, 8 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index e32eda6f1..b9ff84adb 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -1410,7 +1410,7 @@ void ActorManager::printBeingsToChat(const std::vector<Being*> &beings,
}
void ActorManager::getPlayerNames(StringVect &names,
- const bool npcNames) const
+ const NpcNames npcNames) const
{
names.clear();
@@ -1426,9 +1426,10 @@ void ActorManager::getPlayerNames(StringVect &names,
}
const Being *const being = static_cast<const Being*>(*it);
- if ((being->getType() == ActorType::Player
- || (being->getType() == ActorType::Npc && npcNames))
- && being->getName() != "")
+ if ((being->getType() == ActorType::Player ||
+ (being->getType() == ActorType::Npc &&
+ npcNames == NpcNames_true)) &&
+ being->getName() != "")
{
names.push_back(being->getName());
}
diff --git a/src/actormanager.h b/src/actormanager.h
index 9d0bc261c..b6a9eb703 100644
--- a/src/actormanager.h
+++ b/src/actormanager.h
@@ -236,7 +236,7 @@ class ActorManager final: public ConfigListener
const std::string &header);
void getPlayerNames(StringVect &names,
- const bool npcNames) const;
+ const NpcNames npcNames) const;
void getMobNames(StringVect &names) const;
diff --git a/src/enums/simpletypes.h b/src/enums/simpletypes.h
index a86e2629b..c6b3d26a6 100644
--- a/src/enums/simpletypes.h
+++ b/src/enums/simpletypes.h
@@ -61,5 +61,6 @@ defBoolEnum(Keep);
defBoolEnum(Modifiable);
defBoolEnum(AllPlayers);
defBoolEnum(AllowSort);
+defBoolEnum(NpcNames);
#endif // ENUMS_SIMPLETYPES_H
diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h
index 324ede7c6..7fee69deb 100644
--- a/src/gui/widgets/tabs/socialplayerstab.h
+++ b/src/gui/widgets/tabs/socialplayerstab.h
@@ -28,6 +28,8 @@
#include "being/being.h"
+#include "enums/simpletypes.h"
+
#include "gui/models/beingslistmodel.h"
#include "utils/gettext.h"
@@ -147,7 +149,7 @@ class SocialPlayersTab final : public SocialTab
if (actorManager)
{
StringVect names;
- actorManager->getPlayerNames(names, false);
+ actorManager->getPlayerNames(names, NpcNames_false);
std::vector<Avatar*>::iterator ai = avatars->begin();
while (ai != avatars->end())
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 4d822afc1..1a36f7a83 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1385,7 +1385,7 @@ void ChatWindow::autoComplete()
if (newName.empty() && actorManager)
{
- actorManager->getPlayerNames(nameList, true);
+ actorManager->getPlayerNames(nameList, NpcNames_true);
newName = autoComplete(nameList, name);
if (!newName.empty() && !startName)
secureChatCommand(newName);
diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp
index 794a21330..248856569 100644
--- a/src/utils/chatutils.cpp
+++ b/src/utils/chatutils.cpp
@@ -139,7 +139,7 @@ void replaceVars(std::string &str)
{
StringVect names;
std::string newStr;
- actorManager->getPlayerNames(names, false);
+ actorManager->getPlayerNames(names, NpcNames_false);
FOR_EACH (StringVectCIter, it, names)
{
if (*it != localPlayer->getName())