when arriving on a level, if hero and a monster are trying to share same spot, move one; extracted from goto_level(); also used by wiz_makemap() */
| 1409 | /* when arriving on a level, if hero and a monster are trying to share same |
| 1410 | spot, move one; extracted from goto_level(); also used by wiz_makemap() */ |
| 1411 | void |
| 1412 | u_collide_m(struct monst *mtmp) |
| 1413 | { |
| 1414 | coord cc; |
| 1415 | |
| 1416 | if (!mtmp || mtmp == u.usteed || mtmp != m_at(u.ux, u.uy)) { |
| 1417 | impossible("level arrival collision: %s?", |
| 1418 | !mtmp ? "no monster" |
| 1419 | : (mtmp == u.usteed) ? "steed is on map" |
| 1420 | : "monster not co-located"); |
| 1421 | return; |
| 1422 | } |
| 1423 | |
| 1424 | /* There's a monster at your target destination; it might be one |
| 1425 | which accompanied you--see mon_arrive(dogmove.c)--or perhaps |
| 1426 | it was already here. Randomly move you to an adjacent spot |
| 1427 | or else the monster to any nearby location. Prior to 3.3.0 |
| 1428 | the latter was done unconditionally. */ |
| 1429 | if (!rn2(2) && enexto(&cc, u.ux, u.uy, gy.youmonst.data) |
| 1430 | && next2u(cc.x, cc.y)) |
| 1431 | u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/ |
| 1432 | else |
| 1433 | mnexto(mtmp, RLOC_NOMSG); |
| 1434 | |
| 1435 | if ((mtmp = m_at(u.ux, u.uy)) != 0) { |
| 1436 | /* there was an unconditional impossible("mnexto failed") |
| 1437 | here, but it's not impossible and we're prepared to cope |
| 1438 | with the situation, so only say something when debugging */ |
| 1439 | if (wizard) |
| 1440 | pline("(monster in hero's way)"); |
| 1441 | if (!rloc(mtmp, RLOC_NOMSG) || (mtmp = m_at(u.ux, u.uy)) != 0) |
| 1442 | /* no room to move it; send it away, to return later */ |
| 1443 | m_into_limbo(mtmp); |
| 1444 | } |
| 1445 | } |
| 1446 | |
| 1447 | staticfn void |
| 1448 | familiar_level_msg(void) |
no test coverage detected