- Joined
- Aug 9, 2004
- Messages
- 70
Hey guys, I wanted to share a strange problem I got. vJass or some coding experience is needed to solve this problem I guess.
I have a struct similar to this one.
And these are the globals I'll be using.
Now let me show you the code and the problem.
The problem is if I run this for Num = 3 (There are codes to fill those Ar[Num]'s.)
I'll get a debug message's like this:
Ar[0].d is now equal to 1
Ar[1].d is now equal to 2
Ar[2].d is now equal to 3
Ar[0].d is now equal to 4
Ar[1].d is now equal to 5
...
...
Why do I get it? Don't I have different integer d's for all of my samples?
What I expected to get is:
Ar[0].d is now equal to 1
Ar[1].d is now equal to 1
Ar[2].d is now equal to 1
Ar[0].d is now equal to 2
Ar[1].d is now equal to 2
...
...
I'll be very glad if someone can tell me where I do wrong. I'll go crazy with this sh.t.
Thanks.
JASS:
struct Temp
unit u
real array x[100]
integer d
endstruct
I have a struct similar to this one.
And these are the globals I'll be using.
JASS:
globals
Temp array ArTemp
integer Num
endglobals
Now let me show you the code and the problem.
JASS:
local integer i = 0
local Temp sample = Temp.create()
loop
exitwhen i >= Num
set sample = ArTemp[i]
set sample.x[sample.d] = ...something...
set sample.d = sample.d + 1
call BJDebugMsg("Ar[" + I2S(i) + "].d is now equal to " + R2S(sample.d))
endloop
The problem is if I run this for Num = 3 (There are codes to fill those Ar[Num]'s.)
I'll get a debug message's like this:
Ar[0].d is now equal to 1
Ar[1].d is now equal to 2
Ar[2].d is now equal to 3
Ar[0].d is now equal to 4
Ar[1].d is now equal to 5
...
...
Why do I get it? Don't I have different integer d's for all of my samples?
What I expected to get is:
Ar[0].d is now equal to 1
Ar[1].d is now equal to 1
Ar[2].d is now equal to 1
Ar[0].d is now equal to 2
Ar[1].d is now equal to 2
...
...
I'll be very glad if someone can tell me where I do wrong. I'll go crazy with this sh.t.
Thanks.
Last edited: