0 Members and 1 Guest are viewing this topic.
Average Score - 5 / 5
Can i say this is ugly ?
It'd be better to just do a Linked List module that is statically instanced >.>.In the create method, you'd add to the list. In destroy, you'd remove from the list.Pretty simple.
Depends on what you need. There are static linked lists, circular linked lists, regular linked lists, heh.
It'd be better to just do a Linked List module that is statically instanced >.>.
Here is every simple collection you'll ever needhttp://www.hiveworkshop.com/forums/submissions-414/std-collections-collections-221515/
textmacros + modules uses as textmacros == uber spaghetti code for speedfreaks.There is nothing you can do about it, now i suppose i'm the only one here which hates these module usages, there are probably also "legion" of people on wc3c.net who share my opinion, but meh it's wc3c.net :p
Nice all-in-one snippet. I like it.edit: If you wanna reduce one line, you can initialize this to thistype(0).recycle:Code: jass static method allocate takes nothing returns thistype local thistype this = thistype(0).recycle if (this == 0) then debug if (instanceCount == 8190) then debug call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Alloc ERROR: Attempted to allocate too many instances!") debug return 0 debug endif set instanceCount = instanceCount + 1 set this = instanceCount else // this isn't needed then -> set this = thistype(0).recycle set thistype(0).recycle = this.recycle endif
I usually use arrays instead of the dot syntax Anyway, this is not a bad resource.It just reduces the amount of code you need to write.And since the most common type of collection you'd need is a doubly linked list, then this could be pretty useful.
Started by PitzerMike
Started by Purgeandfire
Started by Bribe
Started by moyack
Started by Magtheridon96