* TODO: If we really want to remove rooms after a map is plopped down * in a special level, this needs to be rewritten - the maps may have * holes in them ("x" mapchar), leaving parts of rooms still on the map. * * When level processed by join_map is overlaid by a MAP, some rooms may no * longer be valid. All rooms in the region lx <= x < hx, ly <= y < hy are * removed. Rooms partially in
| 376 | * region are all set. |
| 377 | */ |
| 378 | void |
| 379 | remove_rooms(coordxy lx, coordxy ly, coordxy hx, coordxy hy) |
| 380 | { |
| 381 | int i; |
| 382 | struct mkroom *croom; |
| 383 | |
| 384 | for (i = svn.nroom - 1; i >= 0; --i) { |
| 385 | croom = &svr.rooms[i]; |
| 386 | if (croom->hx < lx || croom->lx >= hx || croom->hy < ly |
| 387 | || croom->ly >= hy) |
| 388 | continue; /* no overlap */ |
| 389 | |
| 390 | if (croom->lx < lx || croom->hx >= hx || croom->ly < ly |
| 391 | || croom->hy >= hy) { /* partial overlap */ |
| 392 | /* TODO: ensure remaining parts of room are still joined */ |
| 393 | |
| 394 | if (!croom->irregular) |
| 395 | impossible("regular room in joined map"); |
| 396 | } else { |
| 397 | /* total overlap, remove the room */ |
| 398 | remove_room((unsigned) i); |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | /* |
| 404 | * Remove roomno from the rooms array, decrementing nroom. |
nothing calls this directly
no test coverage detected