示例#1
0
        public AbilDataCacheNode *Clone()
        {
            fixed(void * @this = &this)
            {
                // We allocate new memory using SMemAlloc. This way WC3 knows how to clean it.
                var clone = (AbilDataCacheNode *)Storm.MemoryAlloc(sizeof(AbilDataCacheNode));

                // We copy the old data into our newly allocated memory.
                Memory.Copy(new IntPtr(@this), new IntPtr(clone), sizeof(AbilDataCacheNode));

                // We also clone the AbilityLevelData array.
                var levelData = (AbilityLevelData *)Storm.MemoryAlloc(sizeof(AbilityLevelData) * this.Levels);

                Memory.Copy(new IntPtr(this.Level), new IntPtr(levelData), sizeof(AbilityLevelData) * this.Levels);
                clone->Level = levelData;

                return(clone);
            }
        }