Skip to content
Permalink
Browse files

Server/Misc: Fix Static Analysis Issues.

Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information
AriDEV committed Feb 11, 2020
1 parent 540cad3 commit dc64b16927a42ac8546a0ec849ed3d1a540c706d
Showing with 143 additions and 143 deletions.
  1. +2 −2 src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
  2. +1 −1 src/server/game/Battlegrounds/Battleground.cpp
  3. +1 −1 src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
  4. +1 −1 src/server/game/Conditions/ConditionMgr.cpp
  5. +22 −22 src/server/game/Entities/Creature/Creature.cpp
  6. +6 −6 src/server/game/Entities/Creature/TemporarySummon.cpp
  7. +5 −5 src/server/game/Entities/Pet/Pet.cpp
  8. +12 −12 src/server/game/Entities/Player/Player.cpp
  9. +1 −1 src/server/game/Entities/Player/Player.h
  10. +10 −10 src/server/game/Entities/Unit/Unit.cpp
  11. +4 −4 src/server/game/Entities/Unit/Unit.h
  12. +1 −1 src/server/game/Handlers/CharacterHandler.cpp
  13. +1 −1 src/server/game/Handlers/MiscHandler.cpp
  14. +1 −1 src/server/game/Handlers/PetHandler.cpp
  15. +1 −1 src/server/game/Scripting/MapScripts.cpp
  16. +1 −1 src/server/game/Spells/Auras/SpellAuraEffects.cpp
  17. +1 −1 src/server/game/Spells/Spell.cpp
  18. +2 −2 src/server/game/Spells/SpellEffects.cpp
  19. +4 −4 src/server/scripts/Commands/cs_npc.cpp
  20. +1 −1 src/server/scripts/Commands/cs_pet.cpp
  21. +1 −1 src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp
  22. +2 −2 src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp
  23. +10 −10 src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp
  24. +12 −12 src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp
  25. +1 −1 src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp
  26. +2 −2 src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp
  27. +2 −2 src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp
  28. +1 −1 src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp
  29. +1 −1 src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp
  30. +2 −2 src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
  31. +1 −1 src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp
  32. +2 −2 src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp
  33. +1 −1 src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
  34. +1 −1 src/server/scripts/Northrend/zone_grizzly_hills.cpp
  35. +2 −2 src/server/scripts/Northrend/zone_zuldrak.cpp
  36. +4 −4 src/server/scripts/Outland/BlackTemple/boss_illidan.cpp
  37. +1 −1 src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_hydross_the_unstable.cpp
  38. +4 −4 src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp
  39. +3 −3 src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warbringer_omrogg.cpp
  40. +1 −1 src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp
  41. +1 −1 src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp
  42. +1 −1 src/server/scripts/Outland/TempestKeep/Mechanar/boss_pathaleon_the_calculator.cpp
  43. +1 −1 src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp
  44. +1 −1 src/server/scripts/Outland/zone_blades_edge_mountains.cpp
  45. +1 −1 src/server/scripts/Outland/zone_shadowmoon_valley.cpp
  46. +2 −2 src/server/scripts/Spells/spell_generic.cpp
  47. +1 −1 src/server/scripts/Spells/spell_item.cpp
  48. +3 −3 src/server/scripts/World/npcs_special.cpp
@@ -249,7 +249,7 @@ void npc_escortAI::UpdateAI(uint32 diff)

if (m_bCanInstantRespawn)
{
me->setDeathState(JUST_DIED);
me->setDeathState(DeathState::JUST_DIED);
me->Respawn();
}
else
@@ -290,7 +290,7 @@ void npc_escortAI::UpdateAI(uint32 diff)

if (m_bCanInstantRespawn)
{
me->setDeathState(JUST_DIED);
me->setDeathState(DeathState::JUST_DIED);
me->Respawn();
}
else
@@ -1728,7 +1728,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float

if (Creature* creature = AddCreature(entry, type, team, x, y, z, o))
{
creature->setDeathState(DEAD);
creature->setDeathState(DeathState::DEAD);
creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID());
// aura
/// @todo Fix display here
@@ -311,7 +311,7 @@ Creature* BattlegroundAV::AddAVCreature(uint16 cinfoid, uint16 type)
//else spawndist will be 15, so creatures move maximum=10
//creature->SetDefaultMovementType(RANDOM_MOTION_TYPE);
creature->GetMotionMaster()->Initialize();
creature->setDeathState(JUST_DIED);
creature->setDeathState(DeathState::JUST_DIED);
creature->Respawn();
/// @todo find a way to add a motionmaster without killing the creature (i
//just copied this code from a gm-command
@@ -1888,7 +1888,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_DRUNKENSTATE:
{
if (cond->ConditionValue1 > DRUNKEN_SMASHED)
if (cond->ConditionValue1 >= MAX_DRUNKEN)
{
SF_LOG_ERROR("sql.sql", "DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1);
return false;
@@ -221,7 +221,7 @@ void Creature::DisappearAndDie()
//SetVisibility(VISIBILITY_OFF);
//ObjectAccessor::UpdateObjectVisibility(this);
if (IsAlive())
setDeathState(JUST_DIED);
setDeathState(DeathState::JUST_DIED);
RemoveCorpse(false);
}

@@ -241,11 +241,11 @@ void Creature::SearchFormation()

void Creature::RemoveCorpse(bool setSpawnTime)
{
if (getDeathState() != CORPSE)
if (getDeathState() != DeathState::CORPSE)
return;

m_corpseRemoveTime = time(NULL);
setDeathState(DEAD);
setDeathState(DeathState::DEAD);
RemoveAllAuras();
UpdateObjectVisibility();
loot.clear();
@@ -466,15 +466,15 @@ void Creature::Update(uint32 diff)

switch (m_deathState)
{
case JUST_RESPAWNED:
case DeathState::JUST_RESPAWNED:
// Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
SF_LOG_ERROR("entities.unit", "Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
break;
case JUST_DIED:
case DeathState::JUST_DIED:
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
SF_LOG_ERROR("entities.unit", "Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
break;
case DEAD:
case DeathState::DEAD:
{
time_t now = time(NULL);
if (m_respawnTime <= now)
@@ -499,11 +499,11 @@ void Creature::Update(uint32 diff)
}
break;
}
case CORPSE:
case DeathState::CORPSE:
{
Unit::Update(diff);
// deathstate changed on spells update, prevent problems
if (m_deathState != CORPSE)
if (m_deathState != DeathState::CORPSE)
break;

if (m_groupLootTimer && lootingGroupLowGUID)
@@ -525,7 +525,7 @@ void Creature::Update(uint32 diff)
}
break;
}
case ALIVE:
case DeathState::ALIVE:
{
Unit::Update(diff);

@@ -1238,12 +1238,12 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
m_respawnradius = data->spawndist;

m_respawnDelay = data->spawntimesecs;
m_deathState = ALIVE;
m_deathState = DeathState::ALIVE;

m_respawnTime = GetMap()->GetCreatureRespawnTime(m_DBTableGuid);
if (m_respawnTime) // respawn on Update
{
m_deathState = DEAD;
m_deathState = DeathState::DEAD;
if (CanFly())
{
float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, false);
@@ -1277,7 +1277,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
SetMaxPower(POWER_MANA, 0);
}

SetHealth(m_deathState == ALIVE ? curhealth : 0);
SetHealth(m_deathState == DeathState::ALIVE ? curhealth : 0);

// checked at creature_template loading
m_defaultMovementType = MovementGeneratorType(data->movementType);
@@ -1464,7 +1464,7 @@ void Creature::setDeathState(DeathState s)
{
Unit::setDeathState(s);

if (s == JUST_DIED)
if (s == DeathState::JUST_DIED)
{
m_corpseRemoveTime = time(NULL) + m_corpseDelay;
m_respawnTime = time(NULL) + m_respawnDelay + m_corpseDelay;
@@ -1496,9 +1496,9 @@ void Creature::setDeathState(DeathState s)
if ((CanFly() || IsFlying()))
i_motionMaster.MoveFall();

Unit::setDeathState(CORPSE);
Unit::setDeathState(DeathState::CORPSE);
}
else if (s == JUST_RESPAWNED)
else if (s == DeathState::JUST_RESPAWNED)
{
//if (IsPet())
// setActive(true);
@@ -1516,7 +1516,7 @@ void Creature::setDeathState(DeathState s)
Motion_Initialize();
//if (GetCreatureData() && GetPhaseMask() != GetCreatureData()->phaseMask)
// SetPhaseMask(GetCreatureData()->phaseMask, false);
Unit::setDeathState(ALIVE);
Unit::setDeathState(DeathState::ALIVE);
}
}

@@ -1527,14 +1527,14 @@ void Creature::Respawn(bool force)
if (force)
{
if (IsAlive())
setDeathState(JUST_DIED);
else if (getDeathState() != CORPSE)
setDeathState(CORPSE);
setDeathState(DeathState::JUST_DIED);
else if (getDeathState() != DeathState::CORPSE)
setDeathState(DeathState::CORPSE);
}

RemoveCorpse(false);

if (getDeathState() == DEAD)
if (getDeathState() == DeathState::DEAD)
{
if (m_DBTableGuid)
GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
@@ -1551,7 +1551,7 @@ void Creature::Respawn(bool force)
CreatureTemplate const* cinfo = GetCreatureTemplate();
SelectLevel(cinfo);

setDeathState(JUST_RESPAWNED);
setDeathState(DeathState::JUST_RESPAWNED);

uint32 displayID = GetNativeDisplayId();
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
@@ -1590,7 +1590,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn)
}

if (IsAlive())
setDeathState(JUST_DIED);
setDeathState(DeathState::JUST_DIED);

RemoveCorpse(false);
}
@@ -47,7 +47,7 @@ void TempSummon::Update(uint32 diff)
{
Creature::Update(diff);

if (m_deathState == DEAD)
if (m_deathState == DeathState::DEAD)
{
UnSummon();
return;
@@ -87,7 +87,7 @@ void TempSummon::Update(uint32 diff)

case TEMPSUMMON_CORPSE_TIMED_DESPAWN:
{
if (m_deathState == CORPSE)
if (m_deathState == DeathState::CORPSE)
{
if (m_timer <= diff)
{
@@ -102,7 +102,7 @@ void TempSummon::Update(uint32 diff)
case TEMPSUMMON_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE || m_deathState == DEAD)
if (m_deathState == DeathState::CORPSE || m_deathState == DeathState::DEAD)
{
UnSummon();
return;
@@ -112,7 +112,7 @@ void TempSummon::Update(uint32 diff)
}
case TEMPSUMMON_DEAD_DESPAWN:
{
if (m_deathState == DEAD)
if (m_deathState == DeathState::DEAD)
{
UnSummon();
return;
@@ -122,7 +122,7 @@ void TempSummon::Update(uint32 diff)
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE || m_deathState == DEAD)
if (m_deathState == DeathState::CORPSE || m_deathState == DeathState::DEAD)
{
UnSummon();
return;
@@ -145,7 +145,7 @@ void TempSummon::Update(uint32 diff)
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == DEAD)
if (m_deathState == DeathState::DEAD)
{
UnSummon();
return;
@@ -253,7 +253,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
uint32 savedhealth = fields[10].GetUInt32();
uint32 savedmana = fields[11].GetUInt32();
if (!savedhealth && getPetType() == HUNTER_PET)
setDeathState(JUST_DIED);
setDeathState(DeathState::JUST_DIED);
else
{
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
@@ -506,7 +506,7 @@ void Pet::DeleteFromDB(uint32 guidlow)
void Pet::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState
{
Creature::setDeathState(s);
if (getDeathState() == CORPSE)
if (getDeathState() == DeathState::CORPSE)
{
if (getPetType() == HUNTER_PET)
{
@@ -516,7 +516,7 @@ void Pet::setDeathState(DeathState s) // overwrite virtual
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
}
else if (getDeathState() == ALIVE)
else if (getDeathState() == DeathState::ALIVE)
{
//RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
CastPetAuras(true);
@@ -533,7 +533,7 @@ void Pet::Update(uint32 diff)

switch (m_deathState)
{
case CORPSE:
case DeathState::CORPSE:
{
if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(NULL))
{
@@ -542,7 +542,7 @@ void Pet::Update(uint32 diff)
}
break;
}
case ALIVE:
case DeathState::ALIVE:
{
// unsummon pet that lost owner
Player* owner = GetOwner();
@@ -1526,18 +1526,18 @@ void Player::HandleSobering()
DrunkenState Player::GetDrunkenstateByValue(uint8 value)
{
if (value >= 90)
return DRUNKEN_SMASHED;
return DrunkenState::DRUNKEN_SMASHED;
if (value >= 50)
return DRUNKEN_DRUNK;
return DrunkenState::DRUNKEN_DRUNK;
if (value)
return DRUNKEN_TIPSY;
return DRUNKEN_SOBER;
return DrunkenState::DRUNKEN_TIPSY;
return DrunkenState::DRUNKEN_SOBER;
}

void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/)
{
bool isSobering = newDrunkValue < GetDrunkValue();
uint32 oldDrunkenState = Player::GetDrunkenstateByValue(GetDrunkValue());
DrunkenState oldDrunkenState = Player::GetDrunkenstateByValue(GetDrunkValue());
if (newDrunkValue > 100)
newDrunkValue = 100;

@@ -1551,7 +1551,7 @@ void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/)
else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkValue)
m_invisibilityDetect.DelFlag(INVISIBILITY_DRUNK);

uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
DrunkenState newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
SetByteValue(PLAYER_FIELD_ARENA_FACTION, 1, newDrunkValue);
UpdateObjectVisibility();

@@ -1806,7 +1806,7 @@ void Player::Update(uint32 p_time)
RegenerateAll();
}

if (m_deathState == JUST_DIED)
if (m_deathState == DeathState::JUST_DIED)
KillPlayer();

if (m_nextSave > 0)
@@ -1909,7 +1909,7 @@ void Player::setDeathState(DeathState s)

bool cur = IsAlive();

if (s == JUST_DIED)
if (s == DeathState::JUST_DIED)
{
if (!cur)
{
@@ -1944,7 +1944,7 @@ void Player::setDeathState(DeathState s)
Unit::setDeathState(s);

// restore resurrection spell id for player after aura remove
if (s == JUST_DIED && cur && ressSpellId)
if (s == DeathState::JUST_DIED && cur && ressSpellId)
SetUInt32Value(PLAYER_FIELD_SELF_RES_SPELL, ressSpellId);

if (IsAlive() && !cur)
@@ -5378,7 +5378,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
if (GetSession()->IsARecruiter() || (GetSession()->GetRecruiterId() != 0))
SetFlag(OBJECT_FIELD_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND);

setDeathState(ALIVE);
setDeathState(DeathState::ALIVE);

SetWaterWalking(false, true);
if (!HasUnitState(UNIT_STATE_STUNNED))
@@ -5448,7 +5448,7 @@ void Player::KillPlayer()

StopMirrorTimers(); //disable timers(bars)

setDeathState(CORPSE);
setDeathState(DeathState::CORPSE);
//SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP);

SetUInt32Value(OBJECT_FIELD_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
_LoadGlyphAuras();
// add ghost flag (must be after aura load: PLAYER_FLAGS_GHOST set in aura)
if (HasFlag(PLAYER_FIELD_PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
m_deathState = DEAD;
m_deathState = DeathState::DEAD;

// after spell load, learn rewarded spell if need also
_LoadQuestStatus(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_QUEST_STATUS));
@@ -543,7 +543,7 @@ struct EnchantDuration
typedef std::list<EnchantDuration> EnchantDurationList;
typedef std::list<Item*> ItemDurationList;

enum DrunkenState
enum class DrunkenState
{
DRUNKEN_SOBER = 0,
DRUNKEN_TIPSY = 1,

0 comments on commit dc64b16

Please sign in to comment.
You can’t perform that action at this time.