Itskata
07-24-2001, 12:55 AM
Hi!
Can someone tell me how to remove the errors form this part of my game. I'll be very happy to see that someone tries to solve my little problem with the 2-dimestional array.
//I tried in that way
//Here is the code
int CheckCpt(float x,float y,int objects[26][26],int im){
int x1=(int)x++;
int x2=(int)x--;
if(objects[x1][y]>0){
//main.cpp(70) : error C2108: //subscript is not of integral type
im=1;
}
if(objects[x2][y]>0){ //main.cpp(70) : error C2108: //subscript is not of integral type im=2;
}
return im;
}
//And then I tried in that way
//Here is the code
int CheckCpt(float x,float y,int objects[26][26],int im){
if(objects[x++][y]>0){
//main.cpp(70) : error C2108: //subscript is not of integral type
im=1;
}
if(objects[x--][y]>0){
//main.cpp(70) : error C2108: //subscript is not of integral type
im=2;
}
return im;
}
And in the both two ways there are the same errors.PLEASE help me.
Can someone tell me how to remove the errors form this part of my game. I'll be very happy to see that someone tries to solve my little problem with the 2-dimestional array.
//I tried in that way
//Here is the code
int CheckCpt(float x,float y,int objects[26][26],int im){
int x1=(int)x++;
int x2=(int)x--;
if(objects[x1][y]>0){
//main.cpp(70) : error C2108: //subscript is not of integral type
im=1;
}
if(objects[x2][y]>0){ //main.cpp(70) : error C2108: //subscript is not of integral type im=2;
}
return im;
}
//And then I tried in that way
//Here is the code
int CheckCpt(float x,float y,int objects[26][26],int im){
if(objects[x++][y]>0){
//main.cpp(70) : error C2108: //subscript is not of integral type
im=1;
}
if(objects[x--][y]>0){
//main.cpp(70) : error C2108: //subscript is not of integral type
im=2;
}
return im;
}
And in the both two ways there are the same errors.PLEASE help me.