V547 Expression 'm_deathState != CORPSE' is always false. Creature.cpp 668

V730 Not all members of a class are initialized inside the constructor. Consider inspecting: isStatic. ObjectMgr.h 95
V595 The 'target' pointer was utilized before it was verified against nullptr. Check lines: 2097, 2114. AIInterface.cpp 2097
V523 The 'then' statement is equivalent to the 'else' statement. AIInterface.cpp 2438 @aaron02
V547 Expression 'm_deathState != CORPSE' is always false. Pet.cpp 613
V781 The value of the 'faction' variable is checked after it was used. Perhaps there is a mistake in program logic. Check lines: 11412, 11416. Player.cpp 11412
This commit is contained in:
Zyres
2023-07-08 19:02:03 +02:00
parent afc5e9072f
commit e41385d6b1
4 changed files with 13 additions and 18 deletions

View File

@@ -94,7 +94,7 @@ struct TrainerSpell
{
TrainerSpell() : castSpell(nullptr), castRealSpell(nullptr), learnSpell(nullptr), deleteSpell(0),
requiredLevel(0), requiredSkillLine(0), requiredSkillLineValue(0), isPrimaryProfession(false),
cost(0)
cost(0), isStatic(0)
{
for (uint8_t i = 0; i < 3; ++i)
requiredSpell[i] = 0;

View File

@@ -2093,6 +2093,9 @@ bool AIInterface::isValidAssistTarget(Unit* target)
if (getUnit() == target)
return true;
if (target == nullptr)
return false;
// can't assist unattackable units
if (target->hasUnitStateFlag(UNIT_STATE_UNATTACKABLE))
return false;
@@ -2111,7 +2114,7 @@ bool AIInterface::isValidAssistTarget(Unit* target)
#ifdef FT_VEHICLES
// can't assist own vehicle or passenger
if (target && getUnit()->getVehicle())
if (getUnit()->getVehicle())
{
if (getUnit()->isOnVehicle(target))
return false;
@@ -2434,8 +2437,9 @@ void AIInterface::justEnteredCombat(Unit* pUnit)
{
if (!isEngaged() && getUnit()->getThreatManager().canHaveThreatList())
engagementStart(pUnit);
else // maybe add more here this part down is for petAI
engagementStart(pUnit);
// Zyres: this looks pretty wrong - fix it if needed otherwise everything sill start engagement @aaron02
// else // maybe add more here this part down is for petAI
// engagementStart(pUnit);
}
void AIInterface::engagementStart(Unit* target)

View File

@@ -603,22 +603,13 @@ void Pet::Update(unsigned long time_passed)
case DEAD:
{
if (m_respawnTime <= now)
{
respawn();
}
}
break;
} break;
case CORPSE:
{
if (m_deathState != CORPSE)
break;
if (m_corpseRemoveTime <= now)
{
OnRemoveCorpse();
}
}
break;
} break;
default:
break;
}

View File

@@ -11409,11 +11409,11 @@ Standing Player::getReputationRankFromStanding(int32_t value)
void Player::setFactionAtWar(uint32_t faction, bool set)
{
FactionReputation* factionReputation = m_reputationByListId[faction];
if (!factionReputation)
if (faction >= 128)
return;
if (faction >= 128)
FactionReputation* factionReputation = m_reputationByListId[faction];
if (!factionReputation)
return;
if (getReputationRankFromStanding(factionReputation->standing) <= STANDING_HOSTILE && !set)