HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Another Leak Question

07-16-2004, 11:59 AM#1
Thunderhawk
Hello,
Does using the "All Players" function create a playergroup leak? I.e. Pick All Players and Do Action.

If it does, would setting an initial AllPlayersVar variable and referring to it each time All Players is required solve the leakage?

Edit: In addition, if you reuse a global variable to store a point right after it's been filled, does it need to be destroyed before it can be reused in order to prevent leaks?

Events:
set temppoint mypoint
order unit move to temppoint
call RemoveLocation ( udg_temppoint ) <= is this needed?
set temppoint yourpoint
order unit move to temppoint
call RemoveLocation ( udg_temppoint )

Thanks in advance :]
07-16-2004, 01:30 PM#2
Cubasis
Short Answers:

1: No
2: Yes

Long Answers:

1: Here is the deffinition for GetAllPlayers

Code:
function GetPlayersAll takes nothing returns force
    return bj_FORCE_ALL_PLAYERS
endfunction

So it just does the same as you suggested.

2: That's exactly the description of leaks. The created objects go out of reach. That is, your location variable was pointing to a object. But then you lost reference to that object as you set your variable to something new. So you can't reach it anymore, thus.... it's a leak.

~Cubasis
07-16-2004, 02:37 PM#3
Thunderhawk
Thanks Cubasis, once again you save the day :]