Build/Clang: fixed 96 warnings + improved code readability

This commit is contained in:
ShinDarth
2016-08-16 23:21:38 +02:00
parent 9802678689
commit a4589f71d5
29 changed files with 134 additions and 63 deletions

View File

@@ -2093,7 +2093,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
summon->SetHomePosition(pos);
summon->InitStats(duration);
AddToMap(summon->ToCreature(), (IS_PLAYER_GUID(summon->GetOwnerGUID()) || summoner && summoner->GetTransport()));
AddToMap(summon->ToCreature(), (IS_PLAYER_GUID(summon->GetOwnerGUID()) || (summoner && summoner->GetTransport())));
summon->InitSummon();
//ObjectAccessor::UpdateObjectVisibility(summon);

View File

@@ -4200,8 +4200,8 @@ void Player::removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporar
continue;
// pussywizard: don't understand why whole skill is removed when just single spell from it is removed
if (_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL && pSkill->categoryId != SKILL_CATEGORY_CLASS || // pussywizard: don't unlearn class skills
(pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->max_value == 0)
if ((_spell_idx->second->learnOnGetSkill == ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL && pSkill->categoryId != SKILL_CATEGORY_CLASS) || // pussywizard: don't unlearn class skills
((pSkill->id == SKILL_LOCKPICKING || pSkill->id == SKILL_RUNEFORGING) && _spell_idx->second->max_value == 0))
{
// not reset skills for professions and racial abilities
if ((pSkill->categoryId == SKILL_CATEGORY_SECONDARY || pSkill->categoryId == SKILL_CATEGORY_PROFESSION) && (IsProfessionSkill(pSkill->id) || _spell_idx->second->racemask != 0))
@@ -17494,7 +17494,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
// pussywizard: group changed difficulty when player was offline, teleport to the enterance of new difficulty
if (mapEntry && (mapEntry->IsNonRaidDungeon() && dungeonDiff != GetDungeonDifficulty() || mapEntry->IsRaid() && raidDiff != GetRaidDifficulty()))
if (mapEntry && ((mapEntry->IsNonRaidDungeon() && dungeonDiff != GetDungeonDifficulty()) ||
(mapEntry->IsRaid() && raidDiff != GetRaidDifficulty())))
{
bool fixed = false;
if (uint32 destInstId = sInstanceSaveMgr->PlayerGetDestinationInstanceId(this, mapId, GetDifficulty(mapEntry->IsRaid())))
@@ -22840,7 +22841,9 @@ void Player::ApplyEquipCooldown(Item* pItem)
// xinef: dont apply equip cooldown if spell on item has insignificant cooldown
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (spellData.SpellCooldown <= 3000 && spellData.SpellCategoryCooldown <= 3000 && (!spellInfo || spellInfo->RecoveryTime <= 3000 && spellInfo->CategoryRecoveryTime <= 3000))
if (spellData.SpellCooldown <= 3000 &&
spellData.SpellCategoryCooldown <= 3000 &&
(!spellInfo || (spellInfo->RecoveryTime <= 3000 && spellInfo->CategoryRecoveryTime <= 3000)))
continue;
// Don't replace longer cooldowns by equip cooldown if we have any.
@@ -26371,7 +26374,10 @@ uint8 Player::GetMostPointsTalentTree() const
bool Player::IsHealerTalentSpec() const
{
uint8 tree = GetMostPointsTalentTree();
return (getClass() == CLASS_DRUID && tree == 2 || getClass() == CLASS_PALADIN && tree == 0 || getClass() == CLASS_PRIEST && tree <= 1 || getClass() == CLASS_SHAMAN && tree == 2);
return ((getClass() == CLASS_DRUID && tree == 2) ||
(getClass() == CLASS_PALADIN && tree == 0) ||
(getClass() == CLASS_PRIEST && tree <= 1) ||
(getClass() == CLASS_SHAMAN && tree == 2));
}
void Player::ResetTimeSync()

View File

@@ -3379,13 +3379,16 @@ bool Unit::isInAccessiblePlaceFor(Creature const* c) const
else if (c->GetMapId() == 631) // Icecrown Citadel
{
// if static transport doesn't match - return false
if (c->GetTransport() != this->GetTransport() && (c->GetTransport() && c->GetTransport()->IsStaticTransport() || this->GetTransport() && this->GetTransport()->IsStaticTransport()))
if (c->GetTransport() != this->GetTransport() &&
((c->GetTransport() && c->GetTransport()->IsStaticTransport()) ||
(this->GetTransport() && this->GetTransport()->IsStaticTransport())))
return false;
// special handling for ICC (map 631), for non-flying pets in Gunship Battle, for trash npcs this is done via CanAIAttack
if (IS_PLAYER_GUID(c->GetOwnerGUID()) && !c->CanFly())
{
if (c->GetTransport() && !this->GetTransport() || !c->GetTransport() && this->GetTransport())
if ((c->GetTransport() && !this->GetTransport()) ||
(!c->GetTransport() && this->GetTransport()))
return false;
if (this->GetTransport())
{
@@ -3670,7 +3673,7 @@ void Unit::HandleSafeUnitPointersOnDelete(Unit* thisUnit)
bool Unit::IsInWater(bool allowAbove) const
{
const_cast<Unit*>(this)->UpdateEnvironmentIfNeeded(1);
return m_last_isinwater_status || allowAbove && m_last_islittleabovewater_status;
return m_last_isinwater_status || (allowAbove && m_last_islittleabovewater_status);
}
bool Unit::IsUnderWater() const
@@ -10385,7 +10388,8 @@ float Unit::SpellPctDamageModsDone(Unit* victim, SpellInfo const* spellProto, Da
// Merciless Combat
if ((*i)->GetSpellInfo()->SpellIconID == 2656)
{
if( spellProto && spellProto->SpellFamilyFlags[0] & 0x2 || spellProto->SpellFamilyFlags[1] & 0x2 )
if (spellProto &&
((spellProto->SpellFamilyFlags[0] & 0x2) || (spellProto->SpellFamilyFlags[1] & 0x2)))
if (!victim->HealthAbovePct(35))
AddPct(DoneTotalMod, (*i)->GetAmount());
}

View File

@@ -2379,7 +2379,13 @@ class Unit : public WorldObject
// pussywizard:
// MMaps
std::map<uint64, MMapTargetData> m_targetsNotAcceptable;
bool isTargetNotAcceptableByMMaps(uint64 guid, uint32 currTime, const Position* t = NULL) const { std::map<uint64, MMapTargetData>::const_iterator itr = m_targetsNotAcceptable.find(guid); if (itr != m_targetsNotAcceptable.end() && (itr->second._endTime >= currTime || t && !itr->second.PosChanged(*this, *t))) return true; return false; }
bool isTargetNotAcceptableByMMaps(uint64 guid, uint32 currTime, const Position* t = NULL) const {
std::map<uint64, MMapTargetData>::const_iterator itr = m_targetsNotAcceptable.find(guid);
if ((itr != m_targetsNotAcceptable.end() && (itr->second._endTime >= currTime)) ||
(t && !itr->second.PosChanged(*this, *t)))
return true;
return false;
}
uint32 m_mmapNotAcceptableStartTime;
// Safe mover
std::set<SafeUnitPointer*> SafeUnitPointerSet;