MCPcopy Create free account
hub / github.com/NetHack/NetHack / relmon

Function relmon

src/mon.c:2560–2594  ·  view source on GitHub ↗

release mon from the display and the map's monster list, maybe transfer it to one of the other monster lists */

Source from the content-addressed store, hash-verified

2558/* release mon from the display and the map's monster list,
2559 maybe transfer it to one of the other monster lists */
2560void
2561relmon(
2562 struct monst *mon,
2563 struct monst **monst_list) /* &gm.migrating_mons or &gm.mydogs or null */
2564{
2565 if (!fmon)
2566 panic("relmon: no fmon available.");
2567
2568 /* take 'mon' off the map */
2569 mon_leaving_level(mon);
2570
2571 /* remove 'mon' from the 'fmon' list */
2572 if (mon == fmon) {
2573 fmon = fmon->nmon;
2574 } else {
2575 struct monst *mtmp;
2576
2577 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
2578 if (mtmp->nmon == mon) {
2579 mtmp->nmon = mon->nmon;
2580 break;
2581 }
2582 if (!mtmp)
2583 panic("relmon: mon not in list.");
2584 }
2585
2586 if (monst_list) {
2587 /* insert into gm.mydogs or gm.migrating_mons */
2588 mon->nmon = *monst_list;
2589 *monst_list = mon;
2590 } else {
2591 /* orphan has no next monster */
2592 mon->nmon = 0;
2593 }
2594}
2595
2596void
2597copy_mextra(struct monst *mtmp2, struct monst *mtmp1)

Callers 4

mon_arriveFunction · 0.85
keepdogsFunction · 0.85
migrate_to_levelFunction · 0.85
replmonFunction · 0.85

Calls 2

mon_leaving_levelFunction · 0.85
panicFunction · 0.50

Tested by

no test coverage detected