From 82be574cdadbede505741805c809f7bb6d056036 Mon Sep 17 00:00:00 2001 From: Yehonal Date: Sat, 16 Sep 2017 19:13:21 +0200 Subject: [PATCH] Core: Step 3 - removed all warnings from core related to #121 Next step: Scripts and extractor tools --- src/game/ArenaSpectator/ArenaSpectator.h | 4 +- src/game/Chat/Channels/Channel.cpp | 10 ++--- src/game/Conditions/ConditionMgr.cpp | 2 + src/game/Entities/Creature/Creature.cpp | 13 +++---- .../Entities/Creature/TemporarySummon.cpp | 2 +- src/game/Entities/Object/Object.cpp | 5 ++- src/game/Entities/Pet/Pet.cpp | 6 ++- src/game/Entities/Player/Player.cpp | 39 ++++++++++--------- src/game/Entities/Unit/StatSystem.cpp | 2 +- src/game/Entities/Unit/Unit.cpp | 26 ++++++------- src/game/Entities/Unit/Unit.h | 5 +-- src/game/Entities/Vehicle/Vehicle.cpp | 4 +- src/game/Groups/Group.cpp | 6 +-- src/game/Handlers/CharacterHandler.cpp | 6 +-- src/game/Handlers/MiscHandler.cpp | 9 +++-- src/game/Handlers/PetHandler.cpp | 5 ++- src/game/Handlers/PetitionsHandler.cpp | 2 +- src/game/Maps/Map.cpp | 4 +- .../EscortMovementGenerator.cpp | 2 +- .../FleeingMovementGenerator.cpp | 4 +- .../MovementGenerators/PathGenerator.cpp | 4 +- .../TargetedMovementGenerator.cpp | 6 +-- src/game/Server/WorldSession.cpp | 20 +++++----- src/game/Server/WorldSocket.cpp | 4 +- src/game/Spells/Auras/SpellAuraEffects.cpp | 15 +++---- src/game/Spells/Auras/SpellAuras.cpp | 2 +- src/game/Spells/Spell.cpp | 10 +++-- src/game/Spells/SpellMgr.cpp | 2 +- src/game/Texts/CreatureTextMgr.cpp | 2 +- src/game/Tickets/TicketMgr.cpp | 2 +- 30 files changed, 116 insertions(+), 107 deletions(-) diff --git a/src/game/ArenaSpectator/ArenaSpectator.h b/src/game/ArenaSpectator/ArenaSpectator.h index 3901c453d..f60cf9d9f 100644 --- a/src/game/ArenaSpectator/ArenaSpectator.h +++ b/src/game/ArenaSpectator/ArenaSpectator.h @@ -205,8 +205,8 @@ namespace ArenaSpectator if (effMask & (1<GetEffect(i)->GetAuraType(); - if (aura->GetEffect(i)->GetAmount() && ((aura->GetSpellInfo()->IsPositive() || targetGUID != aura->GetCasterGUID()) || - at == SPELL_AURA_MECHANIC_IMMUNITY || at == SPELL_AURA_EFFECT_IMMUNITY || at == SPELL_AURA_STATE_IMMUNITY || at == SPELL_AURA_SCHOOL_IMMUNITY || at == SPELL_AURA_DISPEL_IMMUNITY)) + if ((aura->GetEffect(i)->GetAmount() && (aura->GetSpellInfo()->IsPositive() || targetGUID != aura->GetCasterGUID())) || + at == SPELL_AURA_MECHANIC_IMMUNITY || at == SPELL_AURA_EFFECT_IMMUNITY || at == SPELL_AURA_STATE_IMMUNITY || at == SPELL_AURA_SCHOOL_IMMUNITY || at == SPELL_AURA_DISPEL_IMMUNITY) return true; } } diff --git a/src/game/Chat/Channels/Channel.cpp b/src/game/Chat/Channels/Channel.cpp index f4f634c2b..6570d8ca1 100644 --- a/src/game/Chat/Channels/Channel.cpp +++ b/src/game/Chat/Channels/Channel.cpp @@ -19,10 +19,10 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId, _IsSaved(false), _flags(0), _channelId(channelId), + _channelDBId(channelDBId), _teamId(teamId), _ownerGUID(0), _name(name), - _channelDBId(channelDBId), _password("") { // set special flags if built-in channel @@ -382,7 +382,7 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b return; } - if (ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN) || !ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_KICK)) + if ((ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN)) || (!ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_KICK))) { WorldPacket data; MakeNotModerator(&data); @@ -650,8 +650,8 @@ void Channel::SetOwner(Player const* player, std::string const& newname) Player* newp = ObjectAccessor::FindPlayerByName(newname, false); uint64 victim = newp ? newp->GetGUID() : 0; - if (!victim || !IsOn(victim) || newp->GetTeamId() != player->GetTeamId() && - !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) + if (!victim || !IsOn(victim) || (newp->GetTeamId() != player->GetTeamId() && + !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))) { WorldPacket data; MakePlayerNotFound(&data, newname); @@ -791,7 +791,7 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang) { std::string timeStr = secsToTimeString(pinfo.lastSpeakTime + speakDelay - sWorld->GetGameTime()); if (_channelRights.speakMessage.length() > 0) - player->GetSession()->SendNotification(_channelRights.speakMessage.c_str()); + player->GetSession()->SendNotification("%s", _channelRights.speakMessage.c_str()); player->GetSession()->SendNotification("You must wait %s before speaking again.", timeStr.c_str()); return; } diff --git a/src/game/Conditions/ConditionMgr.cpp b/src/game/Conditions/ConditionMgr.cpp index 9b50e65c5..ee334106c 100644 --- a/src/game/Conditions/ConditionMgr.cpp +++ b/src/game/Conditions/ConditionMgr.cpp @@ -235,6 +235,8 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case TYPEID_GAMEOBJECT: condMeets &= object->ToGameObject()->GetDBTableGUIDLow() == ConditionValue3; break; + default: + break; } } } diff --git a/src/game/Entities/Creature/Creature.cpp b/src/game/Entities/Creature/Creature.cpp index cd3beff0e..bece9cf23 100644 --- a/src/game/Entities/Creature/Creature.cpp +++ b/src/game/Entities/Creature/Creature.cpp @@ -154,13 +154,12 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) return true; } -Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(), -lootPickPocketRestoreTime(0), m_groupLootTimer(0), lootingGroupLowGUID(0), -m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemoveTime(0), m_respawnTime(0), m_transportCheckTimer(1000), -m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), -m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), -m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_moveInLineOfSightDisabled(false), m_moveInLineOfSightStrictlyDisabled(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_originalEntry(0), m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureData(NULL), m_waypointID(0), m_path_id(0), m_formation(NULL), _lastDamagedTime(0) +Creature::Creature(bool isWorldObject): Unit(isWorldObject), MovableMapObject(), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0), +m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), +m_transportCheckTimer(1000), lootPickPocketRestoreTime(0), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), +m_DBTableGuid(0), m_equipmentId(0), m_originalEquipmentId(0), m_AlreadyCallAssistance(false), +m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_originalEntry(0), m_moveInLineOfSightDisabled(false), m_moveInLineOfSightStrictlyDisabled(false), +m_homePosition(), m_transportHomePosition(), m_creatureInfo(NULL), m_creatureData(NULL), m_waypointID(0), m_path_id(0), m_formation(NULL), _lastDamagedTime(0) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; diff --git a/src/game/Entities/Creature/TemporarySummon.cpp b/src/game/Entities/Creature/TemporarySummon.cpp index 66e20db66..231ce0d18 100644 --- a/src/game/Entities/Creature/TemporarySummon.cpp +++ b/src/game/Entities/Creature/TemporarySummon.cpp @@ -385,7 +385,7 @@ void Puppet::InitSummon() if (!SetCharmedBy(GetOwner(), CHARM_TYPE_POSSESS)) { if (Player* p = GetOwner()) - sLog->outMisc("Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); + sLog->outMisc("Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap()->GetId(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); else { sLog->outMisc("Puppet::InitSummon (B1)"); diff --git a/src/game/Entities/Object/Object.cpp b/src/game/Entities/Object/Object.cpp index 34fb51849..6ca1f9465 100644 --- a/src/game/Entities/Object/Object.cpp +++ b/src/game/Entities/Object/Object.cpp @@ -315,7 +315,8 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint16 flags) const // 0x08000000 if (unit->m_movementInfo.GetMovementFlags() & MOVEMENTFLAG_SPLINE_ENABLED) { - if (unit->movespline->_Spline().getPoints(true).empty() || (!unit->movespline->_Spline().getPoints(true).empty() && &unit->movespline->_Spline().getPoints(true)[0] == NULL)) + const G3D::Vector3 * p = &unit->movespline->_Spline().getPoints(true)[0]; + if (unit->movespline->_Spline().getPoints(true).empty() || (!unit->movespline->_Spline().getPoints(true).empty() && !p)) const_cast(unit)->DisableSpline(); else Movement::PacketBuilder::WriteCreate(*unit->movespline, *data); @@ -2081,7 +2082,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); diff --git a/src/game/Entities/Pet/Pet.cpp b/src/game/Entities/Pet/Pet.cpp index 1e89b1905..4d064f5af 100644 --- a/src/game/Entities/Pet/Pet.cpp +++ b/src/game/Entities/Pet/Pet.cpp @@ -27,8 +27,8 @@ Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner ? owner->GetGUID() : 0, true), m_usedTalentCount(0), m_removed(false), m_owner(owner), -m_happinessTimer(PET_LOSE_HAPPINES_INTERVAL), m_petRegenTimer(PET_FOCUS_REGEN_INTERVAL), m_petType(type), m_duration(0), -m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL), m_tempspell(0), m_tempspellTarget(NULL), m_tempoldTarget(NULL), m_tempspellIsPositive(false), asynchLoadType(PET_LOAD_DEFAULT) +m_happinessTimer(PET_LOSE_HAPPINES_INTERVAL), m_petType(type), m_duration(0), +m_auraRaidUpdateMask(0), m_loading(false), m_petRegenTimer(PET_FOCUS_REGEN_INTERVAL), m_declinedname(NULL), m_tempspellTarget(NULL), m_tempoldTarget(NULL), m_tempspellIsPositive(false), m_tempspell(0), asynchLoadType(PET_LOAD_DEFAULT) { m_unitTypeMask |= UNIT_MASK_PET; if (type == HUNTER_PET) @@ -493,6 +493,8 @@ void Pet::Update(uint32 diff) break; } + default: + break; } Creature::Update(diff); diff --git a/src/game/Entities/Player/Player.cpp b/src/game/Entities/Player/Player.cpp index 6b135e136..9c9f30459 100644 --- a/src/game/Entities/Player/Player.cpp +++ b/src/game/Entities/Player/Player.cpp @@ -181,6 +181,7 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level { case TEAM_ALLIANCE: SetTaximaskNode(100); break; case TEAM_HORDE: SetTaximaskNode(99); break; + default: break; } // level dependent taxi hubs if (level >= 68) @@ -1023,7 +1024,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (!IsValidGender(createInfo->Gender)) { - sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%hu) - refusing to do so", + sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%u) - refusing to do so", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender); return false; } @@ -2025,7 +2026,7 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) } else if (!IsValidGender(gender)) { - sLog->outError("Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender); + sLog->outError("Player (%u) has incorrect gender (%u), don't build enum.", guid, gender); return false; } @@ -4203,8 +4204,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)) @@ -5756,9 +5757,9 @@ void Player::UpdateDefense() void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply) { - if (modGroup >= BASEMOD_END || modType >= MOD_END) + if (modGroup >= BASEMOD_END) { - sLog->outError("ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!"); + sLog->outError("ERROR in HandleBaseModValue(): non existed BaseModGroup!"); return; } @@ -5787,9 +5788,9 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { - if (modGroup >= BASEMOD_END || modType >= MOD_END) + if (modGroup >= BASEMOD_END) { - sLog->outError("trial to access non existed BaseModGroup or wrong BaseModType!"); + sLog->outError("trial to access non existed BaseModGroup!"); return 0.0f; } @@ -6012,6 +6013,8 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) ApplyCastTimePercentMod(oldVal, false); ApplyCastTimePercentMod(newVal, true); break; + default: + break; } } @@ -17647,7 +17650,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) uint8 Gender = fields[5].GetUInt8(); if (!IsValidGender(Gender)) { - sLog->outError("Player (GUID: %u) has wrong gender (%hu), can't be loaded.", guid, Gender); + sLog->outError("Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, Gender); return false; } @@ -17761,7 +17764,7 @@ 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()))) @@ -23175,7 +23178,7 @@ 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. @@ -24055,14 +24058,14 @@ void Player::SetMover(Unit* target) { if (this != target && target->m_movedByPlayer && target->m_movedByPlayer != target && target->m_movedByPlayer != this) { - sLog->outMisc("Player::SetMover (A1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (A2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (A3) - %u, %u, %u, %u, %u, %u, %u, %u", target->m_movedByPlayer->GetGUIDLow(), target->m_movedByPlayer->GetMapId(), target->m_movedByPlayer->GetInstanceId(), target->m_movedByPlayer->FindMap(), target->m_movedByPlayer->IsInWorld() ? 1 : 0, target->m_movedByPlayer->IsDuringRemoveFromWorld() ? 1 : 0, target->m_movedByPlayer->ToPlayer()->IsBeingTeleported() ? 1 : 0, target->m_movedByPlayer->isBeingLoaded() ? 1 : 0); + sLog->outMisc("Player::SetMover (A1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); + sLog->outMisc("Player::SetMover (A2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); + sLog->outMisc("Player::SetMover (A3) - %u, %u, %u, %u, %u, %u, %u, %u", target->m_movedByPlayer->GetGUIDLow(), target->m_movedByPlayer->GetMapId(), target->m_movedByPlayer->GetInstanceId(), target->m_movedByPlayer->FindMap()->GetId(), target->m_movedByPlayer->IsInWorld() ? 1 : 0, target->m_movedByPlayer->IsDuringRemoveFromWorld() ? 1 : 0, target->m_movedByPlayer->ToPlayer()->IsBeingTeleported() ? 1 : 0, target->m_movedByPlayer->isBeingLoaded() ? 1 : 0); } if (this != target && (!target->IsInWorld() || target->IsDuringRemoveFromWorld() || GetMapId() != target->GetMapId() || GetInstanceId() != target->GetInstanceId())) { - sLog->outMisc("Player::SetMover (B1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (B2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); + sLog->outMisc("Player::SetMover (B1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); + sLog->outMisc("Player::SetMover (B2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); } m_mover->m_movedByPlayer = NULL; m_mover = target; @@ -25346,7 +25349,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) //Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d", movementInfo.pos.GetPositionZ(), GetPositionZ(), movementInfo.fallTime, damage, safe_fall); + sLog->outStaticDebug("FALLDAMAGE mZ=%f z=%f fallTime=%u damage=%u SF=%d", movementInfo.pos.GetPositionZ(), GetPositionZ(), movementInfo.fallTime, damage, safe_fall); #endif } @@ -26716,7 +26719,7 @@ 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() diff --git a/src/game/Entities/Unit/StatSystem.cpp b/src/game/Entities/Unit/StatSystem.cpp index 6800d0cc4..e45e3b83c 100644 --- a/src/game/Entities/Unit/StatSystem.cpp +++ b/src/game/Entities/Unit/StatSystem.cpp @@ -1125,7 +1125,7 @@ bool Guardian::UpdateStats(Stats stat) case STAT_AGILITY: UpdateArmor(); break; case STAT_STAMINA: UpdateMaxHealth(); break; case STAT_INTELLECT: UpdateMaxPower(POWER_MANA); break; - //case STAT_SPIRIT: + case STAT_SPIRIT: break; } return true; diff --git a/src/game/Entities/Unit/Unit.cpp b/src/game/Entities/Unit/Unit.cpp index 43a0ffbe7..87a519d70 100644 --- a/src/game/Entities/Unit/Unit.cpp +++ b/src/game/Entities/Unit/Unit.cpp @@ -149,10 +149,8 @@ _hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo), #endif Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject), m_movedByPlayer(NULL), m_lastSanctuaryTime(0), IsAIEnabled(false), NeedChangeAI(false), -m_ControlledByPlayer(false), m_CreatedByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL), -i_disabledAI(NULL), m_procDeep(0), m_removedAurasCount(0), i_motionMaster(new MotionMaster(this)), m_regenTimer(0), -m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), -m_HostileRefManager(this), m_AutoRepeatFirstCast(false), m_realRace(0), m_race(0) +m_ControlledByPlayer(false), m_CreatedByPlayer(false), movespline(new Movement::MoveSpline()), i_AI(NULL), i_disabledAI(NULL), m_realRace(0), m_race(0), m_AutoRepeatFirstCast(false), m_procDeep(0), m_removedAurasCount(0), +i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this), m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), m_HostileRefManager(this) { #ifdef _MSC_VER #pragma warning(default:4355) @@ -3308,9 +3306,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) } void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant, bool bySelf) -{ - ASSERT(spellType < CURRENT_MAX_SPELL); - +{ //sLog->outDebug(LOG_FILTER_UNITS, "Interrupt spell for unit %u.", GetEntry()); Spell* spell = m_currentSpells[spellType]; if (spell @@ -3431,13 +3427,13 @@ 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()) { @@ -3694,7 +3690,7 @@ void SafeUnitPointer::UnitDeleted() { if (Player* p = defaultValue->ToPlayer()) { - sLog->outMisc("SafeUnitPointer::UnitDeleted (A1) - %u, %u, %u, %u, %u, %u, %u, %u", p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); + sLog->outMisc("SafeUnitPointer::UnitDeleted (A1) - %u, %u, %u, %u, %u, %u, %u, %u", p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap()->GetId(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); if (ptr) sLog->outMisc("SafeUnitPointer::UnitDeleted (A2)"); @@ -3722,7 +3718,7 @@ void Unit::HandleSafeUnitPointersOnDelete(Unit* thisUnit) bool Unit::IsInWater(bool allowAbove) const { const_cast(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 @@ -8154,7 +8150,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 40336: { // On successful melee or ranged attack gain $29471s1 mana and if possible drain $27526s1 mana from the target. - if (this && IsAlive()) + if (IsAlive()) CastSpell(this, 29471, true, castItem, triggeredByAura); if (victim && victim->IsAlive()) CastSpell(victim, 27526, true, castItem, triggeredByAura); @@ -10450,7 +10446,7 @@ 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()); } @@ -11000,6 +10996,8 @@ float Unit::SpellDoneCritChance(Unit const* /*victim*/, SpellInfo const* spellPr case BASE_ATTACK: crit_chance = GetFloatValue(PLAYER_CRIT_PERCENTAGE); break; case OFF_ATTACK: crit_chance = GetFloatValue(PLAYER_OFFHAND_CRIT_PERCENTAGE); break; case RANGED_ATTACK: crit_chance = GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE); break; + default: + break; } } else @@ -18661,8 +18659,8 @@ class AuraMunchingQueue : public BasicEvent } private: - uint64 _targetGUID; Unit& _owner; + uint64 _targetGUID; int32 _basePoints; uint32 _spellId; }; diff --git a/src/game/Entities/Unit/Unit.h b/src/game/Entities/Unit/Unit.h index a2e29fbd5..7f9a8b55b 100644 --- a/src/game/Entities/Unit/Unit.h +++ b/src/game/Entities/Unit/Unit.h @@ -1240,13 +1240,12 @@ struct CharmInfo bool _isAtStay; bool _isFollowing; bool _isReturning; + int32 _forcedSpellId; + uint64 _forcedTargetGUID; float _stayX; float _stayY; float _stayZ; - int32 _forcedSpellId; - uint64 _forcedTargetGUID; - GlobalCooldownMgr _GlobalCooldownMgr; }; diff --git a/src/game/Entities/Vehicle/Vehicle.cpp b/src/game/Entities/Vehicle/Vehicle.cpp index 39cce01f2..25bed66c2 100644 --- a/src/game/Entities/Vehicle/Vehicle.cpp +++ b/src/game/Entities/Vehicle/Vehicle.cpp @@ -395,8 +395,8 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) catch (...) { sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy()!"); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u, this not null: %u", _me ? 1 : 0, this ? 1 : 0); - if (!_me || !this) + sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u", _me ? 1 : 0); + if (!_me) return false; sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is: %u!", _me->IsInWorld()); sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is2: %u!", _me->IsDuringRemoveFromWorld()); diff --git a/src/game/Groups/Group.cpp b/src/game/Groups/Group.cpp index 1f1a16edd..4b79b375a 100644 --- a/src/game/Groups/Group.cpp +++ b/src/game/Groups/Group.cpp @@ -53,7 +53,7 @@ Loot* Roll::getLoot() Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL), m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL), -m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), + m_bfGroup(NULL), m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0), m_masterLooterGuid(0), m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), _difficultyChangePreventionTime(0), _difficultyChangePreventionType(DIFFICULTY_PREVENTION_CHANGE_NONE) { @@ -1354,7 +1354,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) continue; player = ObjectAccessor::FindPlayer(itr->first); - if (!player || allowedMap != NULL && player->FindMap() != allowedMap) + if (!player || (allowedMap != NULL && player->FindMap() != allowedMap)) { --roll->totalNeed; continue; @@ -1418,7 +1418,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, Map* allowedMap) continue; player = ObjectAccessor::FindPlayer(itr->first); - if (!player || allowedMap != NULL && player->FindMap() != allowedMap) + if (!player || (allowedMap != NULL && player->FindMap() != allowedMap)) { --roll->totalGreed; continue; diff --git a/src/game/Handlers/CharacterHandler.cpp b/src/game/Handlers/CharacterHandler.cpp index fb84c48af..576888da2 100644 --- a/src/game/Handlers/CharacterHandler.cpp +++ b/src/game/Handlers/CharacterHandler.cpp @@ -1159,7 +1159,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) { if (!itr->second->GetRecruiterId() && !itr->second->IsARecruiter()) continue; - if (isReferrer && pCurrChar->GetSession()->GetAccountId() == itr->second->GetRecruiterId() || !isReferrer && pCurrChar->GetSession()->GetRecruiterId() == itr->second->GetAccountId()) + if ((isReferrer && pCurrChar->GetSession()->GetAccountId() == itr->second->GetRecruiterId()) || (!isReferrer && pCurrChar->GetSession()->GetRecruiterId() == itr->second->GetAccountId())) { Player * rf = itr->second->GetPlayer(); if (rf != NULL) @@ -2134,8 +2134,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) // xinef: check money bool valid = Player::TeamIdForRace(oldRace) == Player::TeamIdForRace(race); - if (level < 10 && money <= 0 || level > 10 && level <= 30 && money <= 3000000 || level > 30 && level <= 50 && money <= 10000000 || - level > 50 && level <= 70 && money <= 50000000 || level > 70 && money <= 200000000) + if ((level < 10 && money <= 0) || (level > 10 && level <= 30 && money <= 3000000 ) || (level > 30 && level <= 50 && money <= 10000000) || + (level > 50 && level <= 70 && money <= 50000000) || (level > 70 && money <= 200000000)) valid = true; if (!valid) { diff --git a/src/game/Handlers/MiscHandler.cpp b/src/game/Handlers/MiscHandler.cpp index 310b5dde0..f05a34320 100644 --- a/src/game/Handlers/MiscHandler.cpp +++ b/src/game/Handlers/MiscHandler.cpp @@ -414,7 +414,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/) if (uint64 lguid = GetPlayer()->GetLootGUID()) DoLootRelease(lguid); - bool instantLogout = (GetSecurity() >= sWorld->getIntConfig(CONFIG_INSTANT_LOGOUT) || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat()) || GetPlayer()->IsInFlight(); + bool instantLogout = (GetSecurity() >= sWorld->getIntConfig(CONFIG_INSTANT_LOGOUT) || (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->IsInCombat())) || GetPlayer()->IsInFlight(); /// TODO: Possibly add RBAC permission to log out in combat bool canLogoutInCombat = GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); @@ -1654,7 +1654,9 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) return; } - if (!groupGuy->IsAlive() || groupGuy->IsInCombat() || groupGuy->GetVictim() || groupGuy->m_mover != groupGuy || groupGuy->IsNonMeleeSpellCast(true) || !groupGuy->GetMotionMaster()->empty() && groupGuy->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress() || !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false)) + if (!groupGuy->IsAlive() || groupGuy->IsInCombat() || groupGuy->GetVictim() || groupGuy->m_mover != groupGuy || groupGuy->IsNonMeleeSpellCast(true) || (!groupGuy->GetMotionMaster()->empty() && groupGuy->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) + || !groupGuy->movespline->Finalized() || !groupGuy->GetMap()->ToInstanceMap() || !groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript() || groupGuy->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress() + || !groupGuy->Satisfy(sObjectMgr->GetAccessRequirement(groupGuy->GetMap()->GetId(), Difficulty(mode)), groupGuy->GetMap()->GetId(), false)) { _player->SendRaidDifficulty(group != NULL); return; @@ -1678,7 +1680,8 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) if (Player* p = itr->GetSource()) if (p->GetGroup() != group) { - if (!p->IsInWorld() || !p->IsAlive() || p->IsInCombat() || p->GetVictim() || p->m_mover != p || p->IsNonMeleeSpellCast(true) || !p->GetMotionMaster()->empty() && p->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE || !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress()) + if (!p->IsInWorld() || !p->IsAlive() || p->IsInCombat() || p->GetVictim() || p->m_mover != p || p->IsNonMeleeSpellCast(true) || (!p->GetMotionMaster()->empty() && p->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) + || !p->movespline->Finalized() || !p->GetMap()->ToInstanceMap() || !p->GetMap()->ToInstanceMap()->GetInstanceScript() || p->GetMap()->ToInstanceMap()->GetInstanceScript()->IsEncounterInProgress()) { _player->SendRaidDifficulty(group != NULL); return; diff --git a/src/game/Handlers/PetHandler.cpp b/src/game/Handlers/PetHandler.cpp index 09d278a58..722c6a334 100644 --- a/src/game/Handlers/PetHandler.cpp +++ b/src/game/Handlers/PetHandler.cpp @@ -26,11 +26,12 @@ class LoadPetFromDBQueryHolder : public SQLQueryHolder { private: const uint32 m_petNumber; - const uint32 m_diffTime; const bool m_current; + const uint32 m_diffTime; + const std::string m_actionBar; const uint32 m_savedHealth; const uint32 m_savedMana; - const std::string m_actionBar; + public: LoadPetFromDBQueryHolder(uint32 petNumber, bool current, uint32 diffTime, std::string actionBar, uint32 health, uint32 mana) : m_petNumber(petNumber), m_current(current), m_diffTime(diffTime), m_actionBar(actionBar), diff --git a/src/game/Handlers/PetitionsHandler.cpp b/src/game/Handlers/PetitionsHandler.cpp index 60adfb791..c5d40fdfc 100644 --- a/src/game/Handlers/PetitionsHandler.cpp +++ b/src/game/Handlers/PetitionsHandler.cpp @@ -832,7 +832,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recvData) for (SignatureMap::const_iterator itr = signatureCopy.begin(); itr != signatureCopy.end(); ++itr) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId()); + sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), itr->first); #endif arenaTeam->AddMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); } diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index ffae01742..02733b7ae 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -216,8 +216,8 @@ void Map::LoadMapAndVMap(int gx, int gy) Map::Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent) : i_mapEntry(sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId), m_unloadTimer(0), m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE), -m_activeNonPlayersIter(m_activeNonPlayers.end()), _transportsUpdateIter(_transports.end()), -_instanceResetPeriod(0), i_scriptLock(false), _defaultLight(GetDefaultMapLight(id)) +_instanceResetPeriod(0), m_activeNonPlayersIter(m_activeNonPlayers.end()), +_transportsUpdateIter(_transports.end()), i_scriptLock(false), _defaultLight(GetDefaultMapLight(id)) { m_parentMap = (_parent ? _parent : this); for (unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx) diff --git a/src/game/Movement/MovementGenerators/EscortMovementGenerator.cpp b/src/game/Movement/MovementGenerators/EscortMovementGenerator.cpp index e3c6a1e2d..123a24438 100644 --- a/src/game/Movement/MovementGenerators/EscortMovementGenerator.cpp +++ b/src/game/Movement/MovementGenerators/EscortMovementGenerator.cpp @@ -34,7 +34,7 @@ void EscortMovementGenerator::DoInitialize(T* unit) template bool EscortMovementGenerator::DoUpdate(T* unit, uint32 diff) { - if (!&unit) + if (!unit) return false; if (unit->HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED)) diff --git a/src/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index 2247264eb..0962c63aa 100644 --- a/src/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -43,7 +43,7 @@ void FleeingMovementGenerator::_setTargetLocation(T* owner) template bool FleeingMovementGenerator::_getPoint(T* owner, float &x, float &y, float &z) { - if (!&owner) + if (!owner) return false; x = owner->GetPositionX(); @@ -304,7 +304,7 @@ void FleeingMovementGenerator::DoInitialize(T* owner) template<> void FleeingMovementGenerator::_Init(Creature* owner) { - if (!&owner) + if (!owner) return; //owner->SetTargetGuid(ObjectGuid()); diff --git a/src/game/Movement/MovementGenerators/PathGenerator.cpp b/src/game/Movement/MovementGenerators/PathGenerator.cpp index c72e04b87..c42ae417d 100644 --- a/src/game/Movement/MovementGenerators/PathGenerator.cpp +++ b/src/game/Movement/MovementGenerators/PathGenerator.cpp @@ -226,8 +226,8 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con } if (sourceCanSwim) { - if (startPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL) || - endPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL)) + if ((startPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(startPos.x, startPos.y, startPos.z, MAP_ALL_LIQUIDS, NULL)) || + (endPoly == INVALID_POLYREF && LIQUID_MAP_NO_WATER == _sourceUnit->GetBaseMap()->getLiquidStatus(endPos.x, endPos.y, endPos.z, MAP_ALL_LIQUIDS, NULL))) { _type = PATHFIND_NOPATH; return; diff --git a/src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index bd9044ce1..dd5bf4251 100644 --- a/src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -121,7 +121,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool ini Position dest = {x, y, z, 0.0f}; if (GameObject* pillar = ((BattlegroundRV*)bg)->GetPillarAtPosition(&dest)) { - if (pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() == 0 || owner->GetPositionZ() > 31.0f || owner->GetTransGUID() == pillar->GetGUID()) + if ((pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() == 0) || owner->GetPositionZ() > 31.0f || owner->GetTransGUID() == pillar->GetGUID()) { if (pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() == 0) z = std::max(z, 28.28f); @@ -135,7 +135,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool ini init.Launch(); return; } - if (pillar->GetGoState() == GO_STATE_ACTIVE || pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() > 0) + if (pillar->GetGoState() == GO_STATE_ACTIVE || (pillar->GetGoState() == GO_STATE_READY && pillar->ToTransport()->GetPathProgress() > 0)) { Position pos; owner->GetFirstCollisionPositionForTotem(pos, owner->GetExactDist2d(i_target.getTarget()), owner->GetAngle(i_target.getTarget())-owner->GetOrientation(), false); @@ -158,7 +158,7 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T* owner, bool ini if (result) { float maxDist = MELEE_RANGE + owner->GetMeleeReach() + i_target->GetMeleeReach(); - if (!forceDest && (i_path->GetPathType() & PATHFIND_NOPATH || !i_offset && !isPlayerPet && i_target->GetExactDistSq(i_path->GetActualEndPosition().x, i_path->GetActualEndPosition().y, i_path->GetActualEndPosition().z) > maxDist*maxDist)) + if (!forceDest && (i_path->GetPathType() & PATHFIND_NOPATH || (!i_offset && !isPlayerPet && i_target->GetExactDistSq(i_path->GetActualEndPosition().x, i_path->GetActualEndPosition().y, i_path->GetActualEndPosition().z) > maxDist*maxDist))) { lastPathingFailMSTime = World::GetGameTimeMS(); owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(sWorld->GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget()); diff --git a/src/game/Server/WorldSession.cpp b/src/game/Server/WorldSession.cpp index 9619abcfb..883841c0a 100644 --- a/src/game/Server/WorldSession.cpp +++ b/src/game/Server/WorldSession.cpp @@ -84,13 +84,11 @@ bool WorldSessionFilter::Process(WorldPacket* packet) /// WorldSession constructor WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter, bool skipQueue): -m_muteTime(mute_time), m_timeOutTime(0), m_GUIDLow(0), _player(NULL), m_Socket(sock), -_security(sec), _accountId(id), m_expansion(expansion), _logoutTime(0), +m_muteTime(mute_time), m_timeOutTime(0), _lastAuctionListItemsMSTime(0), _lastAuctionListOwnerItemsMSTime(0), m_GUIDLow(0), _player(NULL), m_Socket(sock), +_security(sec), _skipQueue(skipQueue), _accountId(id), m_expansion(expansion), _logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerSave(false), -m_sessionDbcLocale(sWorld->GetDefaultDbcLocale()), -m_sessionDbLocaleIndex(locale), -m_latency(0), m_clientTimeDelay(0), m_TutorialsChanged(false), recruiterId(recruiter), -isRecruiter(isARecruiter), m_currentBankerGUID(0), timeWhoCommandAllowed(0), _lastAuctionListItemsMSTime(0), _lastAuctionListOwnerItemsMSTime(0), _skipQueue(skipQueue) +m_sessionDbcLocale(sWorld->GetDefaultDbcLocale()), m_sessionDbLocaleIndex(locale), +m_latency(0), m_clientTimeDelay(0), m_TutorialsChanged(false), recruiterId(recruiter), isRecruiter(isARecruiter), m_currentBankerGUID(0), timeWhoCommandAllowed(0) { memset(m_Tutorials, 0, sizeof(m_Tutorials)); @@ -298,10 +296,10 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) break; (this->*opHandle.handler)(*packet); break; - //case STATUS_NEVER: - // break; - //case STATUS_UNHANDLED: - // break; + case STATUS_NEVER: + break; + case STATUS_UNHANDLED: + break; } } catch(ByteBufferException &) @@ -873,7 +871,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi) // pussywizard: remade this condition bool canFly = GetPlayer()->m_mover->HasAuraType(SPELL_AURA_FLY) || GetPlayer()->m_mover->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) || - GetPlayer()->m_mover->GetTypeId() == TYPEID_UNIT && GetPlayer()->m_mover->ToCreature()->CanFly() || GetSecurity() > SEC_PLAYER; + (GetPlayer()->m_mover->GetTypeId() == TYPEID_UNIT && GetPlayer()->m_mover->ToCreature()->CanFly()) || GetSecurity() > SEC_PLAYER; REMOVE_VIOLATING_FLAGS(mi->HasMovementFlag(MOVEMENTFLAG_FLYING | MOVEMENTFLAG_CAN_FLY) && !canFly, MOVEMENTFLAG_FLYING | MOVEMENTFLAG_CAN_FLY); diff --git a/src/game/Server/WorldSocket.cpp b/src/game/Server/WorldSocket.cpp index 083a15e34..0e3f05e84 100644 --- a/src/game/Server/WorldSocket.cpp +++ b/src/game/Server/WorldSocket.cpp @@ -957,7 +957,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8 (AUTH_REJECT); SendPacket(packet); - sLog->outError("network", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", address.c_str()); + sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", address.c_str()); return -1; } @@ -967,7 +967,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8 (REALM_LIST_REALM_NOT_FOUND); SendPacket(packet); - sLog->outError("network", "WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.", + sLog->outError("WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.", address.c_str(), realm, realmID); return -1; } diff --git a/src/game/Spells/Auras/SpellAuraEffects.cpp b/src/game/Spells/Auras/SpellAuraEffects.cpp index f3cbe6d6e..b087e819d 100644 --- a/src/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/game/Spells/Auras/SpellAuraEffects.cpp @@ -366,9 +366,9 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= AuraEffect::AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster): m_base(base), m_spellInfo(base->GetSpellInfo()), -m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[effIndex].BasePoints), -m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex), -m_canBeRecalculated(true), m_isPeriodic(false), m_critChance(0), m_oldAmount(0), m_isAuraEnabled(true), m_channelData(NULL) +m_baseAmount(baseAmount ? *baseAmount : m_spellInfo->Effects[effIndex].BasePoints), m_critChance(0), +m_oldAmount(0), m_isAuraEnabled(true), m_channelData(NULL), m_spellmod(NULL), m_periodicTimer(0), m_tickNumber(0), m_effIndex(effIndex), +m_canBeRecalculated(true), m_isPeriodic(false) { CalculatePeriodic(caster, true, false); CalculatePeriodicData(); @@ -540,6 +540,8 @@ int32 AuraEffect::CalculateAmount(Unit* caster) if (GetBase()->GetType() == UNIT_AURA_TYPE) amount = caster->SpellDamageBonusDone(GetBase()->GetUnitOwner(), GetSpellInfo(), amount, SPELL_DIRECT_DAMAGE, 0.0f, 1); break; + default: + break; } amount *= GetBase()->GetStackAmount(); @@ -660,7 +662,6 @@ void AuraEffect::CalculateSpellMod() { m_spellmod = new SpellModifier(GetBase()); m_spellmod->op = SpellModOp(GetMiscValue()); - ASSERT(m_spellmod->op < MAX_SPELLMOD); m_spellmod->type = SpellModType(GetAuraType()); // SpellModType value == spell aura types m_spellmod->spellId = GetId(); @@ -6129,7 +6130,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const // calculate crit chance bool crit = false; - if (crit = roll_chance_f(GetCritChance())) + if ((crit = roll_chance_f(GetCritChance()))) damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target); int32 dmg = damage; @@ -6203,7 +6204,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetBase()->GetStackAmount()); bool crit = false; - if (crit = roll_chance_f(GetCritChance())) + if ((crit = roll_chance_f(GetCritChance()))) damage = Unit::SpellCriticalDamageBonus(caster, m_spellInfo, damage, target); // Calculate armor mitigation @@ -6380,7 +6381,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const } bool crit = false; - if (crit = roll_chance_f(GetCritChance())) + if ((crit = roll_chance_f(GetCritChance()))) damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) diff --git a/src/game/Spells/Auras/SpellAuras.cpp b/src/game/Spells/Auras/SpellAuras.cpp index b2a0a7e71..2f051092a 100644 --- a/src/game/Spells/Auras/SpellAuras.cpp +++ b/src/game/Spells/Auras/SpellAuras.cpp @@ -859,7 +859,7 @@ void Aura::RefreshTimersWithMods() { Unit* caster = GetCaster(); m_maxDuration = CalcMaxDuration(); - if (caster && caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) + if ((caster && caster->HasAuraTypeWithAffectMask(SPELL_AURA_PERIODIC_HASTE, m_spellInfo)) || m_spellInfo->HasAttribute(SPELL_ATTR5_HASTE_AFFECT_DURATION)) m_maxDuration = int32(m_maxDuration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED)); // xinef: we should take ModSpellDuration into account, but none of the spells using this function is affected by contents of ModSpellDuration diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index d6ac62178..29f082562 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -2787,7 +2787,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, 0, m_attackType, m_spellInfo, m_triggeredByAuraSpell); // Xinef: eg. rogue poisions can proc off cheap shot, etc. so this block should be here also // Xinef: ofc count only spells that HIT the target, little hack used to fool the system - if ((procEx & PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT) && caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 && + if (((procEx & PROC_EX_NORMAL_HIT)|PROC_EX_CRITICAL_HIT) && caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->HasAttribute(SPELL_ATTR0_STOP_ATTACK_TARGET) == 0 && m_spellInfo->HasAttribute(SPELL_ATTR4_CANT_TRIGGER_ITEM_SPELLS) == 0 && (m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MELEE || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_RANGED)) caster->ToPlayer()->CastItemCombatSpell(unitTarget, m_attackType, procVictim|PROC_FLAG_TAKEN_DAMAGE, procEx); } @@ -3138,12 +3138,14 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) // trigger linked auras remove/apply // TODO: remove/cleanup this, as this table is not documented and people are doing stupid things with it - if (std::vector const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT)) + if (std::vector const* spellTriggered = sSpellMgr->GetSpellLinked(m_spellInfo->Id + SPELL_LINK_HIT)) { for (std::vector::const_iterator i = spellTriggered->begin(); i != spellTriggered->end(); ++i) - if (*i < 0) + if (*i < 0) { unit->RemoveAurasDueToSpell(-(*i)); - else + } else { unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID()); + } + } } void Spell::DoAllEffectOnTarget(GOTargetInfo* target) diff --git a/src/game/Spells/SpellMgr.cpp b/src/game/Spells/SpellMgr.cpp index 26e669351..f7c76a85d 100644 --- a/src/game/Spells/SpellMgr.cpp +++ b/src/game/Spells/SpellMgr.cpp @@ -5000,7 +5000,7 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectRadiusIndex[1] = 12; spellInfo->EffectImplicitTargetA[2] = TARGET_SRC_CASTER; spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_SRC_AREA_ENTRY; - spellInfo->EffectRadiusIndex[3] = 12; + spellInfo->EffectRadiusIndex[2] = 12; break; // Trial of the Champion, Desecration case 67778: diff --git a/src/game/Texts/CreatureTextMgr.cpp b/src/game/Texts/CreatureTextMgr.cpp index f9d792228..3465859d6 100644 --- a/src/game/Texts/CreatureTextMgr.cpp +++ b/src/game/Texts/CreatureTextMgr.cpp @@ -145,7 +145,7 @@ void CreatureTextMgr::LoadCreatureTexts() ++textCount; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature texts for %u creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime)); + sLog->outString(">> Loaded %u creature texts for %lu creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); } diff --git a/src/game/Tickets/TicketMgr.cpp b/src/game/Tickets/TicketMgr.cpp index 9e17c55d3..ce7c46a5b 100644 --- a/src/game/Tickets/TicketMgr.cpp +++ b/src/game/Tickets/TicketMgr.cpp @@ -20,7 +20,7 @@ inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; } /////////////////////////////////////////////////////////////////////////////////////////////////// // GM ticket -GmTicket::GmTicket() : _id(0), _type(TICKET_TYPE_OPEN), _playerGuid(0), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), +GmTicket::GmTicket() : _id(0), _playerGuid(0), _type(TICKET_TYPE_OPEN), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(0), _lastModifiedTime(0), _closedBy(0), _resolvedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needResponse(false), _needMoreHelp(false) { }