diff --git a/src/AiFactory.cpp b/src/AiFactory.cpp index 3a29ef79..1928504a 100644 --- a/src/AiFactory.cpp +++ b/src/AiFactory.cpp @@ -673,6 +673,7 @@ Engine* AiFactory::createNonCombatEngine(Player* player, PlayerbotAI* const faca void AiFactory::AddDefaultDeadStrategies(Player* player, PlayerbotAI* const facade, Engine* deadEngine) { + (void)facade; // unused and remove warning deadEngine->addStrategies("dead", "stay", "chat", "default", "follow", nullptr); if (sRandomPlayerbotMgr->IsRandomBot(player) && !player->GetGroup()) diff --git a/src/ChatHelper.cpp b/src/ChatHelper.cpp index ed476011..cec5d696 100644 --- a/src/ChatHelper.cpp +++ b/src/ChatHelper.cpp @@ -259,17 +259,17 @@ ItemIds ChatHelper::parseItems(std::string const text) uint8 pos = 0; while (true) { - uint32 i = text.find("Hitem:", pos); - if (i == -1) + auto i = text.find("Hitem:", pos); + if (i == std::string::npos) break; pos = i + 6; - uint32 endPos = text.find(':', pos); - if (endPos == -1) + auto endPos = text.find(':', pos); + if (endPos == std::string::npos) break; std::string const idC = text.substr(pos, endPos - pos); - uint32 id = atol(idC.c_str()); + auto id = atol(idC.c_str()); pos = endPos; if (id) itemIds.insert(id); @@ -383,6 +383,8 @@ std::string const ChatHelper::FormatChat(ChatMsg chat) return "whisper"; case CHAT_MSG_RAID: return "raid"; + default: + break; } return "unknown"; @@ -406,13 +408,13 @@ GuidVector ChatHelper::parseGameobjects(std::string const text) while (true) { // extract GO guid - uint32 i = text.find("Hfound:", pos); // base H = 11 - if (i == -1) // break if error + auto i = text.find("Hfound:", pos); // base H = 11 + if (i == std::string::npos) // break if error break; pos = i + 7; //start of window in text 11 + 7 = 18 - uint32 endPos = text.find(':', pos); // end of window in text 22 - if (endPos == -1) //break if error + auto endPos = text.find(':', pos); // end of window in text 22 + if (endPos == std::string::npos) //break if error break; std::istringstream stream(text.substr(pos, endPos - pos)); @@ -422,7 +424,7 @@ GuidVector ChatHelper::parseGameobjects(std::string const text) // extract GO entry pos = endPos + 1; endPos = text.find(':', pos); // end of window in text - if (endPos == -1) //break if error + if (endPos == std::string::npos) //break if error break; std::string const entryC = text.substr(pos, endPos - pos); // get std::string const within window i.e entry diff --git a/src/PlayerbotAIBase.cpp b/src/PlayerbotAIBase.cpp index 6e82f7f4..b2d41340 100644 --- a/src/PlayerbotAIBase.cpp +++ b/src/PlayerbotAIBase.cpp @@ -9,10 +9,6 @@ PlayerbotAIBase::PlayerbotAIBase(bool isBotAI) : nextAICheckDelay(0), _isBotAI(i { } -void PlayerbotAIBase::UpdateAIInternal(uint32 elapsed, bool minimal) -{ -} - void PlayerbotAIBase::UpdateAI(uint32 elapsed, bool minimal) { if (nextAICheckDelay > elapsed) diff --git a/src/PlayerbotAIBase.h b/src/PlayerbotAIBase.h index b83cd97e..6fa40d6b 100644 --- a/src/PlayerbotAIBase.h +++ b/src/PlayerbotAIBase.h @@ -17,7 +17,7 @@ class PlayerbotAIBase void IncreaseNextCheckDelay(uint32 delay); void YieldThread(bool delay = false); virtual void UpdateAI(uint32 elapsed, bool minimal = false); - virtual void UpdateAIInternal(uint32 elapsed, bool minimal = false); + virtual void UpdateAIInternal(uint32 elapsed, bool minimal = false) = 0; bool IsActive(); bool IsBotAI() const; diff --git a/src/TravelMgr.cpp b/src/TravelMgr.cpp index 956c21d7..755d1103 100644 --- a/src/TravelMgr.cpp +++ b/src/TravelMgr.cpp @@ -144,16 +144,15 @@ WorldPosition::operator bool() const return GetMapId() != 0 || GetPositionX() != 0 || GetPositionY() != 0 || GetPositionZ() != 0; } -bool WorldPosition::operator==(WorldPosition const& p1) +bool operator==(WorldPosition const& p1, const WorldPosition &p2) { - return GetMapId() == GetMapId() && GetPositionX() == p1.GetPositionX() && - GetPositionY() == p1.GetPositionY() && GetPositionZ() == p1.GetPositionZ() && GetOrientation() == p1.GetOrientation(); + return p1.GetMapId() == p2.GetMapId() && p2.GetPositionX() == p1.GetPositionX() && + p2.GetPositionY() == p1.GetPositionY() && p2.GetPositionZ() == p1.GetPositionZ() && p2.GetOrientation() == p1.GetOrientation(); } -bool WorldPosition::operator!=(WorldPosition const& p1) +bool operator!=(WorldPosition const& p1, const WorldPosition &p2) { - return GetMapId() != GetMapId() || GetPositionX() != p1.GetPositionX() || GetPositionY() != p1.GetPositionY() || - GetPositionZ() != p1.GetPositionZ() || GetOrientation() != p1.GetOrientation(); + return !(p1 == p2); } WorldPosition& WorldPosition::operator+=(WorldPosition const& p1) diff --git a/src/TravelMgr.h b/src/TravelMgr.h index 81cd084c..0b4b2e99 100644 --- a/src/TravelMgr.h +++ b/src/TravelMgr.h @@ -113,9 +113,10 @@ class WorldPosition : public WorldLocation //Getters operator bool() const; - bool operator==(WorldPosition const& p1); - bool operator!=(WorldPosition const& p1); + friend bool operator==(WorldPosition const& p1, const WorldPosition &p2); + friend bool operator!=(WorldPosition const& p1, const WorldPosition &p2); + WorldPosition& operator=(WorldPosition const&) = default; WorldPosition& operator+=(WorldPosition const& p1); WorldPosition& operator-=(WorldPosition const& p1); @@ -515,6 +516,7 @@ class TravelDestination { points = points1; radiusMin = radiusMin1; radiusMax = radiusMax1; } + virtual ~TravelDestination() = default; void addPoint(WorldPosition* pos) { diff --git a/src/strategy/actions/RpgSubActions.h b/src/strategy/actions/RpgSubActions.h index 1ea97c2b..986e660c 100644 --- a/src/strategy/actions/RpgSubActions.h +++ b/src/strategy/actions/RpgSubActions.h @@ -17,7 +17,7 @@ class RpgHelper : public AiObject { public: RpgHelper(PlayerbotAI* botAI) : AiObject(botAI) { } - + virtual ~RpgHelper() = default; void OnExecute(std::string nextAction = "rpg"); void BeforeExecute(); void AfterExecute(bool doDelay = true, bool waitForGroup = false); diff --git a/src/strategy/values/ExpectedLifetimeValue.cpp b/src/strategy/values/ExpectedLifetimeValue.cpp index 1012dd22..5d291f73 100644 --- a/src/strategy/values/ExpectedLifetimeValue.cpp +++ b/src/strategy/values/ExpectedLifetimeValue.cpp @@ -56,7 +56,7 @@ float ExpectedGroupDpsValue::Calculate() basic_gs = (level + 5) * 4; } else if (level <= 70) { basic_gs = (85 + (level - 60) * 3) * 4; - } else if (level <= 80) { + } else { basic_gs = (155 + (level - 70) * 4) * 4; } float gap = mixedGearScore - basic_gs; diff --git a/src/strategy/values/Formations.h b/src/strategy/values/Formations.h index 206dc6e7..0f2aba56 100644 --- a/src/strategy/values/Formations.h +++ b/src/strategy/values/Formations.h @@ -17,7 +17,7 @@ class Formation : public AiNamedObject { public: Formation(PlayerbotAI* botAI, std::string const name) : AiNamedObject(botAI, name) { } - + virtual ~Formation() = default; virtual std::string const GetTargetName() { return ""; } virtual WorldLocation GetLocation() { return NullLocation; } virtual float GetMaxDistance() { return sPlayerbotAIConfig->followDistance; }