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

Function topten

src/topten.c:627–926  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

625}
626
627void
628topten(int how, time_t when)
629{
630 struct toptenentry *t0, *tprev;
631 struct toptenentry *t1;
632 FILE *rfile;
633#ifdef LOGFILE
634 FILE *lfile;
635#endif
636#ifdef XLOGFILE
637 FILE *xlfile;
638#endif
639 int uid = getuid();
640 int rank, rank0 = -1, rank1 = 0;
641 int occ_cnt = sysopt.persmax;
642 int flg = 0;
643 boolean t0_used, skip_scores;
644
645#ifdef UPDATE_RECORD_IN_PLACE
646 final_fpos = 0L;
647#endif
648 /* If we are in the midst of a panic, cut out topten entirely.
649 * topten uses alloc() several times, which will lead to
650 * problems if the panic was the result of an alloc() failure.
651 */
652 if (program_state.panicking)
653 return;
654
655 if (iflags.toptenwin) {
656 gt.toptenwin = create_nhwindow(NHW_TEXT);
657 }
658
659#if defined(HANGUPHANDLING)
660#define HUP if (!program_state.done_hup)
661#else
662#define HUP
663#endif
664
665#ifdef TOS
666 restore_colors(); /* make sure the screen is black on white */
667#endif
668 /* create a new 'topten' entry */
669 t0_used = FALSE;
670 t0 = newttentry();
671 *t0 = zerott;
672 t0->ver_major = VERSION_MAJOR;
673 t0->ver_minor = VERSION_MINOR;
674 t0->patchlevel = PATCHLEVEL;
675 t0->points = u.urexp;
676 t0->deathdnum = u.uz.dnum;
677 /* deepest_lev_reached() is in terms of depth(), and reporting the
678 * deepest level reached in the dungeon death occurred in doesn't
679 * seem right, so we have to report the death level in depth() terms
680 * as well (which also seems reasonable since that's all the player
681 * sees on the screen anyway)
682 */
683 t0->deathlev = observable_depth(&u.uz);
684 t0->maxlvl = deepest_lev_reached(TRUE);

Callers 1

really_doneFunction · 0.85

Calls 15

getuidFunction · 0.85
restore_colorsFunction · 0.85
observable_depthFunction · 0.85
deepest_lev_reachedFunction · 0.85
copyncharsFunction · 0.85
formatkillerFunction · 0.85
yyyymmddFunction · 0.85
writeentryFunction · 0.85
fcloseFunction · 0.85
unlock_fileFunction · 0.85
writexlentryFunction · 0.85
topten_printFunction · 0.85

Tested by

no test coverage detected