crash fix

This commit is contained in:
Yunfan Li
2023-12-17 17:45:43 +08:00
parent 897ee35b4e
commit 30c46b59d0
3 changed files with 9 additions and 2 deletions

View File

@@ -29,6 +29,9 @@ bool StealthTrigger::IsActive()
float distance = 30.f;
Unit* target = AI_VALUE(Unit*, "enemy player target");
if (target && !target->IsInWorld()) {
return false;
}
if (!target)
target = AI_VALUE(Unit*, "grind target");
@@ -76,6 +79,10 @@ bool SprintTrigger::IsActive()
Unit* dps = AI_VALUE(Unit*, "dps target");
Unit* enemyPlayer = AI_VALUE(Unit*, "enemy player target");
if (enemyPlayer && !enemyPlayer->IsInWorld()) {
return false;
}
if (dps)
targeted = (dps == AI_VALUE(Unit*, "current target"));

View File

@@ -15,7 +15,7 @@ class NearestUnitsValue : public ObjectGuidListCalculatedValue
{
public:
NearestUnitsValue(PlayerbotAI* botAI, std::string const name = "nearest units", float range = sPlayerbotAIConfig->sightDistance, bool ignoreLos = false) :
ObjectGuidListCalculatedValue(botAI, name, 1 * 1000), range(range), ignoreLos(ignoreLos) { }
ObjectGuidListCalculatedValue(botAI, name, 1), range(range), ignoreLos(ignoreLos) { }
GuidVector Calculate() override;

View File

@@ -14,7 +14,7 @@ class Unit;
class SnareTargetValue : public UnitCalculatedValue, public Qualified
{
public:
SnareTargetValue(PlayerbotAI* botAI) : UnitCalculatedValue(botAI, "snare target", 1 * 1000) { }
SnareTargetValue(PlayerbotAI* botAI) : UnitCalculatedValue(botAI, "snare target", 1) { }
protected:
Unit* Calculate() override;