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

Function get_saved_pline

src/report.c:570–592  ·  view source on GitHub ↗

lineno==0 gives the most recent message (e.g. "Do you want to call panic..." if called from #panic) */

Source from the content-addressed store, hash-verified

568/* lineno==0 gives the most recent message (e.g.
569 "Do you want to call panic..." if called from #panic) */
570const char *
571get_saved_pline(int lineno USED_if_dumplog)
572{
573#ifdef DUMPLOG_CORE
574 int p;
575 int limit = DUMPLOG_MSG_COUNT;
576
577 if (lineno >= DUMPLOG_MSG_COUNT)
578 return NULL;
579 p = (gs.saved_pline_index - 1) % DUMPLOG_MSG_COUNT;
580
581 while (limit--) {
582 if (gs.saved_plines[p]) { /* valid line */
583 if (lineno--) {
584 p = (p - 1 + DUMPLOG_MSG_COUNT) % DUMPLOG_MSG_COUNT;
585 } else {
586 return gs.saved_plines[p];
587 }
588 }
589 }
590#endif /* DUMPLOG_CORE */
591 return NULL;
592}
593
594#undef USED_if_dumplog
595

Callers 1

submit_web_reportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected