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

Function writeentry

src/topten.c:300–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300staticfn void
301writeentry(FILE *rfile, struct toptenentry *tt)
302{
303 static const char fmt32[] = "%c%c "; /* role,gender */
304 static const char fmt33[] = "%s %s %s %s "; /* role,race,gndr,algn */
305#ifndef NO_SCAN_BRACK
306 static const char fmt0[] = "%d.%d.%d %ld %d %d %d %d %d %d %ld %ld %d ";
307 static const char fmtX[] = "%s,%s\n";
308#else /* NO_SCAN_BRACK */
309 static const char fmt0[] = "%d %d %d %ld %d %d %d %d %d %d %ld %ld %d ";
310 static const char fmtX[] = "%s %s\n";
311
312 nsb_mung_line(tt->name);
313 nsb_mung_line(tt->death);
314#endif
315
316 (void) fprintf(rfile, fmt0, tt->ver_major, tt->ver_minor, tt->patchlevel,
317 tt->points, tt->deathdnum, tt->deathlev, tt->maxlvl,
318 tt->hp, tt->maxhp, tt->deaths, tt->deathdate,
319 tt->birthdate, tt->uid);
320 if (tt->ver_major < 3 || (tt->ver_major == 3 && tt->ver_minor < 3))
321 (void) fprintf(rfile, fmt32, tt->plrole[0], tt->plgend[0]);
322 else
323 (void) fprintf(rfile, fmt33, tt->plrole, tt->plrace, tt->plgend,
324 tt->plalign);
325 (void) fprintf(rfile, fmtX, onlyspace(tt->name) ? "_" : tt->name,
326 tt->death);
327
328#ifdef NO_SCAN_BRACK
329 nsb_unmung_line(tt->name);
330 nsb_unmung_line(tt->death);
331#endif
332}
333
334RESTORE_WARNING_FORMAT_NONLITERAL
335

Callers 1

toptenFunction · 0.85

Calls 4

nsb_mung_lineFunction · 0.85
fprintfFunction · 0.85
onlyspaceFunction · 0.85
nsb_unmung_lineFunction · 0.85

Tested by

no test coverage detected