mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Make a function(ToTempSummon()) which can convert Creature to TempSummon with a C++ cast(reinterpret_cast) and with a type check(isSummon()).
This function is like ToPlayer(), ToTotem(), etc. This commit is like ede831bdd6f0cff481acc33f269fa7f8c78befd4 / r7496: http://code.google.com/p/trinitycore/source/detail?r=ede831bdd6f0cff481acc33f269fa7f8c78befd4 As a result, this commit has the advantages and the "disadvantages" too, like r7496. Please try to be polite if this commit causes some crashes. --HG-- branch : trunk
This commit is contained in:
@@ -9335,7 +9335,7 @@ void Unit::RemoveAllMinionsByEntry(uint32 entry)
|
||||
++itr;
|
||||
if (unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
|
||||
&& unit->ToCreature()->isSummon()) // minion, actually
|
||||
((TempSummon*)unit)->UnSummon();
|
||||
unit->ToTempSummon()->UnSummon();
|
||||
// i think this is safe because i have never heard that a despawned minion will trigger a same minion
|
||||
}
|
||||
}
|
||||
@@ -9502,7 +9502,7 @@ void Unit::RemoveAllControlled()
|
||||
if (target->GetCharmerGUID() == GetGUID())
|
||||
target->RemoveCharmAuras();
|
||||
else if (target->GetOwnerGUID() == GetGUID() && target->isSummon())
|
||||
((TempSummon*)target)->UnSummon();
|
||||
target->ToTempSummon()->UnSummon();
|
||||
else
|
||||
sLog.outError("Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry());
|
||||
}
|
||||
@@ -9620,7 +9620,7 @@ void Unit::UnsummonAllTotems()
|
||||
|
||||
if (Creature *OldTotem = GetMap()->GetCreature(m_SummonSlot[i]))
|
||||
if (OldTotem->isSummon())
|
||||
((TempSummon*)OldTotem)->UnSummon();
|
||||
OldTotem->ToTempSummon()->UnSummon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12138,7 +12138,7 @@ Unit* Creature::SelectVictim()
|
||||
target = getAttackerForHelper();
|
||||
if (!target && isSummon())
|
||||
{
|
||||
if (Unit * owner = ((TempSummon*)this)->GetOwner())
|
||||
if (Unit * owner = this->ToTempSummon()->GetOwner())
|
||||
{
|
||||
if (owner->isInCombat())
|
||||
target = owner->getAttackerForHelper();
|
||||
|
||||
Reference in New Issue
Block a user