release mon from the display and the map's monster list, maybe transfer it to one of the other monster lists */
| 2558 | /* release mon from the display and the map's monster list, |
| 2559 | maybe transfer it to one of the other monster lists */ |
| 2560 | void |
| 2561 | relmon( |
| 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 | |
| 2596 | void |
| 2597 | copy_mextra(struct monst *mtmp2, struct monst *mtmp1) |
no test coverage detected