- Joined
- Dec 31, 2005
- Messages
- 712
Hello again o/
I've been learning vJass. I found it simple, as I already knew Jass quite well.
But I'ge got stuck with a strange bug... I have:
If I use GetHeroId( 'H000' ), I get 20 messages saying: Check x: Volcano (the name of the hero 'H001').
So, ALL INDEXES of Heroi[] are changed when I use DefinirHeroi(...)
Why does that happen?
I've been learning vJass. I found it simple, as I already knew Jass quite well.
But I'ge got stuck with a strange bug... I have:
JASS:
struct Heroi
integer t
boolean Disp
string Icone
unit u
player Owner
integer id
timer Tim
integer Revive
endstruct
globals
Heroi array Herois
endglobals
private function DefinirHeroi takes integer i, integer t, boolean random, string icone returns nothing
call Herois[i].create()
set Herois[i].t = t
set Herois[i].Disp = random
set Herois[i].Icone = icone
call BJDebugMsg(I2S(i) + " set to " + GetObjectName(t))
endfunction
function InicializarHerois takes nothing returns nothing
call DefinirHeroi( 0, 'H000', true, "ReplaceableTextures\\CommandButtons\\BTNAssassin.blp" )
call DefinirHeroi( 1, 'H001', true, "ReplaceableTextures\\CommandButtons\\BTNHeroAvatarOfFlame.blp" )
endfunction
function GetHeroId takes integer t returns integer
local integer i = 0
loop
exitwhen i > 20
call BJDebugMsg("Check " + I2S(i) + ": " + GetObjectName(Herois[i].t))
if Herois[i].t == t then
call BJDebugMsg("true")
return i
endif
set i = i + 1
endloop
return -1
endfunction
If I use GetHeroId( 'H000' ), I get 20 messages saying: Check x: Volcano (the name of the hero 'H001').
So, ALL INDEXES of Heroi[] are changed when I use DefinirHeroi(...)
Why does that happen?