version 1.25 | | version 1.26 |
---|
| | |
/* | | /* |
* static char *rcsid_random_map_c = | | * static char *rcsid_random_map_c = |
* "$Id: random_map.c,v 1.25 2001/05/15 06:50:07 mardahl Exp $"; | | * "$Id: random_map.c,v 1.26 2001/05/15 09:10:59 mardahl Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
} | | } |
if(cx < cy) make_wall(maze,dx,dy,0); | | if(cx < cy) make_wall(maze,dx,dy,0); |
else make_wall(maze,dx,dy,1); | | else make_wall(maze,dx,dy,1); |
continue; | | |
} | | } |
} | | } |
| | |
| | |
{ | | { |
int y = dy; | | int y = dy; |
for(i1=dx-1;i1>0;i1--) { | | for(i1=dx-1;i1>0;i1--) { |
int sindex=surround_flag(maze,i1,y,RP); | | int sindex=surround_flag2(maze,i1,y,RP); |
if(sindex == 1) break; | | if(sindex == 1) break; |
if(sindex != 0) return -1; /* can't make horiz. wall here */ | | if(sindex != 0) return -1; /* can't make horiz. wall here */ |
| | if(maze[i1][y]!=0) return -1; /* can't make horiz. wall here */ |
length++; | | length++; |
} | | } |
| | |
for(i1=dx+1;i1<RP->Xsize-1;i1++) { | | for(i1=dx+1;i1<RP->Xsize-1;i1++) { |
int sindex=surround_flag(maze,i1,y,RP); | | int sindex=surround_flag2(maze,i1,y,RP); |
if(sindex == 2) break; | | if(sindex == 2) break; |
if(sindex != 0) return -1; /* can't make horiz. wall here */ | | if(sindex != 0) return -1; /* can't make horiz. wall here */ |
| | if(maze[i1][y]!=0) return -1; /* can't make horiz. wall here */ |
length++; | | length++; |
} | | } |
return length; | | return length; |
| | |
else { /* vertical */ | | else { /* vertical */ |
int x = dx; | | int x = dx; |
for(i1=dy-1;i1>0;i1--) { | | for(i1=dy-1;i1>0;i1--) { |
int sindex=surround_flag(maze,x,i1,RP); | | int sindex=surround_flag2(maze,x,i1,RP); |
if(sindex == 4) break; | | if(sindex == 4) break; |
if(sindex != 0) return -1; /* can't make vert. wall here */ | | if(sindex != 0) return -1; /* can't make vert. wall here */ |
| | if(maze[x][i1]!=0) return -1; /* can't make horiz. wall here */ |
length++; | | length++; |
} | | } |
| | |
for(i1=dy+1;i1<RP->Ysize-1;i1++) { | | for(i1=dy+1;i1<RP->Ysize-1;i1++) { |
int sindex=surround_flag(maze,x,i1,RP); | | int sindex=surround_flag2(maze,x,i1,RP); |
if(sindex == 8) break; | | if(sindex == 8) break; |
if(sindex != 0) return -1; /* can't make verti. wall here */ | | if(sindex != 0) return -1; /* can't make verti. wall here */ |
| | if(maze[x][i1]!=0) return -1; /* can't make horiz. wall here */ |
length++; | | length++; |
} | | } |
return length; | | return length; |