| 881 | } |
| 882 | |
| 883 | staticfn void |
| 884 | savemonchn(NHFILE *nhfp, struct monst *mtmp) |
| 885 | { |
| 886 | struct monst *mtmp2; |
| 887 | int minusone = -1; |
| 888 | |
| 889 | while (mtmp) { |
| 890 | mtmp2 = mtmp->nmon; |
| 891 | if (update_file(nhfp)) { |
| 892 | mtmp->mnum = monsndx(mtmp->data); |
| 893 | if (mtmp->ispriest) |
| 894 | forget_temple_entry(mtmp); /* EPRI() */ |
| 895 | savemon(nhfp, mtmp); |
| 896 | } |
| 897 | if (mtmp->minvent) |
| 898 | saveobjchn(nhfp, &mtmp->minvent); |
| 899 | if (release_data(nhfp)) { |
| 900 | if (mtmp == svc.context.polearm.hitmon) { |
| 901 | svc.context.polearm.m_id = mtmp->m_id; |
| 902 | svc.context.polearm.hitmon = NULL; |
| 903 | } |
| 904 | if (mtmp == u.ustuck) |
| 905 | u.ustuck_mid = u.ustuck->m_id; |
| 906 | if (mtmp == u.usteed) |
| 907 | u.usteed_mid = u.usteed->m_id; |
| 908 | mtmp->nmon = NULL; /* nmon saved into mtmp2 */ |
| 909 | dealloc_monst(mtmp); |
| 910 | } |
| 911 | mtmp = mtmp2; |
| 912 | } |
| 913 | if (update_file(nhfp)) { |
| 914 | Sfo_int(nhfp, &minusone, "monst-monst_length"); |
| 915 | } |
| 916 | } |
| 917 | |
| 918 | /* save traps; gf.ftrap is the only trap chain so 2nd arg is superfluous */ |
| 919 | staticfn void |
no test coverage detected