… | |
… | |
19 | static void roguelike_link_rooms(Room *Rooms,char **maze,int xsize,int ysize); |
19 | static void roguelike_link_rooms(Room *Rooms,char **maze,int xsize,int ysize); |
20 | |
20 | |
21 | |
21 | |
22 | int surround_check(char **layout,int i,int j,int Xsize, int Ysize){ |
22 | int surround_check(char **layout,int i,int j,int Xsize, int Ysize){ |
23 | /* 1 = wall to left, |
23 | /* 1 = wall to left, |
24 | 2 = wall to right, |
24 | 2 = wall to right, |
25 | 4 = wall above |
25 | 4 = wall above |
26 | 8 = wall below */ |
26 | 8 = wall below */ |
27 | int surround_index = 0; |
27 | int surround_index = 0; |
28 | if((i > 0) && (layout[i-1][j]!=0&&layout[i-1][j]!='.')) surround_index +=1; |
28 | if((i > 0) && (layout[i-1][j]!=0&&layout[i-1][j]!='.')) surround_index +=1; |
29 | if((i < Xsize-1) && (layout[i+1][j]!=0&&layout[i+1][j]!='.')) surround_index +=2; |
29 | if((i < Xsize-1) && (layout[i+1][j]!=0&&layout[i+1][j]!='.')) surround_index +=2; |
30 | if((j > 0) && (layout[i][j-1]!=0&&layout[i][j-1]!='.')) surround_index +=4; |
30 | if((j > 0) && (layout[i][j-1]!=0&&layout[i][j-1]!='.')) surround_index +=4; |
31 | if((j < Ysize-1) && (layout[i][j+1]!=0&&layout[i][j+1]!='.')) surround_index +=8; |
31 | if((j < Ysize-1) && (layout[i][j+1]!=0&&layout[i][j+1]!='.')) surround_index +=8; |
… | |
… | |
104 | * clobber are up exit (above) with a down exit, so put the |
104 | * clobber are up exit (above) with a down exit, so put the |
105 | * other exit one space up/down, depending which is a space |
105 | * other exit one space up/down, depending which is a space |
106 | * and not a wall. |
106 | * and not a wall. |
107 | */ |
107 | */ |
108 | if (maze[walk->x][walk->y+1] == '.') |
108 | if (maze[walk->x][walk->y+1] == '.') |
109 | maze[walk->x][walk->y+1] = '>'; |
109 | maze[walk->x][walk->y+1] = '>'; |
110 | else |
110 | else |
111 | maze[walk->x][walk->y-1] = '>'; |
111 | maze[walk->x][walk->y-1] = '>'; |
112 | } |
112 | } |
113 | else |
113 | else |
114 | maze[walk->x][walk->y] = '>'; |
114 | maze[walk->x][walk->y] = '>'; |
115 | |
115 | |
116 | /* convert all the '.' to 0, we're through with the '.' */ |
116 | /* convert all the '.' to 0, we're through with the '.' */ |