I'm not sure if these two count as the return bug since in the first case you are creating a unit from an integer ID, something Jass does normally.
And in the second case, an Integer Handle is an integer, so there isn't any change in type.
1. Try reading it again -.-. It is a return bug and it does not create a unit. I don't see CreateUnit anywhere in there. Also, JASS does not normally convert a handle id into a unit....
Unless you're saying that is supposed to compile? I tried it, it doesn't.
But this does
JASS:
local unit u = I2Unit(1000)
2. Second one, the integer handle is obviously a typo, lol. I wrote that straight into the post, so it's my bad that I didn't notice that. integer handle would get you a syntax error in world editor.... so yes, this too is a return bug (does exactly what GetHandleId does)
So it should be this for 2-
JASS:
function H2I takes handle h returns integer
return h
call DoNothing()
return 0
endfunction
Point is all Blizzard did was fix executing bytecode (haven't properly tested yet, I'm doubting they actually fixed), add hashtables, create an almost useless agent handle (call SaveAgentHandle appears to be its purpose, since there's no SaveHandle... why not just do a SaveHandle -.-, frustrating), and make map making more annoying with return. Oh yes, and they added new natives without any documentation or any reference to them (they're purely in .dll), so you have to guess at what even exists (I didn't know the SaveAgentHandle native existed, I just tried it randomly and it worked. No reference to it anywhere and no mention by blizzard).
As for the return bugs themselves... they still are not fixed ; ).
and for hashtables.. this stuff makes me sad : (
no worky
JASS:
private function start takes nothing returns nothing
local hashtable h
if h == null then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "NULL")
else
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "NOT NULL")
endif
endfunction
while this works..
JASS:
private function start takes nothing returns nothing
local hashtable h = InitHashtable()
if h == null then
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "NULL")
else
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "NOT NULL")
endif
endfunction
No way to un initialize them (really suited for GUI)
JASS:
local hashtable h = InitHashtable()
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, I2S(GetHandleId(h)))
call FlushParentHashtable(h)
set h = null
set h = InitHashtable()
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, I2S(GetHandleId(h)))
Oh, and apparently my return bug example... it works, but you can't store it in a var... so u have to do it each and every bloody time -.-.
-Doesn't Work-
JASS:
private function i2unit takes integer i returns unit
return i
call DoNothing()
return null
endfunction
private function test takes integer i returns nothing
local unit u = i2unit(i)
call RemoveUnit(u)
set u = null
endfunction
private function start takes nothing returns nothing
call test(GetHandleId(CreateUnit(Player(0), 'hpea', Mfn_Map_centerX, Mfn_Map_centerY, 270)))
endfunction
-Does Work-
JASS:
private function i2unit takes integer i returns unit
return i
call DoNothing()
return null
endfunction
private function test takes integer i returns nothing
call RemoveUnit(i2unit(i))
endfunction
private function start takes nothing returns nothing
call test(GetHandleId(CreateUnit(Player(0), 'hpea', Mfn_Map_centerX, Mfn_Map_centerY, 270)))
endfunction
wth is with that. : |
And do you want to see something even richer...
JASS:
library a initializer ini requires Mfn
globals
hashtable c = InitHashtable()
endglobals
private function i2unit takes integer i returns unit
return i
call DoNothing()
return null
endfunction
private function test takes integer i returns nothing
call SaveUnitHandle(c, 0, 0, i2unit(i))
call RemoveUnit(LoadUnitHandle(c, 0, 0))
call RemoveSavedHandle(c, 0, 0)
endfunction
private function start takes nothing returns nothing
call test(GetHandleId(CreateUnit(Player(0), 'hpea', Mfn_Map_centerX, Mfn_Map_centerY, 270)))
endfunction
private function ini takes nothing returns nothing
call TriggerAddAction(Mfn_ini, function start)
endfunction
endlibrary
which can translate into... (yes... I stored my broken return into a local variable thru the above example...)
JASS:
library a initializer ini requires Mfn
globals
hashtable c = InitHashtable()
endglobals
private function i2unit takes integer i returns unit
return i
call DoNothing()
return null
endfunction
private function test takes integer i returns nothing
local unit u
call SaveUnitHandle(c, 0, 0, i2unit(i))
set u = LoadUnitHandle(c, 0, 0)
call RemoveSavedHandle(c, 0, 0)
call RemoveUnit(u)
endfunction
private function start takes nothing returns nothing
call test(GetHandleId(CreateUnit(Player(0), 'hpea', Mfn_Map_centerX, Mfn_Map_centerY, 270)))
endfunction
private function ini takes nothing returns nothing
call TriggerAddAction(Mfn_ini, function start)
endfunction
endlibrary
And I ask you why.... Why put everyone thru all of this trouble...................................................
Fix it right or leave it broken.... : |