This project is abandoned and its default file will likely not work with the most recent version of StarCraft II. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.
//------------------------------------------------------------------------------------------------------------------------------------------------------//// *************************************************************// * *// * Linked List *// * *// * v1.0.0.1 *// * ~Nestharus *// * *// *************************************************************////------------------------------------------------------------------------------------------------------------------------------------------------------//// Requires//// paste.sc2mapster.com/assets/dynamic-memory-allocator/////------------------------------------------------------------------------------------------------------------------------------------------------------//// Details//// Circular Linked List of Pointers////------------------------------------------------------------------------------------------------------------------------------------------------------//// List Constructor//// int listCreate()// void listDestroy(int list)////------------------------------------------------------------------------------------------------------------------------------------------------------//// Node Getters//// int listGetNext(int node)// int listGetPrev(int node)// int listGetData(int node)//// Example// ---------------------------------------------------------// int node = listGetNext(list);// int data;//// while (node != list) {// data = listGetData(node);// node = listGetNext(node);//// //code// }////------------------------------------------------------------------------------------------------------------------------------------------------------//// List Getters//// int listGetCount(int list)////------------------------------------------------------------------------------------------------------------------------------------------------------//// List Functions//// int listGetCount(int list)// bool listHas(int list, int data)//// void listAdd(int list, int data)// void listRemove(int list, int data)// void listClear(int list)////------------------------------------------------------------------------------------------------------------------------------------------------------//------------------------------------------------------------------------------------------------------------------------------------------------------//// - constants////------------------------------------------------------------------------------------------------------------------------------------------------------staticconstintNEXT=0;staticconstintPREV=1;staticconstintDATA=2;staticconstintCOUNT=2;//------------------------------------------------------------------------------------------------------------------------------------------------------//// - getters////------------------------------------------------------------------------------------------------------------------------------------------------------intlistGetNext(intnode){returnmemoryInt[node];}intlistGetPrev(intnode){returnmemoryInt[node+1];}intlistGetData(intnode){returnmemoryInt[node+2];}intlistGetCount(intlist){returnmemoryInt[list+COUNT];}//------------------------------------------------------------------------------------------------------------------------------------------------------//// - functions////------------------------------------------------------------------------------------------------------------------------------------------------------boollistHas(intlist,intdata){intnode=memoryInt[list+NEXT];while(node!=list&&memoryInt[node]!=data){node=memoryInt[node+NEXT];}returnmemoryInt[node+DATA]==data;}//listHasintlistCountData(intlist,intdata){intnode=memoryInt[list+NEXT];intcount=0;while(node!=list){if(memoryInt[node+DATA]==data){count=count+1;}node=memoryInt[node+NEXT];}//whilereturncount;}//listCountDatavoidlistAdd(intlist,intdata){intnode=getMemoryBlockAddress(allocate(3,MEMORY_TYPE_INT),MEMORY_TYPE_INT);intlast=memoryInt[list+PREV];memoryInt[node+DATA]=data;memoryInt[node+NEXT]=list;memoryInt[node+PREV]=last;memoryInt[last+NEXT]=node;memoryInt[list+PREV]=node;memoryInt[list+COUNT]=memoryInt[list+COUNT]+1;}//listAddvoidlistRemove(intlist,intdata){intnode=memoryInt[list+NEXT];while(node!=list&&memoryInt[node+DATA]!=data){node=memoryInt[node+NEXT];}if(memoryInt[node+DATA]!=data){return;}memoryInt[memoryInt[node+NEXT]+PREV]=memoryInt[node+PREV];memoryInt[memoryInt[node+PREV]+NEXT]=memoryInt[node+NEXT];memoryInt[list+COUNT]=memoryInt[list+COUNT]-1;deallocate(getPointerAddress(node,MEMORY_TYPE_INT));}//listRemovevoidlistClear(intlist){intnode=memoryInt[list+NEXT];while(node!=list){deallocate(getPointerAddress(node,MEMORY_TYPE_INT));node=memoryInt[node+NEXT];}//whilememoryInt[list+NEXT]=list;memoryInt[list+PREV]=list;memoryInt[list+COUNT]=0;}//listClear//------------------------------------------------------------------------------------------------------------------------------------------------------//// - constructor////------------------------------------------------------------------------------------------------------------------------------------------------------intlistCreate(){intlist=getMemoryBlockAddress(allocate(3,MEMORY_TYPE_INT),MEMORY_TYPE_INT);memoryInt[list+NEXT]=list;memoryInt[list+PREV]=list;memoryInt[list+COUNT]=0;returnlist;}//listCreatevoidlistDestroy(intlist){listClear(list);deallocate(getPointerAddress(list,MEMORY_TYPE_INT));}//listDestroy
Comments
To post a comment, please login or register a new account.
Comments