Fix build (gcc) and fix warnings

This commit is contained in:
Spp
2012-02-22 09:15:57 +01:00
parent 6870ee5848
commit 1e246cb66c
12 changed files with 44 additions and 19 deletions
@@ -482,7 +482,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell))
me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
else
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: %u Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_CAST:: Creature %u casts spell %u on target %u with castflags %u",
me->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
@@ -511,7 +511,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell))
tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
else
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: %u Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u",
tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
@@ -1576,7 +1576,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*it)->ToUnit()->HasAura(e.action.cast.spell))
(*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
else
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: %u Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
}
}
}
@@ -1303,14 +1303,20 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
case TARGET_SELECT_CATEGORY_CONE:
case TARGET_SELECT_CATEGORY_AREA:
continue;
default:
break;
}
switch (spellInfo->Effects[i].TargetB.GetSelectionCategory())
{
case TARGET_SELECT_CATEGORY_NEARBY:
case TARGET_SELECT_CATEGORY_CONE:
case TARGET_SELECT_CATEGORY_AREA:
continue;
default:
break;
}
sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i));
cond->SourceGroup &= ~(1<<i);
}
@@ -175,7 +175,7 @@ namespace Trinity
Check &i_check;
WorldObjectSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
: i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check), i_mapTypeMask(mapTypeMask) {}
: i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(GameObjectMapType &m);
void Visit(PlayerMapType &m);
@@ -195,7 +195,7 @@ namespace Trinity
Check &i_check;
WorldObjectLastSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
: i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check), i_mapTypeMask(mapTypeMask) {}
: i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(GameObjectMapType &m);
void Visit(PlayerMapType &m);
@@ -215,7 +215,7 @@ namespace Trinity
Check& i_check;
WorldObjectListSearcher(WorldObject const* searcher, std::list<WorldObject*> &objects, Check & check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
: i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check), i_mapTypeMask(mapTypeMask) {}
: i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) {}
void Visit(PlayerMapType &m);
void Visit(CreatureMapType &m);
@@ -234,7 +234,7 @@ namespace Trinity
Do const& i_do;
WorldObjectWorker(WorldObject const* searcher, Do const& _do, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
: i_phaseMask(searcher->GetPhaseMask()), i_do(_do), i_mapTypeMask(mapTypeMask) {}
: i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
void Visit(GameObjectMapType &m)
{
+1 -1
View File
@@ -1544,7 +1544,7 @@ inline GridMap* Map::GetGrid(float x, float y)
return GridMaps[gx][gy];
}
float Map::GetWaterOrGroundLevel(float x, float y, float z, float* ground /*= NULL*/, bool swim /*= false*/) const
float Map::GetWaterOrGroundLevel(float x, float y, float z, float* ground /*= NULL*/, bool /*swim = false*/) const
{
if (const_cast<Map*>(this)->GetGrid(x, y))
{
+16 -3
View File
@@ -797,6 +797,9 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar
GetSpellInfo()->Effects[effIndex].CalcRadius(m_caster) == GetSpellInfo()->Effects[j].CalcRadius(m_caster))
effectMask |= 1 << j;
processedEffectMask |= effectMask;
break;
default:
break;
}
switch(targetType.GetSelectionCategory())
@@ -917,7 +920,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
return;
}
float range;
float range = 0.0f;
switch (targetType.GetCheckType())
{
case TARGET_CHECK_ENEMY:
@@ -941,7 +944,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
ConditionList* condList = m_spellInfo->Effects[effIndex].ImplicitTargetConditions;
// handle emergency case - try to use other provided targets if no conditions provided
if (targetType.GetCheckType() == TARGET_CHECK_ENTRY && !condList || condList->empty())
if (targetType.GetCheckType() == TARGET_CHECK_ENTRY && (!condList || condList->empty()))
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: no conditions entry for target with TARGET_CHECK_ENTRY of spell ID %u, effect %u - selecting default targets", m_spellInfo->Id, effIndex);
switch (targetType.GetObjectType())
@@ -1383,6 +1386,8 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
m_targets.SetDst(x, y, z, m_caster->GetOrientation());
return;
}
default:
break;
}
float dist;
@@ -1416,6 +1421,8 @@ void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplici
case TARGET_DEST_TARGET_ANY:
m_targets.SetDst(*target);
return;
default:
break;
}
float angle = targetType.CalcDirectionAngle();
@@ -1444,6 +1451,8 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT
case TARGET_DEST_TRAJ:
SelectImplicitTrajTargets();
return;
default:
break;
}
float angle = targetType.CalcDirectionAngle();
@@ -1492,6 +1501,8 @@ void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImpli
if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(targetType.GetTarget() - TARGET_UNIT_PASSENGER_0))
AddUnitTarget(unit, 1 << effIndex);
break;
default:
break;
}
}
@@ -1778,6 +1789,8 @@ uint32 Spell::GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList*
case TARGET_OBJECT_TYPE_GOBJ_ITEM:
retMask &= GRID_MAP_TYPE_MASK_GAMEOBJECT;
break;
default:
break;
}
if (!(m_spellInfo->AttributesEx2 & SPELL_ATTR2_CAN_TARGET_DEAD))
retMask &= ~GRID_MAP_TYPE_MASK_CORPSE;
@@ -7211,7 +7224,7 @@ namespace Trinity
WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo),
_condList(condList), _targetSelectionType(selectionType)
_targetSelectionType(selectionType), _condList(condList)
{
if (condList)
_condSrcInfo = new ConditionSourceInfo(NULL, caster);
+1 -1
View File
@@ -675,7 +675,7 @@ namespace Trinity
WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList);
WorldObjectSpellTargetCheck::~WorldObjectSpellTargetCheck();
~WorldObjectSpellTargetCheck();
bool operator()(WorldObject* target);
};
+2 -2
View File
@@ -1581,10 +1581,10 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE) && !caster->canSeeOrDetect(target, implicit))
return SPELL_FAILED_BAD_TARGETS;
Unit const* unitTarget;
Unit const* unitTarget = target->ToUnit();
// creature/player specific target checks
if (unitTarget = target->ToUnit())
if (unitTarget)
{
if (AttributesEx & SPELL_ATTR1_CANT_TARGET_IN_COMBAT && unitTarget->isInCombat())
return SPELL_FAILED_TARGET_AFFECTING_COMBAT;
+2 -2
View File
@@ -736,6 +736,7 @@ class spell_dk_death_coil : public SpellScriptLoader
int32 damage = GetEffectValue();
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
if (caster->IsFriendlyTo(target))
{
int32 bp = int32(damage * 1.5f);
@@ -744,6 +745,7 @@ class spell_dk_death_coil : public SpellScriptLoader
else
caster->CastCustomSpell(target, SPELL_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true);
}
}
void Register()
{
@@ -770,9 +772,7 @@ class spell_dk_death_grip : public SpellScriptLoader
void HandleDummy(SpellEffIndex effIndex)
{
int32 damage = GetEffectValue();
Spell* baseSpell = GetSpell();
Position pos;
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
GetSummonPosition(effIndex, pos, 0.0f, 0);
+1 -1
View File
@@ -1084,7 +1084,7 @@ class spell_gen_seaforium_blast : public SpellScriptLoader
// but in effect handling OriginalCaster can become NULL
if (Unit* originalCaster = GetOriginalCaster())
if (GameObject* go = GetHitGObj())
if (GetHitGObj()->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
if (go->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
originalCaster->CastSpell(originalCaster, SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true);
}
+4
View File
@@ -221,11 +221,13 @@ class spell_item_gnomish_death_ray : public SpellScriptLoader
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
if (urand(0, 99) < 15)
caster->CastSpell(caster, SPELL_GNOMISH_DEATH_RAY_SELF, true, NULL); // failure
else
caster->CastSpell(target, SPELL_GNOMISH_DEATH_RAY_TARGET, true, NULL);
}
}
void Register()
{
@@ -1290,11 +1292,13 @@ class spell_item_nigh_invulnerability : public SpellScriptLoader
{
Unit* caster = GetCaster();
if (Item* castItem = GetCastItem())
{
if (roll_chance_i(86)) // Nigh-Invulnerability - success
caster->CastSpell(caster, SPELL_NIGH_INVULNERABILITY, true, castItem);
else // Complete Vulnerability - backfire in 14% casts
caster->CastSpell(caster, SPELL_COMPLETE_VULNERABILITY, true, castItem);
}
}
void Register()
{
+1 -1
View File
@@ -255,7 +255,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
if (dmgInfo.GetAttacker() == target)
return;
if (Unit* caster = GetCaster())
if (GetCaster())
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
{
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
+3 -1
View File
@@ -325,12 +325,14 @@ class spell_warl_soulshatter : public SpellScriptLoader
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
if (target->CanHaveThreatList() && target->getThreatManager().getThreat(caster) > 0.0f)
{
sLog->outString("THREATREDUCTION");
caster->CastSpell(target, SPELL_SOULSHATTER, true);
} else
sLog->outString("can have threat? %b . threat number? %f ",target->CanHaveThreatList(),target->getThreatManager().getThreat(caster));
sLog->outString("can have threat? %u . threat number? %f ",target->CanHaveThreatList(),target->getThreatManager().getThreat(caster));
}
}
void Register()