HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Boolexpr in a function

12-03-2007, 10:45 AM#1
chobibo
If I put a null on a boolexpr parameter, will it leak? I saw a thread on the hive saying that it will, I just want to confirm if its true.
Collapse JASS:
native GroupEnumUnitsOfPlayer takes group whichGroup, player whichPlayer, boolexpr filter returns nothing
example:
Collapse JASS:
call GroupEnumUnitsOfPlayer( g, p, null)
will null leak, thanks
12-03-2007, 11:37 AM#2
moyack
yes, it leaks, so a good practice to avoid this issue is to have in your map a public function to replace the null option.

Collapse JASS:
library True initializer Init

globals
    boolexpr TrueCnd
endglobals

private function True takes nothing returns boolean
    return true
endfunction

private function Init takes nothing returns nothing
    set TrueCnd = Condition(function True)
endfunction

endlibrary

function test takes group g, player p returns nothing
    call GroupEnumUnitsOfPlayer( g, p, TrueCnd)
endfunction
12-03-2007, 12:10 PM#3
cohadar
How the fuck can a null leak?
(I am not saying it can't I am just amazed at jet another blizz goof)
12-03-2007, 08:50 PM#4
grim001
Quote:
Originally Posted by cohadar
How the fuck can a null leak?
(I am not saying it can't I am just amazed at jet another blizz goof)

It's more like it causes the game to allocate more and more memory each time which is a bad thing for maps that tend to spam Enum functions.