HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

The Wc3c Daily WTF: GetLeakFreeUnitsInMap

02-24-2006, 04:48 PM#1
AnarkiNet
Ok, since JASS is rather "Inside", this cant go on www.thedailywtf.com ...however, it definately deserves some "WTF"ing from people here.
Collapse JASS:
//    _______________________
//   | GetLeakFreeUnitsInMap |
//  |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|
//  | This function will get all units in the map the leakfree way.  |
//  |  - (C) Zoxc 2006                                               |
//  |________________________________________________________________|

function NothingToNull takes nothing returns handle  // A little "hack" to pass data and clean leaks at the same time
return null
endfunction

function ClearUnitLeak takes nothing returns nothing
local unit ToClean = GetEnumUnit() // Since we are assigning the unit here we can't remove the leaks at the same time.
call RemoveUnit(ToClean)
set ToClean = null // Then we must do it here
endfunction

function GetLeakFreeUnitsInMap  takes nothing returns group
local rect Map = null //Set it to null here so we don't have to do it later, saves us some bytes
local group Units = null

set Map = NothingToNull(RemoveRect(GetPlayableMapRect())) // We get the mpa rect and clean the leaks at once

set Units = NothingToNull(DestroyGroup(GetUnitsInRectAll(Map))) // Here we get all units in Map then cleaning leak

call ForGroup(Units, function ClearUnitLeak) // Clean leaks for all units

return Units // Return leakfree units in map
endfunction

This function is completely beyond me. Perhaps someone else can explain WTF it is supposed to actually do?
02-24-2006, 04:53 PM#2
Blade.dk
He made it as a joke reply to some other post, which was stating something wrong.
02-24-2006, 04:55 PM#3
Vexorian
That function is leaking loval variables like hell

edit: What post made Zoxc invent such non-sense, convert nothing to null awesome non-sense
02-24-2006, 04:56 PM#4
Zoxc
From my point of view that function is hella funny =P
02-24-2006, 05:23 PM#5
Chuckle_Brother
That is one hot function. I especially like how you are destroying and nulling an already null variable.
02-24-2006, 07:05 PM#6
Anitarf
I don't know what's more hilarious, the function or the fact that the only thing Vex noticed wrong with it at first were the local leaks. :)
02-24-2006, 07:13 PM#7
Zoxc
Quote:
Originally Posted by Vexorian
That function is leaking loval variables like hell

Where is the leaks?............ can't see anyone