Ive been trying to debug this peice of code for a couple days now, no matter what I try I continue to have the same problem..im trying to pass several arguments of different types from one function to a function..but It appears as if some how the parameters are being changed from one function to another, or they're not referencing properly the initial calling function is
the problem is, when i look at x and y init_gemstone() (below) the values change from 1,0 to something like 12942342,12942342 (very large and x=y)Code:bool draw_gemstones(struct PacmanBoard* pcmb_p){ struct Gemstone *gemstn_p=(struct Gemstone*)malloc(sizeof(Gemstone)); construct_gemstone(gemstn_p); init_gemstones(gemstn_p,pcmb_p,0.5,1,0); draw_Polygon(gemstn_p->gemstone); destruct_Polygon(gemstn_p->gemstone); return true; }
when i have been trying to debug i place a break point at the lineCode:bool init_gemstones(struct Gemstone* gem_p,struct PacmanBoard* pcmb_p,double size,int x,int y){ //get dimensions of individual cell double cell_w = pcmb_p->width / (double)(pcmb_p->ncells_x); double cell_h = pcmb_p->height / (double)(pcmb_p->ncells_y); struct Point* points = (struct Point*)malloc(4*sizeof(Point)); //find center position of cell gem_p->position->x=-1+(x*cell_w)+(cell_w/2); //BREAK POINT gem_p->position->y=1-(y*cell_h)+(cell_h/2); points[0].x=gem_p->position->x-cell_w*(size/2); points[0].y=gem_p->position->y; points[1].x=gem_p->position->x; points[1].y=gem_p->position->y+cell_h*(size/2); points[2].x=points[0].x+size*cell_w; points[2].y=points[0].y; points[3].x=points[1].x; points[3].y=points[1].y-size*cell_h; init_Polygon(gem_p->gemstone, gem_p->position, 4, points, 1.0, 1.0, 1.0); return true; }
gem_p->position->x=-1..., i tried to place a break point at the line below it, but it says the break point will never be hit?
PLEASE HELP..I normally would ask people to help debug my work, but im desperate, ive been staring at this for days now with out accomplishing anything...



LinkBack URL
About LinkBacks



