the code that checks for the shot at the beginning of my else if statement is...check_shot..
it looks like this..
bool ship::check_space(char dir, int col, int row, ocean field)
{
if(dir == 'v') // place vertical
{
for(int i(0); i<length; i++)
if(field.get_cell(row+i, col) != '~')
return false;
}
else // place horizontal
{
for(int i(0); i<length; i++)
if(field.get_cell(row, col+i) != '~')
return false;
}
return true;
}
this code was provided for us by the teacher...but i thought i'd put it on here for reference for you