Jump to content
TrinityCore

Compatible with obsolete code[HostileRefManager]


MaDDogChen
 Share

Recommended Posts

I have an old code that needs to be compatible with the latest TC 335.The code is like this

############################################################

void AttackersValue::AddAttackersOf(Unit* unit, set<Unit*>& targets)
{
    HostileRefManager& refManager = unit->getHostileRefManager();
    HostileReference *ref = refManager.getFirst();
    if (!ref)
        return;

    while( ref )
    {
        ThreatManager *threatManager = ref->GetSource();
        Unit *attacker = threatManager->GetOwner();
        Unit *victim = attacker->GetVictim();
        if (victim == unit)
            targets.insert(attacker);
        ref = ref->next();
    }
}

############################################################

If we want to rewrite the method implementation of the new TC, how should we modify it?Mainly part HostileRefManager and Unit *attacker ..

sorry my bad english.I sincerely thank you for help me.

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...