aboutsummaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorSpp <none@none>2010-04-19 17:03:10 +0200
committerSpp <none@none>2010-04-19 17:03:10 +0200
commitbe01821050dd30ff65e89b347d528efb20aba028 (patch)
tree6d33e686bf1c5d664a7104a208a4e057c6337b1e /src/game
parentf74e969a069646eca6227bdede974223c07e9c94 (diff)
More warning removal (Some code modifications and cleanup when needed)
--HG-- branch : trunk
Diffstat (limited to 'src/game')
-rw-r--r--src/game/BattleGroundAV.cpp5
-rw-r--r--src/game/BattleGroundHandler.cpp4
-rw-r--r--src/game/BattleGroundSA.cpp2
-rw-r--r--src/game/CreatureEventAI.cpp5
-rw-r--r--src/game/FleeingMovementGenerator.cpp2
-rw-r--r--src/game/Group.cpp2
-rw-r--r--src/game/GuildHandler.cpp2
-rw-r--r--src/game/Level3.cpp4
-rw-r--r--src/game/Map.cpp2
-rw-r--r--src/game/MapInstanced.cpp8
-rw-r--r--src/game/ObjectAccessor.cpp8
-rw-r--r--src/game/ObjectMgr.cpp11
-rw-r--r--src/game/OutdoorPvPHP.cpp4
-rw-r--r--src/game/OutdoorPvPTF.cpp4
-rw-r--r--src/game/OutdoorPvPZM.cpp4
-rw-r--r--src/game/Player.cpp19
-rw-r--r--src/game/ScriptedCreature.cpp6
-rw-r--r--src/game/Spell.cpp11
-rw-r--r--src/game/SpellAuraEffects.cpp13
-rw-r--r--src/game/SpellAuras.cpp9
-rw-r--r--src/game/StatSystem.cpp6
-rw-r--r--src/game/TemporarySummon.cpp8
-rw-r--r--src/game/Unit.cpp23
-rw-r--r--src/game/WaypointMovementGenerator.cpp2
24 files changed, 94 insertions, 70 deletions
diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp
index 8c7277bdbd8..04faa776a9f 100644
--- a/src/game/BattleGroundAV.cpp
+++ b/src/game/BattleGroundAV.cpp
@@ -1099,7 +1099,9 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
for (uint8 i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED)
- if (entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]))
+ {
+ entry = sWorldSafeLocsStore.LookupEntry(BG_AV_GraveyardIds[i]);
+ if (entry)
{
dist = (entry->x - x)*(entry->x - x)+(entry->y - y)*(entry->y - y);
if (dist < minDist)
@@ -1108,6 +1110,7 @@ WorldSafeLocsEntry const* BattleGroundAV::GetClosestGraveYard(Player* player)
pGraveyard = entry;
}
}
+ }
return pGraveyard;
}
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp
index 828c71bee4c..44d8c2c7ee7 100644
--- a/src/game/BattleGroundHandler.cpp
+++ b/src/game/BattleGroundHandler.cpp
@@ -106,7 +106,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
if (instanceId)
bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId);
- if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
+ if (!bg)
+ bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
+ if (!bg)
return;
// expected bracket entry
diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp
index d11076bab4a..04eb9b3b567 100644
--- a/src/game/BattleGroundSA.cpp
+++ b/src/game/BattleGroundSA.cpp
@@ -488,7 +488,7 @@ void BattleGroundSA::DestroyGate(uint32 i, Player* pl)
if (g->GetGOValue()->building.health == 0)
{
GateStatus[i] = BG_SA_GATE_DESTROYED;
- uint32 uws;
+ uint32 uws = 0;
switch(i)
{
case 0:
diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp
index 9971dbdc937..a8aa99b74f0 100644
--- a/src/game/CreatureEventAI.cpp
+++ b/src/game/CreatureEventAI.cpp
@@ -374,9 +374,10 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target = owner;
}
}
- else if ((target = me->getVictim()))
+ else
{
- if (target->GetTypeId() != TYPEID_PLAYER)
+ target = me->getVictim();
+ if (target && target->GetTypeId() != TYPEID_PLAYER)
if (Unit* owner = target->GetOwner())
if (owner->GetTypeId() == TYPEID_PLAYER)
target = owner;
diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp
index 3f7c5cb7134..490fe034fd7 100644
--- a/src/game/FleeingMovementGenerator.cpp
+++ b/src/game/FleeingMovementGenerator.cpp
@@ -77,7 +77,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z)
y = owner.GetPositionY();
z = owner.GetPositionZ();
- float temp_x, temp_y, angle;
+ float temp_x, temp_y, angle = 0;
const Map * _map = owner.GetBaseMap();
//primitive path-finding
for (uint8 i = 0; i < 18; ++i)
diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 5bb9ab28145..488649b2e78 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -913,7 +913,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
uint8 maxresul = 0;
uint64 maxguid = (*roll->playerVote.begin()).first;
Player *player;
- RollVote rollvote;
+ RollVote rollvote = NOT_VALID;
Roll::PlayerVote::iterator itr;
for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp
index 48901452cb4..6803fe63a86 100644
--- a/src/game/GuildHandler.cpp
+++ b/src/game/GuildHandler.cpp
@@ -972,7 +972,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data)
uint8 BankTab, BankTabSlot, AutoStore;
uint8 PlayerSlot = NULL_SLOT;
uint8 PlayerBag = NULL_BAG;
- uint8 BankTabDst, BankTabSlotDst, unk2;
+ uint8 BankTabDst = 0, BankTabSlotDst = 0, unk2;
uint8 ToChar = 1;
uint32 ItemEntry, unk1;
uint32 AutoStoreCount = 0;
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 79affaca6bf..3d5c6d7a9d8 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -6902,13 +6902,13 @@ bool ChatHandler::HandleServerSetClosedCommand(const char *args)
{
std::string arg = args;
- if (args == "on")
+ if (strncmp(args, "on", 3) == 0)
{
SendSysMessage(LANG_WORLD_CLOSED);
sWorld.SetClosed(true);
return true;
}
- if (args == "off")
+ else if (strncmp(args, "off", 4) == 0)
{
SendSysMessage(LANG_WORLD_OPENED);
sWorld.SetClosed(false);
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index f069d2d6fe4..2f73fb2ca16 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -2628,7 +2628,7 @@ void InstanceMap::CreateInstanceData(bool load)
{
Field* fields = result->Fetch();
const char* data = fields[0].GetString();
- if (data && data != "")
+ if (data && (strncmp(data, "", 1) == 0))
{
sLog.outDebug("Loading instance data for `%s` with id %u", objmgr.GetScriptName(i_script_id), i_InstanceId);
i_data->Load(data);
diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp
index 3fe5d1b8b0b..0736bfa6fb3 100644
--- a/src/game/MapInstanced.cpp
+++ b/src/game/MapInstanced.cpp
@@ -150,8 +150,12 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
InstanceGroupBind *groupBind = NULL;
Group *group = player->GetGroup();
// use the player's difficulty setting (it may not be the same as the group's)
- if (group && (groupBind = group->GetBoundInstance(this)))
- pSave = groupBind->save;
+ if (group)
+ {
+ groupBind = group->GetBoundInstance(this);
+ if (groupBind)
+ pSave = groupBind->save;
+ }
}
if (pSave)
{
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index d4de7d6515e..9a76f78f209 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -252,7 +252,7 @@ void ObjectAccessor::AddCorpsesToGrid(GridPair const& gridpair, GridType& grid,
}
}
-Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
+Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool /*insignia*/)
{
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
if (!corpse)
@@ -266,7 +266,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
DEBUG_LOG("Deleting Corpse and spawning bones.");
- Map* map = corpse->FindMap();
+ //Map* map = corpse->FindMap();
// remove corpse from player_guid -> corpse map
RemoveCorpse(corpse);
@@ -285,6 +285,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
delete corpse;
return NULL;
+ /*
Corpse* bones = NULL;
// create the bones only if the map and the grid is loaded at the corpse's location
// ignore bones creating option in case insignia
@@ -323,9 +324,10 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
delete corpse;
return bones;
+ */
}
-void ObjectAccessor::Update(uint32 diff)
+void ObjectAccessor::Update(uint32 /*diff*/)
{
UpdateDataMapType update_players;
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 0090f6dd6b2..0ce50659fb1 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -3392,7 +3392,7 @@ void ObjectMgr::LoadArenaTeams()
do
{
- Field *fields = result->Fetch();
+ //Field *fields = result->Fetch();
bar.step();
++count;
@@ -5308,7 +5308,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team)
{
bool found = false;
- float dist;
+ float dist = 10000;
uint32 id = 0;
for (uint32 i = 1; i < sTaxiNodesStore.GetNumRows(); ++i)
@@ -5394,7 +5394,8 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt
CreatureInfo const *mount_info = GetCreatureTemplate(mount_entry);
if (mount_info)
{
- if (! (mount_id = mount_info->GetRandomValidModelId()))
+ mount_id = mount_info->GetRandomValidModelId();
+ if (!mount_id)
{
sLog.outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry);
return false;
@@ -5539,12 +5540,12 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
// at corpse map
bool foundNear = false;
- float distNear;
+ float distNear = 10000;
WorldSafeLocsEntry const* entryNear = NULL;
// at entrance map for corpse map
bool foundEntr = false;
- float distEntr;
+ float distEntr = 10000;
WorldSafeLocsEntry const* entryEntr = NULL;
// some where other
diff --git a/src/game/OutdoorPvPHP.cpp b/src/game/OutdoorPvPHP.cpp
index b15c85a5936..f4f73d015ce 100644
--- a/src/game/OutdoorPvPHP.cpp
+++ b/src/game/OutdoorPvPHP.cpp
@@ -113,8 +113,8 @@ void OutdoorPvPHP::HandlePlayerLeaveZone(Player * plr, uint32 zone)
bool OutdoorPvPHP::Update(uint32 diff)
{
- bool changed = false;
- if (changed = OutdoorPvP::Update(diff))
+ bool changed = OutdoorPvP::Update(diff);
+ if (changed)
{
if (m_AllianceTowersControlled == 3)
TeamApplyBuff(TEAM_ALLIANCE, AllianceBuff, HordeBuff);
diff --git a/src/game/OutdoorPvPTF.cpp b/src/game/OutdoorPvPTF.cpp
index ee9d6a4a651..1d8b60da1d0 100644
--- a/src/game/OutdoorPvPTF.cpp
+++ b/src/game/OutdoorPvPTF.cpp
@@ -120,9 +120,9 @@ void OPvPCapturePointTF::HandlePlayerLeave(Player *plr)
bool OutdoorPvPTF::Update(uint32 diff)
{
- bool changed = false;
+ bool changed = OutdoorPvP::Update(diff);
- if (changed = OutdoorPvP::Update(diff))
+ if (changed)
{
if (m_AllianceTowersControlled == TF_TOWER_NUM)
{
diff --git a/src/game/OutdoorPvPZM.cpp b/src/game/OutdoorPvPZM.cpp
index ca7543ff1b2..fb548816c3a 100644
--- a/src/game/OutdoorPvPZM.cpp
+++ b/src/game/OutdoorPvPZM.cpp
@@ -126,8 +126,8 @@ void OPvPCapturePointZM_Beacon::SendChangePhase()
bool OutdoorPvPZM::Update(uint32 diff)
{
- bool changed = false;
- if (changed = OutdoorPvP::Update(diff))
+ bool changed = OutdoorPvP::Update(diff);
+ if (changed)
{
if (m_AllianceTowersControlled == ZM_NUM_BEACONS)
m_GraveYard->SetBeaconState(ALLIANCE);
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 7a287a3dc4b..4405da3b7ef 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -1600,7 +1600,8 @@ bool Player::BuildEnumData(QueryResult_AutoPtr result, WorldPacket * p_data)
if (!enchantId)
continue;
- if ((enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId)))
+ enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
+ if (enchant)
break;
}
@@ -7262,7 +7263,8 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
// If set dpsMod in ScalingStatValue use it for min (70% from average), max (130% from average) damage
if (ssv)
{
- if ((extraDPS = ssv->getDPSMod(proto->ScalingStatValue)))
+ extraDPS = ssv->getDPSMod(proto->ScalingStatValue);
+ if (extraDPS)
{
float average = extraDPS * proto->Delay / 1000.0f;
minDamage = 0.7f * average;
@@ -12172,7 +12174,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
{
uint8 msg;
ItemPosCountVec sDest;
- uint16 eDest;
+ uint16 eDest = 0;
if (IsInventoryPos(dst))
msg = CanStoreItem(dstbag, dstslot, sDest, pSrcItem, false);
else if (IsBankPos (dst))
@@ -12216,7 +12218,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
}
// impossible merge/fill, do real swap
- uint8 msg;
+ uint8 msg = EQUIP_ERR_OK;
// check src->dest move possibility
ItemPosCountVec sDest;
@@ -20707,11 +20709,8 @@ void Player::resetSpells(bool myClassOnly)
if (!clsEntry)
return;
family = clsEntry->spellfamily;
- }
- for (PlayerSpellMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
- {
- if (myClassOnly)
+ for (PlayerSpellMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first);
if (!spellInfo)
@@ -20738,8 +20737,10 @@ void Player::resetSpells(bool myClassOnly)
if (!SpellMgr::IsSpellValid(spellInfo,this,false))
continue;
}
- removeSpell(iter->first,false,false); // only iter->first can be accessed, object by iter->second can be deleted already
}
+ else
+ for (PlayerSpellMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
+ removeSpell(iter->first,false,false); // only iter->first can be accessed, object by iter->second can be deleted already
learnDefaultSpells();
learnQuestRewardedSpells();
diff --git a/src/game/ScriptedCreature.cpp b/src/game/ScriptedCreature.cpp
index 1dc8934a511..1a2060f330c 100644
--- a/src/game/ScriptedCreature.cpp
+++ b/src/game/ScriptedCreature.cpp
@@ -709,12 +709,14 @@ void LoadOverridenSQLData()
GameObjectInfo *goInfo;
// Sunwell Plateau : Kalecgos : Spectral Rift
- if (goInfo = GOBJECT(187055))
+ goInfo = GOBJECT(187055);
+ if (goInfo)
if (goInfo->type == GAMEOBJECT_TYPE_GOOBER)
goInfo->goober.lockId = 57; // need LOCKTYPE_QUICK_OPEN
// Naxxramas : Sapphiron Birth
- if (goInfo = GOBJECT(181356))
+ goInfo = GOBJECT(181356);
+ if (goInfo)
if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
goInfo->trap.radius = 50;
}
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 8a50bbda609..f432d73767b 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1335,7 +1335,8 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
}
// Get Data Needed for Diminishing Returns, some effects may have multiple auras, so this must be done on spell hit, not aura add
- if (m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo,m_triggeredByAuraSpell))
+ m_diminishGroup = GetDiminishingReturnsGroupForSpell(m_spellInfo,m_triggeredByAuraSpell);
+ if (m_diminishGroup)
{
m_diminishLevel = unit->GetDiminishing(m_diminishGroup);
DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup);
@@ -1372,8 +1373,9 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
if (m_originalCaster)
{
- if (m_spellAura = Aura::TryCreate(aurSpellInfo, effectMask, unit,
- m_originalCaster,(aurSpellInfo == m_spellInfo)? &m_currentBasePoints[0] : &basePoints[0], m_CastItem))
+ m_spellAura = Aura::TryCreate(aurSpellInfo, effectMask, unit,
+ m_originalCaster,(aurSpellInfo == m_spellInfo)? &m_currentBasePoints[0] : &basePoints[0], m_CastItem);
+ if (m_spellAura)
{
// Now Reduce spell duration using data received at spell hit
int32 duration = m_spellAura->GetMaxDuration();
@@ -4584,7 +4586,8 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_targets.getTargetMask() == TARGET_FLAG_SELF &&
m_spellInfo->EffectImplicitTargetA[1] == TARGET_UNIT_TARGET_ENEMY)
{
- if (target = m_caster->GetUnit(*m_caster, m_caster->ToPlayer()->GetSelection()))
+ target = m_caster->GetUnit(*m_caster, m_caster->ToPlayer()->GetSelection());
+ if (target)
m_targets.setUnitTarget(target);
else
return SPELL_FAILED_BAD_TARGETS;
diff --git a/src/game/SpellAuraEffects.cpp b/src/game/SpellAuraEffects.cpp
index 38e819f6021..cb417e50804 100644
--- a/src/game/SpellAuraEffects.cpp
+++ b/src/game/SpellAuraEffects.cpp
@@ -504,15 +504,18 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
AuraEffect const* pAurEff;
// Borrowed Time
- if (pAurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_PRIEST, 2899, 1))
+ pAurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_PRIEST, 2899, 1);
+ if (pAurEff)
bonus += (float)pAurEff->GetAmount() / 100.0f;
// Twin Disciplines
- if (pAurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID()))
+ pAurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_PRIEST, 0x400000, 0, 0, caster->GetGUID());
+ if (pAurEff)
bonus += (float)pAurEff->GetAmount() / 100.0f;
// Focused Power
- if (pAurEff = caster->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_PRIEST, 2210, 2))
+ pAurEff = caster->GetAuraEffect(SPELL_AURA_MOD_HEALING_DONE_PERCENT, SPELLFAMILY_PRIEST, 2210, 2);
+ if (pAurEff)
bonus += (float)pAurEff->GetAmount() / 100.0f;
DoneActualBenefit = caster->SpellBaseHealingBonus(GetSpellSchoolMask(GetSpellProto())) * bonus;
@@ -2053,7 +2056,7 @@ void AuraEffect::TriggerSpell(Unit * target, Unit * caster) const
if (target->GetPower(POWER_MANA) >= 10)
{
target->ModifyPower(POWER_MANA, -10);
- target->SendEnergizeSpellLog(caster, 27746, -10, POWER_MANA);
+ target->SendEnergizeSpellLog(caster, 27746, 10, POWER_MANA);
}
else
target->RemoveAurasDueToSpell(27746);
@@ -3039,7 +3042,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const * aurApp, uint8 mode,
}
else
{
- uint32 model_id;
+ uint32 model_id = 0;
if (uint32 modelid = ci->GetRandomValidModelId())
model_id = modelid; // Will use the default model here
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 1828a3ec37f..eddbb230b16 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -557,9 +557,12 @@ void Aura::UpdateOwner(uint32 diff, WorldObject * owner)
Spell * modSpell = NULL;
Player * modOwner = NULL;
if (caster)
- if ((modOwner = caster->GetSpellModOwner())
- && (modSpell = modOwner->FindCurrentSpellBySpellId(GetId())))
- modOwner->SetSpellModTakingSpell(modSpell, true);
+ {
+ modOwner = caster->GetSpellModOwner();
+ modSpell = modOwner->FindCurrentSpellBySpellId(GetId());
+ if (modOwner && modSpell)
+ modOwner->SetSpellModTakingSpell(modSpell, true);
+ }
Update(diff, caster);
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp
index 0b7698369f1..7bc3877afc0 100644
--- a/src/game/StatSystem.cpp
+++ b/src/game/StatSystem.cpp
@@ -937,13 +937,15 @@ bool Guardian::UpdateStats(Stats stat)
// Ravenous Dead
AuraEffect const *aurEff;
// Check just if owner has Ravenous Dead since it's effect is not an aura
- if (aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0))
+ aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
+ if (aurEff)
{
SpellEntry const* sProto = aurEff->GetSpellProto(); // Then get the SpellProto and add the dummy effect value
mod += mod * (sProto->EffectBasePoints[1] / 100.0f); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
- if (aurEff = owner->GetAuraEffect(58686, 0))
+ aurEff = owner->GetAuraEffect(58686, 0);
+ if (aurEff)
mod += (aurEff->GetAmount() / 100.0f); // Glyph of the Ghoul adds a flat value to the scale mod
value += float(owner->GetStat(stat)) * mod;
}
diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp
index 8005a6cb37d..11652460fc5 100644
--- a/src/game/TemporarySummon.cpp
+++ b/src/game/TemporarySummon.cpp
@@ -249,16 +249,10 @@ void TempSummon::RemoveFromWorld()
return;
if (m_Properties)
- {
if (uint32 slot = m_Properties->Slot)
- {
if (Unit* owner = GetSummoner())
- {
- if (owner->m_SummonSlot[slot] = GetGUID())
+ if (owner->m_SummonSlot[slot] == GetGUID())
owner->m_SummonSlot[slot] = 0;
- }
- }
- }
//if (GetOwnerGUID())
// sLog.outError("Unit %u has owner guid when removed from world", GetEntry());
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 397a6ffccc5..566112eacd3 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3631,8 +3631,8 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo
}
bool auraStateFound = false;
- AuraState auraState;
- if (auraState = GetSpellAuraState(aura->GetSpellProto()))
+ AuraState auraState = GetSpellAuraState(aura->GetSpellProto());
+ if (auraState)
{
bool canBreak = false;
// Get mask of all aurastates from remaining auras
@@ -5950,7 +5950,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if ((*i)->GetEffIndex() != 0)
continue;
basepoints0 = int32((*i)->GetAmount());
- if (target = GetGuardianPet())
+ target = GetGuardianPet();
+ if (target)
{
// regen mana for pet
CastCustomSpell(target,54607,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
@@ -12111,10 +12112,10 @@ Unit* Creature::SelectVictim()
const AuraEffectList& tauntAuras = GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT);
if (!tauntAuras.empty())
{
- Unit* caster;
+ Unit* caster = tauntAuras.back()->GetCaster();
// The last taunt aura caster is alive an we are happy to attack him
- if ((caster = tauntAuras.back()->GetCaster()) && caster->isAlive())
+ if (caster && caster->isAlive())
return getVictim();
else if (tauntAuras.size() > 1)
{
@@ -12126,8 +12127,8 @@ Unit* Creature::SelectVictim()
do
{
--aura;
- if ((caster = (*aura)->GetCaster()) &&
- caster->IsInMap(this) && canAttack(caster) && caster->isInAccessiblePlaceFor(this->ToCreature()))
+ caster = (*aura)->GetCaster();
+ if (caster && caster->IsInMap(this) && canAttack(caster) && caster->isInAccessiblePlaceFor(this->ToCreature()))
{
target = caster;
break;
@@ -12194,9 +12195,11 @@ Unit* Creature::SelectVictim()
// search nearby enemy before enter evade mode
if (HasReactState(REACT_AGGRESSIVE))
- if (target = SelectNearestTarget())
- if (_IsTargetAcceptable(target))
+ {
+ target = SelectNearestTarget();
+ if (target && _IsTargetAcceptable(target))
return target;
+ }
if (m_invisibilityMask)
{
@@ -13221,7 +13224,7 @@ void CharmInfo::InitCharmCreateSpells()
{
m_charmspells[x].SetActionAndType(spellId,ACT_DISABLED);
- ActiveStates newstate;
+ ActiveStates newstate = ACT_PASSIVE;
if (spellInfo)
{
if (!IsAutocastableSpell(spellId))
diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp
index 876fb7ec057..e0ab491f2e1 100644
--- a/src/game/WaypointMovementGenerator.cpp
+++ b/src/game/WaypointMovementGenerator.cpp
@@ -68,7 +68,7 @@ bool WaypointMovementGenerator<Player>::GetDestination(float & /*x*/, float & /*
}
template<>
-void WaypointMovementGenerator<Creature>::Reset(Creature & /*unit*/unit)
+void WaypointMovementGenerator<Creature>::Reset(Creature & /*unit*/)
{
StopedByPlayer = true;
i_nextMoveTime.Reset(0);