summaryrefslogtreecommitdiff
path: root/src/playerrelations.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-26 16:07:54 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-26 16:07:54 +0100
commit5afe88df2538274859a162ffd63ed52118e80c19 (patch)
treeb610dfd58dc748fd63f49565b2a43eea2316714f /src/playerrelations.cpp
parent73ba2a95f5bd4a0dd09af52d5864800be2b0a4c6 (diff)
downloadmana-5afe88df2538274859a162ffd63ed52118e80c19.tar.gz
mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.bz2
mana-5afe88df2538274859a162ffd63ed52118e80c19.tar.xz
mana-5afe88df2538274859a162ffd63ed52118e80c19.zip
Apply C++11 fixits
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
Diffstat (limited to 'src/playerrelations.cpp')
-rw-r--r--src/playerrelations.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 47bc1913..f65b1fc7 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -40,26 +40,26 @@
class PlayerConfSerialiser : public ConfigurationListManager<std::pair<std::string, PlayerRelation *>,
std::map<std::string, PlayerRelation *> *>
{
- virtual ConfigurationObject *writeConfigItem(std::pair<std::string, PlayerRelation *> value,
- ConfigurationObject *cobj)
+ ConfigurationObject *writeConfigItem(std::pair<std::string, PlayerRelation *> value,
+ ConfigurationObject *cobj) override
{
if (!value.second)
- return NULL;
+ return nullptr;
cobj->setValue(NAME, value.first);
cobj->setValue(RELATION, toString(value.second->mRelation));
return cobj;
}
- virtual std::map<std::string, PlayerRelation *> *
+ std::map<std::string, PlayerRelation *> *
readConfigItem(ConfigurationObject *cobj,
- std::map<std::string, PlayerRelation *> *container)
+ std::map<std::string, PlayerRelation *> *container) override
{
std::string name = cobj->getValue(NAME, "");
if (name.empty())
return container;
- std::map<std::string, PlayerRelation *>::iterator it =
+ auto it =
(*container).find(name);
if (it != (*container).end())
{
@@ -89,7 +89,7 @@ PlayerRelation::PlayerRelation(Relation relation)
PlayerRelationsManager::PlayerRelationsManager() :
mPersistIgnores(false),
mDefaultPermissions(PlayerRelation::DEFAULT),
- mIgnoreStrategy(0)
+ mIgnoreStrategy(nullptr)
{
}
@@ -187,7 +187,7 @@ unsigned int PlayerRelationsManager::checkPermissionSilently(
const std::string &playerName,
unsigned int flags)
{
- PlayerRelation *r = 0;
+ PlayerRelation *r = nullptr;
std::map<std::string, PlayerRelation *>::const_iterator it =
mRelations.find(playerName);
@@ -247,9 +247,9 @@ bool PlayerRelationsManager::hasPermission(const std::string &name,
void PlayerRelationsManager::setRelation(const std::string &playerName,
PlayerRelation::Relation relation)
{
- PlayerRelation *r = 0;
+ PlayerRelation *r = nullptr;
- std::map<std::string, PlayerRelation *>::iterator it =
+ auto it =
mRelations.find(playerName);
if (it != mRelations.end())
r = it->second;
@@ -263,9 +263,9 @@ void PlayerRelationsManager::setRelation(const std::string &playerName,
std::vector<std::string> * PlayerRelationsManager::getPlayers() const
{
- std::vector<std::string> *retval = new std::vector<std::string>();
+ auto *retval = new std::vector<std::string>();
- for (std::map<std::string, PlayerRelation *>::const_iterator it = mRelations.begin(); it != mRelations.end(); it++)
+ for (auto it = mRelations.begin(); it != mRelations.end(); it++)
if (it->second)
retval->push_back(it->first);
@@ -276,7 +276,7 @@ std::vector<std::string> * PlayerRelationsManager::getPlayers() const
void PlayerRelationsManager::removePlayer(const std::string &name)
{
- std::map<std::string, PlayerRelation *>::iterator it =
+ auto it =
mRelations.find(name);
if (it != mRelations.end())
{
@@ -291,7 +291,7 @@ void PlayerRelationsManager::removePlayer(const std::string &name)
PlayerRelation::Relation PlayerRelationsManager::getRelation(const std::string &name) const
{
- std::map<std::string, PlayerRelation *>::const_iterator it = mRelations.find(name);
+ auto it = mRelations.find(name);
if (it != mRelations.end())
return it->second->mRelation;
@@ -328,7 +328,7 @@ public:
mShortName = PLAYER_IGNORE_STRATEGY_NOP;
}
- virtual void ignore(Being *being, unsigned int flags)
+ void ignore(Being *being, unsigned int flags) override
{
}
};
@@ -342,7 +342,7 @@ public:
mShortName = "dotdotdot";
}
- virtual void ignore(Being *being, unsigned int flags)
+ void ignore(Being *being, unsigned int flags) override
{
being->setSpeech("...", 500);
}
@@ -358,7 +358,7 @@ public:
mShortName = "blinkname";
}
- virtual void ignore(Being *being, unsigned int flags)
+ void ignore(Being *being, unsigned int flags) override
{
being->flashName(200);
}