| 410 | } |
| 411 | |
| 412 | staticfn boolean |
| 413 | put_lregion_here( |
| 414 | coordxy x, coordxy y, |
| 415 | coordxy nlx, coordxy nly, coordxy nhx, coordxy nhy, |
| 416 | xint16 rtype, |
| 417 | boolean oneshot, |
| 418 | d_level *lev) |
| 419 | { |
| 420 | struct monst *mtmp; |
| 421 | |
| 422 | if (bad_location(x, y, nlx, nly, nhx, nhy) |
| 423 | || is_exclusion_zone(rtype, x, y)) { |
| 424 | if (!oneshot) { |
| 425 | return FALSE; /* caller should try again */ |
| 426 | } else { |
| 427 | /* Must make do with the only location possible; |
| 428 | avoid failure due to a misplaced trap. |
| 429 | It might still fail if there's a dungeon feature here. */ |
| 430 | struct trap *t = t_at(x, y); |
| 431 | |
| 432 | if (t && !undestroyable_trap(t->ttyp)) { |
| 433 | if (((mtmp = m_at(x, y)) != 0) && mtmp->mtrapped) |
| 434 | mtmp->mtrapped = 0; |
| 435 | deltrap(t); |
| 436 | } |
| 437 | if (bad_location(x, y, nlx, nly, nhx, nhy) |
| 438 | || is_exclusion_zone(rtype, x, y)) |
| 439 | return FALSE; |
| 440 | } |
| 441 | } |
| 442 | switch (rtype) { |
| 443 | case LR_TELE: |
| 444 | case LR_UPTELE: |
| 445 | case LR_DOWNTELE: |
| 446 | /* "something" means the player in this case */ |
| 447 | if ((mtmp = m_at(x, y)) != 0) { |
| 448 | /* move the monster if no choice, or just try again */ |
| 449 | if (oneshot) { |
| 450 | if (!rloc(mtmp, RLOC_NOMSG)) |
| 451 | m_into_limbo(mtmp); |
| 452 | } else |
| 453 | return FALSE; |
| 454 | } |
| 455 | u_on_newpos(x, y); |
| 456 | break; |
| 457 | case LR_PORTAL: |
| 458 | mkportal(x, y, lev->dnum, lev->dlevel); |
| 459 | break; |
| 460 | case LR_DOWNSTAIR: |
| 461 | case LR_UPSTAIR: |
| 462 | mkstairs(x, y, (char) rtype, (struct mkroom *) 0, FALSE); |
| 463 | break; |
| 464 | case LR_BRANCH: |
| 465 | place_branch(Is_branchlev(&u.uz), x, y); |
| 466 | break; |
| 467 | } |
| 468 | return TRUE; |
| 469 | } |
no test coverage detected