Posted By: RyuMaster
Possible bug? - 09/07/08 13:34
I'm working on function witch creates panels at runtime.
leveldata is sturuct witch contains all the info.
I try to debug using this:
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:
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,
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.
Quote:
LEVEL point1; // structure
main ()
...
populate_panels(point1); //pass it to function
...
main ()
...
populate_panels(point1); //pass it to function
...
Quote:
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);
}
}
}
{
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:
Quote:
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:
Quote:
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,
Quote:
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.