TRecycle

Добавлен , не публикуется
//v1.0.1
#define TRecycle(libName, objectType, onCreate, onRelease, objectLimit) = 
{
    library libName##Recycle uses Index,GCConfiguration
        private int indexer = 0;
        private objectType array dataArray[objectLimit];
        
        // выдает таймер
        public objectType Get()
        {
            if (indexer==0)
            {
                dataArray[indexer] = onCreate;
                SaveBoolean(GCConfiguration_safeData,GetHandleId(dataArray[indexer]),0, true);
            }
            else
            {
                indexer--;
            }
            return dataArray[indexer];
        }
        
        // освобождает таймер
        public void Release(objectType thisObject)
        {
            if (thisObject==null) { return; }
            elseif (indexer==objectLimit)
            {
                Index_Remove(objectType, thisObject)
                return;
            }
            onRelease
            dataArray[indexer]=thisObject;
            indexer++;
        }
    endlibrary
}

TRecycle(Group, group, CreateGroup(), GroupClear(thisObject) ; DestroyGroup(thisObject), 200)
TRecycle(Timer, timer, CreateTimer(), PauseTimer(thisObject) ; DestroyTimer(thisObject), 200)
TRecycle(Trigger, trigger, CreateTrigger(), DestroyTrigger(thisObject), 200)
TRecycle(Texttag, texttag, CreateTextTag(), DestroyTextTag(thisObject), 200)
TRecycle(Region, region, CreateRegion(), RemoveRegion(thisObject), 200)
TRecycle(Location, location, Location(0,0), RemoveLocation(thisObject), 200)
TRecycle(Rect, rect, Rect(0,0,0,0), RemoveRect(thisObject), 200)
`
ОЖИДАНИЕ РЕКЛАМЫ...