Hello,
I am havinf some trouble using a function in a function. The original function I am using I know works as it has been tested and is shown here:
Code:
void drawCorridorNS(int aPos, int bPos, char **map, int randX, int randY, int a, int b){
int s,t ;
for(s = randY; s <= a; s = s + aPos){
map[randX][s] = ' ';
}
for(t = randX; t <= b; t = t + bPos){
map[t][s] = ' '; //retrace path and change characters to space
}
connected--;
randLimit = 0;
}
Now I wish to use this function in another function as shown here:
Code:
void lookAlongNS (int direction, int look, char **map, int randX, int randY, int mapSizeX, int a){
int b;
for(b = randX; b < mapSizeX; b++){
if (map[b][a] == WALL){
//j = a k = b
if((map[b+1][a] == ' ') || (map[b][a+direction] == ' ')){
if(direction == 1){
drawCorridorNS(1,1,map,randX,randY,a,b);
}
else{
drawCorridorNS(-1,1,map,randX,randY,a,b);
}
}
}
else{
b = mapX;
}
}
for(b = randX; b < 1; b--){
if (map[b][a] == WALL){
//j = a k = b
if((map[b-1][a] == ' ') || (map[b][a+direction] == ' ')){
if(direction == 1){
drawCorridorNS(1,-1,map,randX,randY,a,b);
}
else{
drawCorridorNS(-1,-1,map,randX,randY,a,b);
}
}
}
else{
b = 1;
}
}
}
While this compiles the function is just not working and I was wondering if anyone could see anything I'm doing which isn't allowed.
Thanks in advance