//v 1.5
library Index
{
    public hashtable Data = InitHashtable()
    private int count = 0
    private int slotCount = 0
    private int array buffSlots
    private bool array ValueIsStatic
    private int array staticIndexes
    private int staticIndexesCount;
    
    #define private Value = 0;
    #define private Value2 = 0;
      
    // обнуление значения объекта
    public void Flush(handle h)
    {
        int hId = GetHandleId(h);
        int objectId = LoadInteger(Index_Data,hId,Value);
        if (!ValueIsStatic[objectId] && objectId > 0)
        {
            slotCount++;
            buffSlots[slotCount] = objectId;
            FlushChildHashtable(Index_Data,hId)
        }
    }
    
    // удаление объекта с обнулением
    #define Index_Remove(objectType, object) = 
    {
        #if(objectType == unit)
            RemoveUnit(object);
        #elseif(objectType == timer)
            PauseTimer(object);
            DestroyTimer(object);
        #elseif (objectType == group)
            GroupClear(object);
            DestroyGroup(object);
        #elseif (objectType == item)
            RemoveItem(object)
        #elseif (objectType == location)
            RemoveLocation(object)
        #elseif (objectType == rect)
            RemoveRect(object)
        #elseif (objectType == region)
            RemoveRegion(object)
        #elseif (objectType == effect)
            DestroyEffect(object)
        #endif
        Index_Flush(object)
    }
    
    // присвоить значения объекту
    #define Index_SetValue(h, val) =
    {
        SaveInteger(Index_Data,GetHandleId(h),Value2,val)
    }
    
    // возвращает присвоенное значение
    #define Index_GetValue(h) =
    {
        LoadInteger(Index_Data,GetHandleId(h),Value2)
    }
    
    // присваивание id объекту
    #define Index_Set(h, val, isStatic) =
    {
        SaveInteger(Index_Data,GetHandleId(h),Value,val)
        #if (isStatic)
            ValueIsStatic[val] = true;
            staticIndexes[staticIndexesCount] = val;
            staticIndexesCount++;
        #endif
    }
    
    // автоприсваивание id объекту
    public int Get(handle object, bool isStatic)
    {
        int hId = GetHandleId(object)
        if (!HaveSavedInteger(Index_Data,hId,Value))
        {
            if (slotCount > 0)
            {
                if (isStatic)
                {
                    Index_Set(object,buffSlots[slotCount],true);
                }
                else
                {
                    Index_Set(object,buffSlots[slotCount],false);
                }
                slotCount--;
            }
            else
            {
                count++;
                if (isStatic)
                {
                    Index_Set(object,count, true);
                }
                else
                {
                    Index_Set(object,count, false);
                }
            }
        }
        return LoadInteger(Index_Data,hId,Value);
    } 
    
    public int Get2(handle object)
    {
        return LoadInteger(Index_Data, GetHandleId(object),Value);
    }
    
    
    callback onUnitDeath()
    {
        Flush(GetDyingUnit());
    }
}
    
        
            
                `
            
            
                
        
    
    ОЖИДАНИЕ РЕКЛАМЫ...
            
                    
                        Чтобы оставить комментарий, пожалуйста, войдите на сайт.
                    
                
             
                        
                        
                    
 SNW
                                SNW
                            






 
                    
                
Тебе решать и офк я понимаю, что это не для паблика, но надо же было КАМЕНТИК НАПИСАТЬ))))
DestroyTimer(object);