Jump to content

ApoC

Members
  • Posts

    87
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by ApoC

  1. I looked on to the patch (very quick look) and there are some problems i think. For example

    bool getUnloadLock() const { return i_unloadActiveLockCount || i_unloadExplicitLock; }
    ...
    void incUnloadActiveLock() { ++i_unloadActiveLockCount; }
    

    If we want to have this working under multithreaded environment it will need real locking (mutex or other primitive) because this and similar operations are not atomic what can cause problems in real multithreaded environment. Even simple ++ -- operations are not atomic! It is good to keep this in mind. It can be solved by some fast mutex or using atomic operations (special CPU instructions for this purposes).

  2. Why not loop in Spell::CheckCast aura effects like:

    Unit* target = m_targets.GetUnitTarget();
    for (int i = 0; target && i < 3; ++i)
    {
       if (!m_spellInfo->EffectApplyAuraName[i])
           continue;
    
       // else
       const AuraList& aurasByName = target->GetAurasByType(m_spellInfo->EffectApplyAuraName[i]);
       AuraList::const_iterator it = aurasByName.begin();
       for ( ; it != aurasByName.end(); ++it)
       {
           // Do your checks here
           // on first hit return SPELL_FAILED_AURA_BOUNCED
       }
    }
    

    And may be better to do this as method for avoid code duplication on more places.

  3. Maybe this is solution

    diff --git a/src/game/PoolHandler.cpp b/src/game/PoolHandler.cpp
    index d1f2305..e038add 100644
    --- a/src/game/PoolHandler.cpp
    +++ b/src/game/PoolHandler.cpp
    @@ -185,11 +185,15 @@ void PoolGroup<T>::SpawnObject(uint32 limit, bool cache)
        if (limit == 1)                                         // This is the only case where explicit chance is used
        {
            uint32 roll = RollOne();
    -        if (cache && m_LastDespawnedNode != roll)
    -            Despawn1Object(m_LastDespawnedNode);
    -
    +        if (!cache || (cache && m_LastDespawnedNode != roll))
    +        {
    +            if (cache)
    +                Despawn1Object(m_LastDespawnedNode);
    +            Spawn1Object(roll);
    +        }
    +        else
    +            ReSpawn1Object(roll);
            m_LastDespawnedNode = 0;
    -        Spawn1Object(roll);
        }
        else if (limit < EqualChanced.size() && m_SpawnedPoolAmount < limit)
        {

    ?

    Original post by seirge at http://getmangos.ru/forum/showthread.php?p=289270

    Yes, i think this solves problem what I also find in pools and what leads to same assert.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use