mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Merge pull request #250 from yuan227301/opt_warning
[optimization] Fixed several compilation warnings
This commit is contained in:
@@ -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())
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user