I'm working on function witch creates panels at runtime.
LEVEL point1; // structure
main ()
...
populate_panels(point1); //pass it to function
...
function populate_panels(LEVEL* leveldata)
{
var i;
for (i=0; i<leveldata->overlays; i++) //Lets create as many overlays as needed
{
if(leveldata.visibility[i] == 1) //if visibility 1 then proceed
{
overlay[i] = pan_create("bmap = leveldata.filename[i];pos_x = leveldata.posy[i];pos_y=leveldata.posy[i]; flags=VISIBLE;",2);
}
}
}
leveldata is sturuct witch contains all the info.
I try to debug using this:
printf("my_var: %.3f",(int)i);
Struct has 13 panels, and it cycles 13 times, and on every frame I get "i" variable + 1; So, basically, leveldata->overlays successfully gets "13" value from point 1 struct.
But, for sample, if I try this:
printf("my_var: %.3f",(int)leveldata->overlays);
I get "0", but not "13";
Why is that so? And, afcourse, all parameters at function pan_create are "0" as well. But, for instance,
if(leveldata.visibility[i] == 1)
this part of code is "1", because on every loop cycle I can see debugger passing through this point. So it DO get parameters from point1.
And just do not get what is wrong.
Loops and if..else acts like there are parameter in leveldata, but printf or pan_create do not get them at all.