wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Resources > Code Resources > Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 12-09-2008, 07:33 AM   #16
C2H3NaO2
User
 
Join Date: May 2008
Posts: 80

C2H3NaO2 is on a distinguished road (17)

Default

Quote:
Originally Posted by Ammorth
I would have to argue against you here, and say that the majority (if not all) of the time, structs will be stored in the lists. Even if someone wants to store arbitrary values in a list, it makes no sense to duplicate this system for every new type when one can just create a struct which requires less lines and when it is in-lined (vex's map optimizer), provides the same efficiency.
Ok, it is your choice. That was only a idea. I also never used a list for something else than integers or structs :).

Quote:
pushFront == Link.create()
pushBack == Link.createLast()
popFront == set data = list.front.data ; call list.front.destroy()
popBack == set data = list.last.data ; call list.last.destroy()
I would put something like that in the documentation.

@that size stuff: hm
Than another idea. Just add a empty method/operator, that returns a boolean if the list is empty.

But now i have to think if it is useful to port my current map to this. Atm i always wrote my own lists and inlinend them by hand. I don't believe that it is very productive and save .
C2H3NaO2 is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 12-09-2008, 07:50 AM   #17
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

index 8191 cause savegame corruption, you must limit allocation at 8190
DioD is offline   Reply With Quote
Old 12-09-2008, 08:52 AM   #18
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by C2H3NaO2
@that size stuff: hm
Than another idea. Just add a empty method/operator, that returns a boolean if the list is empty.
Anitarf would have my head then (duplication of code is nonsense, since the method would only consist of return this.xfirst == 0 (xfirst is the local way of referencing first).

Quote:
Originally Posted by C2H3NaO2
But now i have to think if it is useful to port my current map to this. Atm i always wrote my own lists and inlinend them by hand. I don't believe that it is very productive and save .
If it works, why change it? I always incorporated a linked-list into my spells, until I found an easier way (a static array, where when you remove an item, you replace it with the last item in the array).

Quote:
Originally Posted by DioD
index 8191 cause savegame corruption, you must limit allocation at 8190
I think you forgot the fact that this is vJass and when you ask for more structs to allocate above 8190, it uses 2 or more array sets instead of just one. Aka: I don't worry about a thing since vexorian has my back.
__________________

Last edited by Ammorth : 12-09-2008 at 08:52 AM.
Ammorth is offline   Reply With Quote
Old 12-09-2008, 01:49 PM   #19
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

Quote:
Originally Posted by Ammorth
Anitarf would have my head then (duplication of code is nonsense, since the method would only consist of return this.xfirst == 0 (xfirst is the local way of referencing first).
It would be inline-friendly, would it not?
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 12-09-2008, 04:14 PM   #20
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by Pyrogasm
It would be inline-friendly, would it not?
Yes, but its still not needed as the check is so simple already.
__________________
Ammorth is offline   Reply With Quote
Old 12-09-2008, 04:57 PM   #21
Rising_Dusk
Obscurity, the Art


Projects Director
Project Leader: OD
 
Join Date: Feb 2006
Posts: 9,729

Submissions (27)

Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)Rising_Dusk has a reputation beyond repute (1192)

Hero Contest #3 - 1st PlaceApproved Map: Desert of ExileApproved Map: Advent of the ZenithHero Contest #2 - 1st PlaceHero Contest - Third place>

Send a message via AIM to Rising_Dusk Send a message via MSN to Rising_Dusk
Default

Quote:
Originally Posted by Ammorth
I think you forgot the fact that this is vJass and when you ask for more structs to allocate above 8190, it uses 2 or more array sets instead of just one. Aka: I don't worry about a thing since vexorian has my back.
Why in the world would you do that for 1 extra index? Maybe if you were asking for a couple thousand more for a legitimate reason, sure, but 1 index? Does that even help your system?
__________________
Rising_Dusk is offline   Reply With Quote
Old 12-10-2008, 02:56 AM   #22
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by Rising_Dusk
Why in the world would you do that for 1 extra index? Maybe if you were asking for a couple thousand more for a legitimate reason, sure, but 1 index? Does that even help your system?
Exactly. Which is why the system has only 8190 at default, but I would recommend only using multiples of 8190 if you ever need to change it.
__________________
Ammorth is offline   Reply With Quote
Old 12-13-2008, 11:27 AM   #23
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

This is stupid, since vjass parser fix this problem (i hope) setting 8191 cause ONE MORE ARRAY to be inited just for 1 slot.
DioD is offline   Reply With Quote
Old 12-13-2008, 11:47 AM   #24
Captain Griffen
Dread Lord of the Cookies
 
Captain Griffen's Avatar


Content Director
 
Join Date: Sep 2003
Posts: 5,375

Submissions (2)

Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)

Approved Map: Warlords[Quicksilver #2] - 1st Place

Default

Big arrays mean a performance hit too...however, shouldn't it be size 8191, since that'd mean array indexes of up to and including 8190?
__________________
Quote:
Originally Posted by Earth-Fury
Griffen is correct, you are not.
Quote:
[13:32] <Akolyt0r> hmm.. stil i want to have some unused women
Captain Griffen is offline   Reply With Quote
Old 12-13-2008, 02:17 PM   #25
Flame_Phoenix
retired coder | real ilfe
 
Flame_Phoenix's Avatar
 
Join Date: Mar 2007
Posts: 2,208

Submissions (10)

Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)Flame_Phoenix has a spectacular aura about (90)

Send a message via MSN to Flame_Phoenix
Default

Damn you for stealing my ideas for vJASS Ammorth, this is the second one (ya I also wanted to do the stack)... but it looks you started on the first good luck on them m8 =D

Btw, are you going to create a map as well ? =P

+rep keep on the good work !
__________________
Check out my tutorials at:
1-Creating a Hero Tavern
2-Complete Icon Tutorial - ALL about Icons
3-Making a spell in vJass - Practice Session 1
Check out all my current spells at here
Finally, check my project:
Castle vs Castle Flame Edition

Last edited by Flame_Phoenix : 12-13-2008 at 02:17 PM.
Flame_Phoenix is offline   Reply With Quote
Old 12-13-2008, 05:11 PM   #26
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by DioD
This is stupid, since vjass parser fix this problem (i hope) setting 8191 cause ONE MORE ARRAY to be inited just for 1 slot.

Exactly why you wouldn't use 8191. Instead, try a number like 16380, which still fits into 2 arrays.

Quote:
Originally Posted by Captain Griffen
Big arrays mean a performance hit too...however, shouldn't it be size 8191, since that'd mean array indexes of up to and including 8190?
Thats what I thought at first too, but I forgot 0 is a null struct and is not used for allocation. Therefore 8190. If you don't believe me, create a struct and give it 8191 allocation spots, save and then open the output map script file in the jasNewGenPack log folder. You will see it now uses 2 arrays for the data.

Quote:
Originally Posted by Flame_Phoenix
Damn you for stealing my ideas for vJASS Ammorth, this is the second one (ya I also wanted to do the stack)... but it looks you started on the first good luck on them m8 =D

Btw, are you going to create a map as well ? =P

+rep keep on the good work !
Hopefully this will work toward a map I have in mind. But I first need a fair bit of time to work on it, something which I don't have right now.
__________________

Last edited by Ammorth : 12-13-2008 at 05:13 PM.
Ammorth is offline   Reply With Quote
Old 12-13-2008, 05:43 PM   #27
Captain Griffen
Dread Lord of the Cookies
 
Captain Griffen's Avatar


Content Director
 
Join Date: Sep 2003
Posts: 5,375

Submissions (2)

Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)Captain Griffen is a glorious beacon of light (497)

Approved Map: Warlords[Quicksilver #2] - 1st Place

Default

Quote:
Thats what I thought at first too, but I forgot 0 is a null struct and is not used for allocation. Therefore 8190. If you don't believe me, create a struct and give it 8191 allocation spots, save and then open the output map script file in the jasNewGenPack log folder. You will see it now uses 2 arrays for the data.

Ooo, good point, it's not array size, it's structs.
__________________
Quote:
Originally Posted by Earth-Fury
Griffen is correct, you are not.
Quote:
[13:32] <Akolyt0r> hmm.. stil i want to have some unused women
Captain Griffen is offline   Reply With Quote
Old 12-14-2008, 05:36 AM   #28
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

More typos in the documentation:
Collapse JASS:
//      - Insert new data after a link with link.insertAfter(data)
There's no .insertAfter function, only .insert

The only think that I feel is missing from this system is a way to access a specific number link in the list. You know, so perhaps I want to know the data of the 5th link in the list: set Link5 = MyList.getLink(5) Even if it was as simple as this (because I can't see any other way to do it using your current code):
Collapse JASS:
method getLink takes integer n returns Link
    local integer i = 1
    local Link l = this.first

    if n < 1 then
        return 0
    endif

    loop
        if i == n then
            return l
        endif

        set i = i+1
        set l = l.next
        exitwhen l ==0
    endloop

    return 0
endmethod
Aside from that, I don't have any problems with this system, so I'll approve it on the grounds that you'll either A) add a .getLink method or B) show why it isn't necessary or useful.

__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Old 12-14-2008, 06:27 AM   #29
Ammorth
I blink, therefore I am.
 
Ammorth's Avatar
 
Join Date: Sep 2006
Posts: 1,812

Submissions (10)

Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)Ammorth is a glorious beacon of light (461)

Default

Quote:
Originally Posted by Pyrogasm
More typos in the documentation:
Collapse JASS:
//      - Insert new data after a link with link.insertAfter(data)
There's no .insertAfter function, only .insert
Thanks once again.

Quote:
Originally Posted by Pyrogasm
The only think that I feel is missing from this system is a way to access a specific number link in the list. You know, so perhaps I want to know the data of the 5th link in the list: set Link5 = MyList.getLink(5) Even if it was as simple as this (because I can't see any other way to do it using your current code):
...
Aside from that, I don't have any problems with this system, so I'll approve it on the grounds that you'll either A) add a .getLink method or B) show why it isn't necessary or useful.


The short answer: Because Anitarf said so.

The long answer: It's not fair to blame everything on, Anitarf since he is a great guy full of ideas. Instead I should blame myself. If you remember version 1.0, I had the method operator [] and the method operator []=. After writing 1.1 (which was an addition to 1.0), I posted it in a paste-bin and asked people on the irc what they thought. One of the reasons I re-wrote the script from v1.1 was because of a comment that Anitarf made, which convinced me that I was approaching Linked Lists from the wrong direction.

Linked lists are not arrays, even though they could be. Linked Lists are designed to be a way to "link" objects together. This means that objects can exist anywhere in the list and it doesn't really matter. Sure you can reference the links by index, but the second you change the list, it is not guaranteed to be in the same spot as before.

So, moving away from treating the list as an array with indexes, I went to a more object based approach where you get to play with the links personally, instead of dealing with indexes. Not only does code become more dynamic this way, it is also more efficient (no need to loop through n indexes to get the data). One of the reasons I had my first approach is that Linked Lists can break easily if someone has access to the Links and doesn't know what they are doing.

Because of this, I thought the only way was to manage Links through an index. Thanks to vexorian, I leaned about the private keyword trick (as I needed total access to all components of each struct for the linked lists to work, but didn't want users to be able to mess it up). Once I figured out how to do it, it only made sense to take this route, thanks to the points mentioned above by Anitarf.

Now, if you are not convinced that is enough, lets just say it took me longer to write this than to add the method into the script. =P
__________________
Ammorth is offline   Reply With Quote
Old 12-14-2008, 07:50 AM   #30
Pyrogasm
Lackadaisically Absent.
 
Pyrogasm's Avatar


Respected User
 
Join Date: Sep 2006
Posts: 4,523

Submissions (9)

Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)Pyrogasm is a splendid one to behold (638)

Hero Contest - Fourth place

Send a message via ICQ to Pyrogasm Send a message via AIM to Pyrogasm Send a message via MSN to Pyrogasm Send a message via Yahoo to Pyrogasm
Default

I'd call that a good enough reason.
__________________
Quote:
Originally posted by Rising_Dusk
Your spells are mostly ignored because they are not very cool so we aren't very excited to review/approve them, but you are incredibly persistent and won't give us an excuse to graveyard it. That is generally what results in a resource being ignored for a long time.

The Spell Request Thread Done for, unless someone else wants to revive it...
It lasted a damn long time.

Please; Ask for Help Appropriately














Quote:
Originally posted by Kyrbi0
Huh. Almost makes me wish I had a girlfriend, to take advantage of today (wait, no, that's not what I meant... I mean, take advantage of the fact that it is international women's day... gah, never mind).
Quote:
Originally posted by Pyrogasm
Rome may not have been built in a day, but the Romans sure as hell didn't say "look at this great city we built guys!" when they had nothing more than a bit of stone and some cottages.
Pyrogasm is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 02:50 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services