関数の最後のreturnでアプリケーションエラーがでてしまうのですが、
どうすればなおるのでしょうか?
その関数部分のみ貼っておきます。
int mitudo(const int field[FIELD_HEIGHT][FIELD_WIDTH], const int block[BLOCK_SIZE][BLOCK_SIZE], int posX, int xMin, int xMax){
int sField[FIELD_HEIGHT][BLOCK_SIZE];
int sBlock[BLOCK_SIZE][BLOCK_SIZE];
int aki;
for(int y = 0; y < FIELD_HEIGHT; y++){
int x2;
for(int x = 0, x2 = posX-BLOCK_SIZE/2; x < BLOCK_SIZE; x++,x2++){
sField[y][x]=field[y][x2];
}
}
for(int y = 0; y < BLOCK_SIZE; y++){
int x2;
for(int x = 0, x2 = xMin; x < BLOCK_SIZE; x++,x2++){
sBlock[y][x]=block[y][x2];
}
}
int Fitflg=0, posY=0;
while(!Fitflg){
for(int y=BLOCK_SIZE-1;y>=0&&!Fitflg;y--)
{ for(int x=0;x<BLOCK_SIZE&&!Fitflg;x++)
{ //ブロックが存在すれば
if(sBlock[y][x]!=0)
{//フィールド上の座標を取得
int fy = posY + y;
int fx = x;
//縦幅チェック
if(FIELD_HEIGHT < fy || sField[fy][fx]!=0)
{
posY--;
for(int y2=0;y2<BLOCK_SIZE;y2++){
for(int x2=0;x2<BLOCK_SIZE;x2++){
sField[posY+y2][x2]=sBlock[y2][x2];
}
}
Fitflg++;
}
}
}
}
posY++;
}
int lastY;
aki=0;
for(int x=0;x<BLOCK_SIZE;x++){
for(int y=0; y<FIELD_HEIGHT; y++){
if(sField[y][x]){
lastY=y;
}
}
for(int y=FIELD_HEIGHT-1;y>lastY;y--){
if(!sField[y][x]) aki++;
}
}
return aki; //←この部分でアプリケーションエラーと出る
}
よろしくお願いします。