I'm going through my map and cleaning up memory leaks. I just got to a situation where I am "picking every unit in unit group and doing stuff". Inside the "do stuff" area, I am making a point, using it and then removing it. I normally do this inside a For loop, but here the unit group can be of variable size. I think it should work the same, and not leak, but I wanted to double check.
The question is how "pick every unit in unit group and do stuff" gets parsed. Does it go through each unit in the unit group one and a time and "do the stuff" (kind of like a For loop)? If so, then I think this shouldn't leak, ya?
The thing that I'm worried about is the "TempPoint_FrogVisibility" inside the "Pick Every Unit..." area. Since that happens a bunch of times, I want to make sure it's getting cleaned each time before a new instance of it is started.
Here is my trigger:
The question is how "pick every unit in unit group and do stuff" gets parsed. Does it go through each unit in the unit group one and a time and "do the stuff" (kind of like a For loop)? If so, then I think this shouldn't leak, ya?
The thing that I'm worried about is the "TempPoint_FrogVisibility" inside the "Pick Every Unit..." area. Since that happens a bunch of times, I want to make sure it's getting cleaned each time before a new instance of it is started.
Here is my trigger:
-
Frog Visibility
- Events
- Conditions
-
Actions
- Set TempPoint_Silis = (Position of Silis)
- -------- Point Value of 1 means critter --------
- Set TempGroup_FrogVisibility = (Units within 2000.00 of TempPoint_Silis matching ((Point-value of (Matching unit)) Equal to 1))
-
Unit Group - Pick every unit in TempGroup_FrogVisibility and do (Actions)
-
Loop - Actions
- Set TempPoint_FrogVisibility = (Position of (Picked unit))
- Unit - Create 1 Visibility (for Triggers) for PLAYER_Silis at TempPoint_FrogVisibility facing Default building facing degrees
- Unit - Add a CritterVisibilityDuration second Generic expiration timer to (Last created unit)
- Custom script: DO STUFF
- Custom script: call RemoveLocation (udg_TempPoint_FrogVisibility)
-
Loop - Actions
- Custom script: call RemoveLocation (udg_TempPoint_Silis)
- Custom script: call DestroyGroup (udg_TempGroup_FrogVisibility)