• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Does this Leak?

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
Just wondering if this leaks:

  • Item - Pick every item in (Playable map area) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Picked item)) Equal to Rune of Healing
              • (Item-type of (Picked item)) Equal to Rune of Mana
              • (Item-type of (Picked item)) Equal to Rune of Shielding
        • Then - Actions
          • Item - Remove (Picked item)
        • Else - Actions
I couldn't find a way to create a variable of type "Item Group" like you would with a "Unit Group",
therefore there is no way to destroy it with custom script.
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
Just wondering if this leaks:

  • Item - Pick every item in (Playable map area) and do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Picked item)) Equal to Rune of Healing
              • (Item-type of (Picked item)) Equal to Rune of Mana
              • (Item-type of (Picked item)) Equal to Rune of Shielding
        • Then - Actions
          • Item - Remove (Picked item)
        • Else - Actions
I couldn't find a way to create a variable of type "Item Group" like you would with a "Unit Group",
therefore there is no way to destroy it with custom script.

(Playable map area) doesn't leak, the same with (All Player)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
The item group leaks.

  • Custom Script: set bj_wantDestroyGroup = true
Add this custom script before creating the item group, and it won't leak anymore.
The script you gave is for unit groups and will not do anything in this case. Item groups don't have such a thing.
It is safe to use "pick every item in rect" without having to do anything special.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
I couldn't find a way to create a variable of type "Item Group" like you would with a "Unit Group",
therefore there is no way to destroy it with custom script.

Therefore there is no persisting object. Basically, if a function does not return a new object, which you could potentially save in a variable, it should not leak other objects. Else the function is crap.

@Kala, ap0calypse: Jass knows no type "item group".
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
@Kala, ap0calypse: Jass knows no type "item group".
I actually knew that, I have no clue why I just didn't say it the way you did just now :p
Way easier to understand.

Well but "(Playable map area)" is a leak isn't it? The item group itself like you use it is no leak!
No, it's a reference to a variable ("bj_mapInitialPlayableArea"). It's much like the "All Players"-force in the way that player groups (forces) generally leak, but "All Players" is just a reference to a variable, so removing that would be disastrous :p.
 
Status
Not open for further replies.
Top