diff options
| author | Shauren <shauren.trinity@gmail.com> | 2013-08-01 21:31:11 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2013-08-01 21:31:11 +0200 |
| commit | ac10589edaf16f32105620b579ebae77d9b09f2c (patch) | |
| tree | 8455fa46e10c6659cd942ba42122e8b41a36b4cf /src/server/game | |
| parent | ab6be8c603c9af110392bb7019472d2775dae60d (diff) | |
Core/Misc: Fixed some issues found by Coverity Scan
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/Accounts/RBAC.h | 2 | ||||
| -rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 1 | ||||
| -rw-r--r-- | src/server/game/Handlers/GroupHandler.cpp | 39 | ||||
| -rw-r--r-- | src/server/game/OutdoorPvP/OutdoorPvP.cpp | 6 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 1 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 39 |
6 files changed, 35 insertions, 53 deletions
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h index 35024fc4152..b97ea196a0a 100644 --- a/src/server/game/Accounts/RBAC.h +++ b/src/server/game/Accounts/RBAC.h @@ -119,6 +119,8 @@ class RBACObject RBACObject(uint32 id = 0, std::string const& name = ""):
_id(id), _name(name) { }
+ virtual ~RBACObject() { }
+
/// Gets the Name of the Object
std::string const& GetName() const { return _name; }
/// Gets the Id of the Object
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 306ccc08492..33003de4e6d 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6977,6 +6977,7 @@ void ObjectMgr::LoadPointsOfInterest() uint32 point_id = fields[0].GetUInt32(); PointOfInterest POI; + POI.entry = point_id; POI.x = fields[1].GetFloat(); POI.y = fields[2].GetFloat(); POI.icon = fields[3].GetUInt32(); diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index ff4387a3a70..27ef4960f79 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -729,33 +729,28 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke if (mask & GROUP_UPDATE_FLAG_STATUS) { - if (player) - { - uint16 playerStatus = MEMBER_STATUS_ONLINE; - if (player->IsPvP()) - playerStatus |= MEMBER_STATUS_PVP; + uint16 playerStatus = MEMBER_STATUS_ONLINE; + if (player->IsPvP()) + playerStatus |= MEMBER_STATUS_PVP; - if (!player->IsAlive()) - { - if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) - playerStatus |= MEMBER_STATUS_GHOST; - else - playerStatus |= MEMBER_STATUS_DEAD; - } + if (!player->IsAlive()) + { + if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + playerStatus |= MEMBER_STATUS_GHOST; + else + playerStatus |= MEMBER_STATUS_DEAD; + } - if (player->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) - playerStatus |= MEMBER_STATUS_PVP_FFA; + if (player->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) + playerStatus |= MEMBER_STATUS_PVP_FFA; - if (player->isAFK()) - playerStatus |= MEMBER_STATUS_AFK; + if (player->isAFK()) + playerStatus |= MEMBER_STATUS_AFK; - if (player->isDND()) - playerStatus |= MEMBER_STATUS_DND; + if (player->isDND()) + playerStatus |= MEMBER_STATUS_DND; - *data << uint16(playerStatus); - } - else - *data << uint16(MEMBER_STATUS_OFFLINE); + *data << uint16(playerStatus); } if (mask & GROUP_UPDATE_FLAG_CUR_HP) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 30308c12630..73b5399fa89 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -453,18 +453,14 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed) // creature kills must be notified, even if not inside objective / not outdoor pvp active // player kills only count if active and inside objective if ((groupGuy->IsOutdoorPvPActive() && IsInsideObjective(groupGuy)) || killed->GetTypeId() == TYPEID_UNIT) - { HandleKillImpl(groupGuy, killed); - } } } else { // creature kills must be notified, even if not inside objective / not outdoor pvp active - if (killer && ((killer->IsOutdoorPvPActive() && IsInsideObjective(killer)) || killed->GetTypeId() == TYPEID_UNIT)) - { + if ((killer->IsOutdoorPvPActive() && IsInsideObjective(killer)) || killed->GetTypeId() == TYPEID_UNIT) HandleKillImpl(killer, killed); - } } } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 24a9ab76377..13a6cffeb12 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3120,6 +3120,7 @@ void Spell::cancel() CancelGlobalCooldown(); if (m_caster->GetTypeId() == TYPEID_PLAYER) m_caster->ToPlayer()->RestoreSpellMods(this); + // no break case SPELL_STATE_DELAYED: SendInterrupted(0); SendCastResult(SPELL_FAILED_INTERRUPTED); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 38d31a89e86..e054c91ccc9 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -4214,6 +4214,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) m_caster->CastSpell(unitTarget, spellId2, true); return; } + break; } case SPELLFAMILY_DEATHKNIGHT: { @@ -4650,25 +4651,11 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) return; uint32 go_id = m_spellInfo->Effects[effIndex].MiscValue; + uint8 slot = m_spellInfo->Effects[effIndex].Effect - SPELL_EFFECT_SUMMON_OBJECT_SLOT1; - uint8 slot = 0; - switch (m_spellInfo->Effects[effIndex].Effect) - { - case SPELL_EFFECT_SUMMON_OBJECT_SLOT1: slot = 0; break; - case SPELL_EFFECT_SUMMON_OBJECT_SLOT2: slot = 1; break; - case SPELL_EFFECT_SUMMON_OBJECT_SLOT3: slot = 2; break; - case SPELL_EFFECT_SUMMON_OBJECT_SLOT4: slot = 3; break; - default: return; - } - - uint64 guid = m_caster->m_ObjectSlot[slot]; - if (guid != 0) + if (uint64 guid = m_caster->m_ObjectSlot[slot]) { - GameObject* obj = NULL; - if (m_caster) - obj = m_caster->GetMap()->GetGameObject(guid); - - if (obj) + if (GameObject* obj = m_caster->GetMap()->GetGameObject(guid)) { // Recast case - null spell id to make auras not be removed on object remove from world if (m_spellInfo->Id == obj->GetSpellId()) @@ -4678,7 +4665,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) m_caster->m_ObjectSlot[slot] = 0; } - GameObject* pGameObj = new GameObject; + GameObject* go = new GameObject(); float x, y, z; // If dest location if present @@ -4689,24 +4676,24 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Map* map = m_caster->GetMap(); - if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, + if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { - delete pGameObj; + delete go; return; } //pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()); int32 duration = m_spellInfo->GetDuration(); - pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0); - pGameObj->SetSpellId(m_spellInfo->Id); - m_caster->AddGameObject(pGameObj); + go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0); + go->SetSpellId(m_spellInfo->Id); + m_caster->AddGameObject(go); - ExecuteLogEffectSummonObject(effIndex, pGameObj); + ExecuteLogEffectSummonObject(effIndex, go); - map->AddToMap(pGameObj); + map->AddToMap(go); - m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID(); + m_caster->m_ObjectSlot[slot] = go->GetGUID(); } void Spell::EffectResurrect(SpellEffIndex effIndex) |
