Beispiel #1
0
 public unsafe bool MakeDataUnique()
 {
     isCAbilityDataUnique.TryGetValue(AsIntPtr(), out bool flag);
     if (flag)
     {
         return(false);
     }
     Data = AbilDataCacheNode.FromId(AbilityId)->Clone();
     isCAbilityDataUnique[AsIntPtr()] = true;
     return(true);
 }
Beispiel #2
0
 public unsafe bool MakeDataShared()
 {
     isCAbilityDataUnique.TryGetValue(AsIntPtr(), out bool flag);
     if (!flag)
     {
         return(false);
     }
     SMem.Free((void *)Data, 0);
     Data = AbilDataCacheNode.FromId(AbilityId);
     isCAbilityDataUnique[AsIntPtr()] = false;
     return(true);
 }
Beispiel #3
0
        public unsafe AbilDataCacheNode *Clone()
        {
            fixed(AbilDataCacheNode *abilDataCacheNodePtr1 = &this)
            {
                AbilDataCacheNode *abilDataCacheNodePtr2 = (AbilDataCacheNode *)SMem.Alloc(sizeof(AbilDataCacheNode), 0);

                Memory.Copy(new IntPtr((void *)abilDataCacheNodePtr1), new IntPtr((void *)abilDataCacheNodePtr2), sizeof(AbilDataCacheNode));
                AbilityLevelData *abilityLevelDataPtr = (AbilityLevelData *)SMem.Alloc(sizeof(AbilityLevelData) * Levels, 0);

                Memory.Copy(new IntPtr((void *)Level), new IntPtr((void *)abilityLevelDataPtr), sizeof(AbilityLevelData) * Levels);
                abilDataCacheNodePtr2->Level = abilityLevelDataPtr;
                return(abilDataCacheNodePtr2);
            }
        }
Beispiel #4
0
        public Boolean MakeDataUnique()
        {
            var isDataUnique = false;

            isCAbilityDataUnique.TryGetValue(this.AsIntPtr(), out isDataUnique);
            if (isDataUnique)
            {
                return(false);
            }
            // Clone and use new data from the cache.
            this.Data = AbilDataCacheNode.FromId(this.AbilityId)->Clone();
            isCAbilityDataUnique[this.AsIntPtr()] = true;
            return(true);
        }
Beispiel #5
0
        public Boolean MakeDataShared()
        {
            var isUnique = false;

            isCAbilityDataUnique.TryGetValue(this.AsIntPtr(), out isUnique);
            if (!isUnique)
            {
                return(false);
            }
            // Free the old unique data, to avoid leaking.
            Storm.MemoryFree(new IntPtr(this.Data));
            // Use old data from the cache.
            this.Data = AbilDataCacheNode.FromId(this.AbilityId);
            isCAbilityDataUnique[this.AsIntPtr()] = false;
            return(true);
        }
        //public static AbilDataCacheNodePtr FromId(ObjectIdL id)
        //{
        //  return GameFunctions.GetAbilDataCacheNodeFromId(id);
        //}

        public unsafe AbilDataCacheNodePtr(AbilDataCacheNode *pointer)
        {
            this.pointer = new IntPtr((void *)pointer);
        }
Beispiel #7
0
 unsafe public AbilDataCacheNodePtr(AbilDataCacheNode *pointer)
 {
     this.pointer = new IntPtr(pointer);
 }