Hi everyone
i have a small problem here
I have this class
class classA{
public:
int *A, *B, *C, *D;
int VA, VB, VC, VD;
void collide();
void commit();
void clean();
void draw(int x, int y);
};
and i am making an array of this class
grid=new classA [width*height];
when i try to setup the items of the array like this
for (int i=0; i<=height; i++) {
for (int j=0;j<=width;j++){
if(i==0){
grid[(i*width)+j].VA=9;
grid[(i*width)+j].A=&grid[(i*width)+j].VA;
}else{
grid[(i*width)+j].A=&grid[((i-1)*width)+j].VC;
}
if(j==0){
grid[(i*width)+j].VB=0;
grid[(i*width)+j].B=&grid[(i*width)+j].VB;
}else{
grid[(i*width)+j].B=&grid[(i*width)+j-1].VD;
}
grid[(i*width)+j].VC=2;
if(i==height-1){
grid[(i*width)+j].VC=9;
}
grid[(i*width)+j].C=&grid[(i*width)+j].VC;
grid[(i*width)+j].VD=0;
grid[(i*width)+j].D=&grid[(i*width)+j].VD;
}
}
I end with class.C beeing equal to class.D and other problems like this
Thank you in advance
[code][/code] tags please.