| 527 | } |
| 528 | |
| 529 | staticfn void |
| 530 | mkswamp(void) /* Michiel Huisjes & Fred de Wilde */ |
| 531 | { |
| 532 | struct mkroom *sroom; |
| 533 | int i, eelct = 0; |
| 534 | coordxy sx, sy; |
| 535 | int rmno; |
| 536 | |
| 537 | for (i = 0; i < 5; i++) { /* turn up to 5 rooms swampy */ |
| 538 | sroom = &svr.rooms[rn2(svn.nroom)]; |
| 539 | if (sroom->hx < 0 || sroom->rtype != OROOM || has_upstairs(sroom) |
| 540 | || has_dnstairs(sroom)) |
| 541 | continue; |
| 542 | |
| 543 | rmno = (int)(sroom - svr.rooms) + ROOMOFFSET; |
| 544 | |
| 545 | /* satisfied; make a swamp */ |
| 546 | sroom->rtype = SWAMP; |
| 547 | for (sx = sroom->lx; sx <= sroom->hx; sx++) |
| 548 | for (sy = sroom->ly; sy <= sroom->hy; sy++) { |
| 549 | if (!IS_ROOM(levl[sx][sy].typ) |
| 550 | || (int) levl[sx][sy].roomno != rmno) |
| 551 | continue; |
| 552 | if (!OBJ_AT(sx, sy) && !MON_AT(sx, sy) && !t_at(sx, sy) |
| 553 | && !nexttodoor(sx, sy)) { |
| 554 | if ((sx + sy) % 2) { |
| 555 | del_engr_at(sx, sy); |
| 556 | levl[sx][sy].typ = POOL; |
| 557 | if (!eelct || !rn2(4)) { |
| 558 | /* mkclass() won't do, as we might get kraken */ |
| 559 | (void) makemon(rn2(5) |
| 560 | ? &mons[PM_GIANT_EEL] |
| 561 | : rn2(2) |
| 562 | ? &mons[PM_PIRANHA] |
| 563 | : &mons[PM_ELECTRIC_EEL], |
| 564 | sx, sy, NO_MM_FLAGS); |
| 565 | eelct++; |
| 566 | } |
| 567 | } else if (!rn2(4)) /* swamps tend to be moldy */ |
| 568 | (void) makemon(mkclass(S_FUNGUS, 0), sx, sy, |
| 569 | NO_MM_FLAGS); |
| 570 | } |
| 571 | } |
| 572 | svl.level.flags.has_swamp = 1; |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | staticfn coord * |
| 577 | shrine_pos(int roomno) |
no test coverage detected