Page 1 of 2

Memory Leak Check for 3ICE

Posted: Fri Sep 04, 2009 4:35 am
by manstie
Basically, it's your sliding system, changed to Speed[GetConvertedPlayerId(GetOwningPlayer(u))] for the player unit.
Then all the events are added by trigger in the initialization...
Then...

Code: Select all

Booster
    Events
    Conditions
        (GetUnitFlyHeight(GetTriggerUnit())<1)
        ((Triggering unit) is in H) Equal to (==) True
    Actions
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] + 0.50)
        Wait 0.10 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] + 0.50)
        Wait 0.10 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] + 0.50)
        Wait 0.10 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] + 0.50)
        Wait 1.00 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
        Wait 0.05 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
        Wait 0.05 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
        Wait 0.05 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
        Wait 0.05 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
        Wait 0.05 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
        Wait 0.05 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
        Wait 0.05 seconds
        Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)

Re: Memory Leak Check for 3ICE

Posted: Sat Sep 05, 2009 3:33 am
by samtre
would'nt it be better if you use For Each Integer A/B?

Code: Select all

    Booster
        Events
        Conditions
            (GetUnitFlyHeight(GetTriggerUnit())<1)
            ((Triggering unit) is in H) Equal to (==) True
        Actions
            For Each Integer A 1 to 3, do Actions
                   Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] + 0.50)
                   Wait 0.10 seconds
            Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] + 0.50)
            Wait 1.00 seconds
            For Each Integer A 1 to 7, do Actions
                   Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
                   Wait 0.05 seconds
            Set Speed[(Player number of (Owner of (Triggering unit)))] = (Speed[(Player number of (Owner of (Triggering unit)))] - 0.25)
it makes it look neater anyway.... and i think it gives you less time to load this trigger.......

Re: Memory Leak Check for 3ICE

Posted: Sat Sep 05, 2009 8:39 am
by 3ICE
Beautiful. No leaks. Elegant solution. You rewrote my system to use arrays :)

This was my original plan actually. (Except I will also make the sliding units an array to avoid the calls to GetPlayerId(GetOwningPlayer(u)), and be able to use udg_H with udg_Speed - much faster.)

One small note:
Speed[GetConvertedPlayerId(GetOwningPlayer(u))]
should be
udg_Speed[GetPlayerId(GetOwningPlayer(u))+1]
to get rid of that ugly BJ function. (GetConvertedPlayerId = Player number of = BJ function)

And samtre's solution is off by one:

For Each Integer A 1 to 3, do Actions
should be
For Each Integer A 1 to 4, do Actions

and

For Each Integer A 1 to 7, do Actions
should be
For Each Integer A 1 to 8, do Actions


--3ICE

EDIT: Never mind the last part. I found the reason: The waits are different: 0.10 vs 1.00

Re: Memory Leak Check for 3ICE

Posted: Sat Sep 05, 2009 8:55 am
by samtre
i knew this was coming........................

If you see his trigger it is 3 and 7 waits, the last one in his triggers have no waits, so i'll just skip them.

Re: Memory Leak Check for 3ICE

Posted: Sat Sep 05, 2009 8:57 am
by 3ICE
Just a quick note: I found my mistake before you corrected me. :P

Re: Memory Leak Check for 3ICE

Posted: Mon Sep 07, 2009 10:04 am
by manstie
Oh my god! Gah! I'm shocked to stone! Is 3ICE actually happy with what I've done?!

Okay, I'll change it to GetPlayerId(GetOwningPlayer(u))+1

I didn't use integer [ strikeout ]>>>loop<<< [ /strikeout ]A/B because it kinda bugged up when I tried before.

Hah, just noticed that in JNGP, it shows BJ functions in red. :lol:

Re: Memory Leak Check for 3ICE

Posted: Mon Sep 07, 2009 10:08 am
by 3ICE
Looping is actually slower than your solution.

But looping makes the map size smaller by a few bytes.

EDIT: It is NOT called "Integer A/B"! It is called "loop".

Re: Memory Leak Check for 3ICE

Posted: Mon Sep 07, 2009 10:10 am
by manstie
Jesus! That puts the first line of my other post out of the way...

Are you happy at the fact that I redirected someone to your website from The Hive Workshop who was looking for a sliding system? [here] :roll:

EDIT: I used the GUI version of the player number because I get my JASS based off converted ones... (That's if I can't find the function name in JNGP search thingy).

Re: Memory Leak Check for 3ICE

Posted: Mon Sep 07, 2009 2:27 pm
by 3ICE
Yeah, but you should still be proud of yourself.
manstie wrote:Are you happy at the fact that I redirected someone to your website from The Hive Workshop who was looking for a sliding system? [here] :roll:
He says it doesn't help. I did not post because I don't want to get involved. EDIT: Oh my god I just noticed my blog links are all totally broken! Nobody should ever have access to the postID and yet the default link to my sliding system is was "/?p=253" instead of "/3ice-sliding-system-for-roc-v3/". Fixing... EDIT2: Looks like the settings were reset. But surely not by me... EDIT3: Fixed.
manstie wrote:EDIT: I used the GUI version of the player number because I get my JASS based off converted ones... (That's if I can't find the function name in JNGP search thingy).
Okay. But manually adding +1 to GetPlayerId() is faster than calling a function to do it for you. Check the source of GetConvertedPlayerId() in Jasscraft or JNGP and you'll see. (Hopefully :P)

Re: Memory Leak Check for 3ICE

Posted: Tue Sep 08, 2009 8:49 am
by manstie
Lol. What a noob. I bet he cried because he didn't get a direct link to download it.

What's the postID? :roll: