MeleeExposeAllPlayers
- comment
- bug
Leaks handle
toExposeTo: In Jass you must set local variables that hold agents (or any child type) tonullat the end of functions to avoid reference counter leaks.- patch
1.07
- Source
- Blizzard.j (raise an issue to discuss on Github or submit a PR)
- return type
nothing- Source code
function MeleeExposeAllPlayers takes nothing returns nothing local integer playerIndex local player indexPlayer local integer playerIndex2 local player indexPlayer2 local force toExposeTo = CreateForce() set playerIndex = 0 loop set indexPlayer = Player(playerIndex) call ForceClear( toExposeTo ) call CripplePlayer( indexPlayer, toExposeTo, false ) set playerIndex2 = 0 loop set indexPlayer2 = Player(playerIndex2) if playerIndex != playerIndex2 then if (not PlayersAreCoAllied(indexPlayer, indexPlayer2)) then call ForceAddPlayer( toExposeTo, indexPlayer2 ) endif endif set playerIndex2 = playerIndex2 + 1 exitwhen playerIndex2 == bj_MAX_PLAYERS endloop call CripplePlayer( indexPlayer, toExposeTo, true ) set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop call DestroyForce( toExposeTo ) endfunction