* Return 1 (not TRUE - we're doing bit vectors here) if we want to extend * a wall spine in the (dx,dy) direction. Return 0 otherwise. * * To extend a wall spine in that direction, first there must be a wall there. * Then, extend a spine unless the current position is surrounded by walls * in the direction given by (dx,dy). E.g. if 'x' is our location, 'W' * a wall, '.' a room, 'a' anythin
| 163 | * . W W |
| 164 | */ |
| 165 | staticfn int |
| 166 | extend_spine(int locale[3][3], int wall_there, int dx, int dy) |
| 167 | { |
| 168 | int spine, nx, ny; |
| 169 | |
| 170 | nx = 1 + dx; |
| 171 | ny = 1 + dy; |
| 172 | |
| 173 | if (wall_there) { /* wall in that direction */ |
| 174 | if (dx) { |
| 175 | if (locale[1][0] && locale[1][2] /* EW are wall/stone */ |
| 176 | && locale[nx][0] && locale[nx][2]) { /* diag are wall/stone */ |
| 177 | spine = 0; |
| 178 | } else { |
| 179 | spine = 1; |
| 180 | } |
| 181 | } else { /* dy */ |
| 182 | if (locale[0][1] && locale[2][1] /* NS are wall/stone */ |
| 183 | && locale[0][ny] && locale[2][ny]) { /* diag are wall/stone */ |
| 184 | spine = 0; |
| 185 | } else { |
| 186 | spine = 1; |
| 187 | } |
| 188 | } |
| 189 | } else { |
| 190 | spine = 0; |
| 191 | } |
| 192 | |
| 193 | return spine; |
| 194 | } |
| 195 | |
| 196 | /* Remove walls totally surrounded by stone */ |
| 197 | staticfn void |