Skip to content

Commit

Permalink
Fix sonar checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed May 23, 2022
1 parent 2119c70 commit 131b036
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 88 deletions.
10 changes: 4 additions & 6 deletions src/creatures/monsters/monsters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,13 +1453,11 @@ MonsterType* Monsters::getMonsterType(const std::string& name)
{
std::string lowerCaseName = asLowerCaseString(name);
if (auto it = monsters.find(lowerCaseName);
it != monsters.end())
it != monsters.end()
// We will only return the MonsterType if it match the exact name of the monster
&& it->first.find(lowerCaseName) != it->first.npos)
{
// We will only return the MonsterType if it match the exact name of the monster
if ((it->first.find(lowerCaseName)) != it->first.npos)
{
return it->second;
}
return it->second;
}
SPDLOG_ERROR("[Monsters::getMonsterType] - Monster with name {} not exist", lowerCaseName);
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/monsters/monsters.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class MonsterType

public:
MonsterType() = default;
explicit MonsterType(const std::string initName) : name(initName), typeName(initName), nameDescription(initName) {};
explicit MonsterType(const std::string &initName) : name(initName), typeName(initName), nameDescription(initName) {};

// non-copyable
MonsterType(const MonsterType&) = delete;
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/npcs/npcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class NpcType

public:
NpcType() = default;
explicit NpcType(const std::string initName) : name(initName), typeName(initName), nameDescription(initName) {};
explicit NpcType(const std::string &initName) : name(initName), typeName(initName), nameDescription(initName) {};

// non-copyable
NpcType(const NpcType&) = delete;
Expand Down
95 changes: 30 additions & 65 deletions src/protobuf/appearances.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions src/protobuf/appearances.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 131b036

Please sign in to comment.