MCPcopy Index your code
hub / github.com/NetHack/NetHack / makemap_prepost

Function makemap_prepost

src/cmd.c:985–1067  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983}
984
985void
986makemap_prepost(boolean pre, boolean wiztower)
987{
988 NHFILE *tmpnhfp;
989 struct monst *mtmp;
990
991 if (pre) {
992 makemap_remove_mons();
993 rm_mapseen(ledger_no(&u.uz)); /* discard overview info for level */
994 {
995 static const char Unachieve[] = "%s achievement revoked.";
996
997 /* achievement tracking; if replacing a level that has a
998 special prize, lose credit for previously finding it and
999 reset for the new instance of that prize */
1000 if (Is_mineend_level(&u.uz)) {
1001 if (remove_achievement(ACH_MINE_PRIZE))
1002 pline(Unachieve, "Mine's-end");
1003 svc.context.achieveo.mines_prize_oid = 0;
1004 } else if (Is_sokoend_level(&u.uz)) {
1005 if (remove_achievement(ACH_SOKO_PRIZE))
1006 pline(Unachieve, "Soko-prize");
1007 svc.context.achieveo.soko_prize_oid = 0;
1008 }
1009 }
1010 if (Punished) {
1011 ballrelease(FALSE);
1012 unplacebc();
1013 }
1014 /* reset lock picking unless it's for a carried container */
1015 maybe_reset_pick((struct obj *) 0);
1016 /* reset interrupted digging if it was taking place on this level */
1017 if (on_level(&svc.context.digging.level, &u.uz))
1018 (void) memset((genericptr_t) &svc.context.digging, 0,
1019 sizeof (struct dig_info));
1020 /* reset cached targets */
1021 iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination */
1022 svc.context.polearm.hitmon = (struct monst *) 0; /* polearm target */
1023 /* escape from trap */
1024 reset_utrap(FALSE);
1025 check_special_room(TRUE); /* room exit */
1026 (void) memset((genericptr_t) &svd.dndest, 0, sizeof (dest_area));
1027 (void) memset((genericptr_t) &svu.updest, 0, sizeof (dest_area));
1028 u.ustuck = (struct monst *) 0;
1029 u.uswallow = u.uswldtim = 0;
1030 set_uinwater(0); /* u.uinwater = 0 */
1031 u.uundetected = 0; /* not hidden, even if means are available */
1032 dmonsfree(); /* purge dead monsters from 'fmon' */
1033 dobjsfree();
1034
1035 /* discard current level; "saving" is used to release dynamic data */
1036 tmpnhfp = get_freeing_nhfile();
1037 savelev(tmpnhfp, ledger_no(&u.uz));
1038 close_nhfile(tmpnhfp);
1039 } else {
1040 vision_reset();
1041 gv.vision_full_recalc = 1;
1042 cls();

Callers 3

wiz_makemapFunction · 0.85
lspo_reset_levelFunction · 0.85
lspo_finalize_levelFunction · 0.85

Calls 15

makemap_remove_monsFunction · 0.85
rm_mapseenFunction · 0.85
ledger_noFunction · 0.85
remove_achievementFunction · 0.85
ballreleaseFunction · 0.85
unplacebcFunction · 0.85
maybe_reset_pickFunction · 0.85
on_levelFunction · 0.85
reset_utrapFunction · 0.85
check_special_roomFunction · 0.85
set_uinwaterFunction · 0.85
dmonsfreeFunction · 0.85

Tested by

no test coverage detected