Jump to content

darkstalker

Members
  • Posts

    717
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by darkstalker

  1. TBB is used on all the C++ memory allocation (new, delete) since if redefines the global "void* operator new" (see framework/Policies/MemoryManagement.cpp). This overrides default standard library memory allocation with a custom one. Its a link-time process.

    Two kinds of memory management can coexist if you don't mix them (like allocating with malloc and freeing with operator delete). Probably the detour library comes with an "optimized malloc" for people who doesn't care about memory management, but in our case we doing it, so the best would be disable it so it uses TBB. Maybe this will require extra work since if you're using malloc-like functions to get memory then you need placement new to create objects on it.

  2. This is an in-progress implementation of a bitset-like class that wraps the 96 bit SpellFamilyFlags + SpellFamilyFlags2 into a single object that can be accessed by individual bit position. Its implemented via template metaprogramming in order to achieve compile-time bit mask calculation in a transparent way with no overhead. This gives a more readable and verbose version of stuff like:

               case SPELLFAMILY_WARLOCK:
                   // For Hellfire Effect / Rain of Fire / Seed of Corruption triggers need do it
                   if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000800000000060))
                       m_canTrigger = true;
                   break;
               case SPELLFAMILY_PRIEST:
                   // For Penance,Mind Sear,Mind Flay heal/damage triggers need do it
                   if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0001800000800000) || (m_spellInfo->SpellFamilyFlags2 & 0x00000040))
                       m_canTrigger = true;
                   break;

    that becomes:

               case SPELLFAMILY_WARLOCK:
                   // For Hellfire Effect / Rain of Fire / Seed of Corruption triggers need do it
                   if (m_spellInfo->SpellClassMask.test<CF_WARLOCK_RAIN_OF_FIRE, CF_WARLOCK_HELLFIRE, CF_WARLOCK_SEED_OF_CORRUPTION2>())
                       m_canTrigger = true;
                   break;
               case SPELLFAMILY_PRIEST:
                   // For Penance,Mind Sear,Mind Flay heal/damage triggers need do it
                   if (m_spellInfo->SpellClassMask.test<CF_PRIEST_MIND_FLAY1, CF_PRIEST_PENANCE_DMG, CF_PRIEST_PENANCE_HEAL, CF_PRIEST_MIND_FLAY2>())
                       m_canTrigger = true;
                   break;

    Where CF_* is an enum that associates the bit position with a name like:

    enum CLASS_FLAG
    {
       CF_MAGE_FIREBALL                        = 0,
       CF_MAGE_FIRE_BLAST                      = 1,
       CF_MAGE_FLAMESTRIKE                     = 2,
       CF_MAGE_FIRE_WARD                       = 3,
       CF_MAGE_SCORCH                          = 4,
       CF_MAGE_FROSTBOLT                       = 5,
       // ...
    

    Source code with the class here: http://paste2.org/p/1094906

    sample implementation here

    new version for 11623+

×
×
  • 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