Warnings PR 1: Event warnings and headers (#2106)

# Pull Request

This is the first in a series of PRs intended to eliminate warnings in
the module. The design intent is to eliminate the calling event when not
needed in the body of the function. Based off of SmashingQuasars work.

---

## How to Test the Changes

- Step-by-step instructions to test the change
- Any required setup (e.g. multiple players, bots, specific
configuration)
- Expected behavior and how to verify it

## Complexity & Impact

- Does this change add new decision branches?
    - [x] No
    - [ ] Yes (**explain below**)

- Does this change increase per-bot or per-tick processing?
    - [x] No
    - [ ] Yes (**describe and justify impact**)

- Could this logic scale poorly under load?
    - [x] No
    - [ ] Yes (**explain why**)

---

## Defaults & Configuration

- Does this change modify default bot behavior?
    - [x] No
    - [ ] Yes (**explain why**)

If this introduces more advanced or AI-heavy logic:

- [ ] Lightweight mode remains the default
- [ ] More complex behavior is optional and thereby configurable

---

## AI Assistance

- Was AI assistance (e.g. ChatGPT or similar tools) used while working
on this change?
    - [x] No
    - [ ] Yes (**explain below**)

---

## Final Checklist

- [x] Stability is not compromised
- [x] Performance impact is understood, tested, and acceptable
- [x] Added logic complexity is justified and explained
- [x] Documentation updated if needed

---

## Notes for Reviewers

Anything that significantly improves realism at the cost of stability or
performance should be carefully discussed
before merging.

---------

Co-authored-by: bashermens <31279994+hermensbas@users.noreply.github.com>
This commit is contained in:
Keleborn
2026-02-14 11:55:10 -08:00
committed by GitHub
parent 80aeeda0e8
commit 441f9f7552
185 changed files with 653 additions and 1064 deletions

View File

@@ -6,7 +6,8 @@
#include "Arrow.h"
#include "Map.h"
#include "Playerbots.h"
#include "PlayerbotAI.h"
#include "Group.h"
WorldLocation ArrowFormation::GetLocationInternal()
{

View File

@@ -6,7 +6,9 @@
#include "CcTargetValue.h"
#include "Action.h"
#include "Playerbots.h"
#include "AiObjectContext.h"
#include "Group.h"
#include "PlayerbotAI.h"
#include "ServerFacade.h"
class FindTargetForCcStrategy : public FindTargetStrategy

View File

@@ -4,8 +4,7 @@
*/
#include "CurrentCcTargetValue.h"
#include "Playerbots.h"
#include "PlayerbotAI.h"
class FindCurrentCcTargetStrategy : public FindTargetStrategy
{

View File

@@ -29,7 +29,6 @@ public:
foundHighPriority = true;
return;
}
Unit* victim = attacker->GetVictim();
if (!result || CalcThreatGap(attacker, threatMgr) > CalcThreatGap(result, &result->GetThreatMgr()))
result = attacker;
}
@@ -144,7 +143,7 @@ public:
{
}
void CheckAttacker(Unit* attacker, ThreatMgr* threatMgr) override
void CheckAttacker(Unit* attacker, ThreatMgr*) override
{
if (Group* group = botAI->GetBot()->GetGroup())
{
@@ -195,7 +194,6 @@ public:
}
int32_t GetIntervalLevel(Unit* unit)
{
float time = unit->GetHealth() / dps_;
float dis = unit->GetDistance(botAI->GetBot());
float attackRange =
botAI->IsRanged(botAI->GetBot()) ? sPlayerbotAIConfig.spellDistance : sPlayerbotAIConfig.meleeDistance;
@@ -218,7 +216,7 @@ public:
{
}
void CheckAttacker(Unit* attacker, ThreatMgr* threatMgr) override
void CheckAttacker(Unit* attacker, ThreatMgr*) override
{
if (Group* group = botAI->GetBot()->GetGroup())
{
@@ -276,7 +274,6 @@ public:
}
int32_t GetIntervalLevel(Unit* unit)
{
float time = unit->GetHealth() / dps_;
float dis = unit->GetDistance(botAI->GetBot());
float attackRange =
botAI->IsRanged(botAI->GetBot()) ? sPlayerbotAIConfig.spellDistance : sPlayerbotAIConfig.meleeDistance;
@@ -322,7 +319,7 @@ class FindMaxHpTargetStrategy : public FindTargetStrategy
public:
FindMaxHpTargetStrategy(PlayerbotAI* botAI) : FindTargetStrategy(botAI), maxHealth(0) {}
void CheckAttacker(Unit* attacker, ThreatMgr* threatMgr) override
void CheckAttacker(Unit* attacker, ThreatMgr*) override
{
if (Group* group = botAI->GetBot()->GetGroup())
{

View File

@@ -5,7 +5,7 @@
#include "ItemCountValue.h"
#include "Playerbots.h"
#include "PlayerbotAI.h"
std::vector<Item*> InventoryItemValueBase::Find(std::string const qualifier)
{
@@ -25,9 +25,7 @@ uint32 ItemCountValue::Calculate()
uint32 count = 0;
std::vector<Item*> items = Find(qualifier);
for (Item* item : items)
{
count += item->GetCount();
}
return count;
}

View File

@@ -5,7 +5,6 @@
#include "LastMovementValue.h"
#include "Playerbots.h"
#include "Timer.h"
LastMovement::LastMovement() { clear(); }

View File

@@ -6,7 +6,7 @@
#include "LeastHpTargetValue.h"
#include "AttackersValue.h"
#include "Playerbots.h"
#include "PlayerbotAI.h"
class FindLeastHpTargetStrategy : public FindNonCcTargetStrategy
{

View File

@@ -6,6 +6,7 @@
#ifndef _PLAYERBOT_LOGLEVELVALUE_H
#define _PLAYERBOT_LOGLEVELVALUE_H
#include "LogCommon.h"
#include "Value.h"
class PlayerbotAI;

View File

@@ -8,7 +8,6 @@
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Playerbots.h"
class AnyDeadUnitInObjectRangeCheck
{

View File

@@ -4,8 +4,7 @@
*/
#include "PartyMemberToDispel.h"
#include "Playerbots.h"
#include "PlayerbotAI.h"
class PartyMemberToDispelPredicate : public FindPlayerPredicate, public PlayerbotAIAware
{

View File

@@ -6,8 +6,11 @@
#include "PartyMemberValue.h"
#include "Corpse.h"
#include "Playerbots.h"
#include "Group.h"
#include "PlayerbotAI.h"
#include "ServerFacade.h"
#include "Pet.h"
#include "Spell.h"
Unit* PartyMemberValue::FindPartyMember(std::vector<Player*>* party, FindPlayerPredicate& predicate)
{

View File

@@ -8,7 +8,6 @@
#include "NamedObjectContext.h"
#include "PartyMemberValue.h"
#include "PlayerbotAIConfig.h"
class PlayerbotAI;
class Unit;
@@ -16,8 +15,7 @@ class Unit;
class PartyMemberWithoutItemValue : public PartyMemberValue, public Qualified
{
public:
PartyMemberWithoutItemValue(PlayerbotAI* botAI, std::string const name = "party member without item",
float range = sPlayerbotAIConfig.farDistance)
PartyMemberWithoutItemValue(PlayerbotAI* botAI, std::string const name = "party member without item")
: PartyMemberValue(botAI, name)
{
}

View File

@@ -5,14 +5,15 @@
#include "PossibleRpgTargetsValue.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "AiObjectContext.h"
#include "ObjectGuid.h"
#include "Playerbots.h"
#include "ServerFacade.h"
#include "SharedDefines.h"
#include "NearestGameObjects.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "TravelMgr.h"
std::vector<uint32> PossibleRpgTargetsValue::allowedNpcFlags;
@@ -73,9 +74,15 @@ bool PossibleRpgTargetsValue::AcceptUnit(Unit* unit)
}
TravelTarget* travelTarget = context->GetValue<TravelTarget*>("travel target")->Get();
if (travelTarget && travelTarget->getDestination() &&
travelTarget->getDestination()->getEntry() == unit->GetEntry())
if (
travelTarget != nullptr
&& travelTarget->getDestination()
&& (uint32_t)travelTarget->getDestination()->getEntry() == unit->GetEntry()
)
{
return true;
}
if (urand(1, 100) < 25 && unit->IsFriendlyTo(bot))
return true;

View File

@@ -5,7 +5,8 @@
#include "SnareTargetValue.h"
#include "Playerbots.h"
#include "AiObjectContext.h"
#include "PlayerbotAI.h"
#include "ServerFacade.h"
Unit* SnareTargetValue::Calculate()

View File

@@ -8,7 +8,6 @@
#include "ChatHelper.h"
#include "Playerbots.h"
#include "Vehicle.h"
#include "World.h"
SpellIdValue::SpellIdValue(PlayerbotAI* botAI) : CalculatedValue<uint32>(botAI, "spell id", 20 * 1000) {}

View File

@@ -4,8 +4,12 @@
*/
#include "StatsValues.h"
#include "Playerbots.h"
#include "AiObjectContext.h"
#include "Group.h"
#include "Pet.h"
#include "PlayerbotAIConfig.h"
#include "ServerFacade.h"
#include "Player.h"
Unit* HealthValue::GetTarget()
{
@@ -184,7 +188,7 @@ bool IsInCombatValue::Calculate()
if (member->IsInCombat() &&
ServerFacade::instance().IsDistanceLessOrEqualThan(ServerFacade::instance().GetDistance2d(member, bot),
sPlayerbotAIConfig.reactDistance))
PlayerbotAIConfig::instance().reactDistance))
return true;
}
}

View File

@@ -5,9 +5,10 @@
#include "TankTargetValue.h"
#include "AiObjectContext.h"
#include "AttackersValue.h"
#include "PlayerbotAIConfig.h"
#include "Playerbots.h"
#include "Group.h"
#include "PlayerbotAI.h"
class FindTargetForTankStrategy : public FindNonCcTargetStrategy
{