| 02-05-2008, 09:33 PM | #1 |
I've got a question, which I hope you can answer me: Many JASS functions (as the GroupEnumUnits... and TriggerRegisterPlayerUnitEvent) take a booleanexpr as a filter. But when I want to get all units, is it better to only give the parameter null or use this litte boolexpr:function ReturnTrue takes nothing returns boolean return true endfunction . . . call TriggerRegisterPlayerUnitEvent( gg_trg_UnitDeath, Player(0), EVENT_PLAYER_UNIT_DEATH, Condition(function ReturnTrue) ) The point is also that I don't get the whole boolepr thing... there's a boolexpr object, but at which time? When I call Condition(function ...) or when it's evaluated? I don't understand that so it would be very kind of you to explain me the whole problem. Thanks :) |
| 02-05-2008, 11:28 PM | #2 | |
Quote:
and yes null (as condition for some functions) seems to cause leaks... |
| 02-05-2008, 11:41 PM | #3 |
I use null all the time and I never noticed it? At least it did not increase handle count. Meh, if it is only leaking boolexpr memory (4 bytes) then seriously who cares. |
| 02-06-2008, 12:48 AM | #4 |
null seems to cause silly stuff not just a leak. I prefer a BOOLEXPR_TRUE variable. |
| 02-06-2008, 02:42 AM | #5 |
As to what Vexorian said: JASS:library BoolLib initializer Init globals boolean BOOLEXPR_TRUE boolean BOOLEXPR_FALSE englobals private function True takes nothing returns boolean return true endfunction private function False takes nothing returns boolean return false endfunction private function Init takes nothing returns nothing set BOOLEXPR_TRUE = Condition(function True) set BOOLEXPR_FALSE = Condition(function True) endfunction endlibrary |
| 02-06-2008, 12:43 PM | #6 |
I doubt so, but I think I once made that think. |
| 02-06-2008, 01:07 PM | #7 | |
Quote:
|
| 02-06-2008, 01:48 PM | #8 | |
Quote:
What silly stuff? |
| 02-07-2008, 12:05 AM | #9 |
You didn't fix my "englobals", Moyack. :P |
| 02-07-2008, 07:05 PM | #10 |
Okay, thank you all very much :) |
| 02-09-2008, 05:23 PM | #11 | |
Quote:
Please? |
| 02-09-2008, 07:05 PM | #12 | |
Quote:
Handle count doesn't go up, it just causes memory usage to increase and eventually slows the game down if you make heavy usage of GroupEnum. |
| 02-09-2008, 07:38 PM | #13 |
I don't. I guess that is why I never noticed it... |
