as tab is never used in eg. svp.plname or death, no need to mangle those. */
| 337 | |
| 338 | /* as tab is never used in eg. svp.plname or death, no need to mangle those. */ |
| 339 | staticfn void |
| 340 | writexlentry(FILE *rfile, struct toptenentry *tt, int how) |
| 341 | { |
| 342 | #define Fprintf (void) fprintf |
| 343 | #define XLOG_SEP '\t' /* xlogfile field separator. */ |
| 344 | char buf[BUFSZ], tmpbuf[DTHSZ + 1]; |
| 345 | char achbuf[N_ACH * 40]; |
| 346 | |
| 347 | Sprintf(buf, "version=%d.%d.%d", tt->ver_major, tt->ver_minor, |
| 348 | tt->patchlevel); |
| 349 | Sprintf(eos(buf), "%cpoints=%ld%cdeathdnum=%d%cdeathlev=%d", XLOG_SEP, |
| 350 | tt->points, XLOG_SEP, tt->deathdnum, XLOG_SEP, tt->deathlev); |
| 351 | Sprintf(eos(buf), "%cmaxlvl=%d%chp=%d%cmaxhp=%d", XLOG_SEP, tt->maxlvl, |
| 352 | XLOG_SEP, tt->hp, XLOG_SEP, tt->maxhp); |
| 353 | Sprintf(eos(buf), "%cdeaths=%d%cdeathdate=%ld%cbirthdate=%ld%cuid=%d", |
| 354 | XLOG_SEP, tt->deaths, XLOG_SEP, tt->deathdate, XLOG_SEP, |
| 355 | tt->birthdate, XLOG_SEP, tt->uid); |
| 356 | Fprintf(rfile, "%s", buf); |
| 357 | Sprintf(buf, "%crole=%s%crace=%s%cgender=%s%calign=%s", XLOG_SEP, |
| 358 | tt->plrole, XLOG_SEP, tt->plrace, XLOG_SEP, tt->plgend, XLOG_SEP, |
| 359 | tt->plalign); |
| 360 | /* make a copy of death reason that doesn't include ", while helpless" */ |
| 361 | formatkiller(tmpbuf, sizeof tmpbuf, how, FALSE); |
| 362 | Fprintf(rfile, "%s%cname=%s%cdeath=%s", |
| 363 | buf, /* (already includes separator) */ |
| 364 | XLOG_SEP, svp.plname, XLOG_SEP, tmpbuf); |
| 365 | if (gm.multi < 0) |
| 366 | Fprintf(rfile, "%cwhile=%s", XLOG_SEP, |
| 367 | gm.multi_reason ? gm.multi_reason : "helpless"); |
| 368 | Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx", XLOG_SEP, |
| 369 | encodeconduct(), XLOG_SEP, svm.moves, XLOG_SEP, |
| 370 | encodeachieve(FALSE)); |
| 371 | Fprintf(rfile, "%cachieveX=%s", XLOG_SEP, |
| 372 | encode_extended_achievements(achbuf)); |
| 373 | Fprintf(rfile, "%cconductX=%s", XLOG_SEP, |
| 374 | encode_extended_conducts(buf)); /* reuse 'buf[]' */ |
| 375 | Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", XLOG_SEP, |
| 376 | urealtime.realtime, XLOG_SEP, |
| 377 | timet_to_seconds(ubirthday), XLOG_SEP, |
| 378 | timet_to_seconds(urealtime.finish_time)); |
| 379 | Fprintf(rfile, "%cgender0=%s%calign0=%s", XLOG_SEP, |
| 380 | genders[flags.initgend].filecode, XLOG_SEP, |
| 381 | aligns[1 - u.ualignbase[A_ORIGINAL]].filecode); |
| 382 | Fprintf(rfile, "%cflags=0x%lx", XLOG_SEP, encodexlogflags()); |
| 383 | Fprintf(rfile, "%cgold=%ld", XLOG_SEP, |
| 384 | money_cnt(gi.invent) + hidden_gold(TRUE)); |
| 385 | Fprintf(rfile, "%cwish_cnt=%ld", XLOG_SEP, u.uconduct.wishes); |
| 386 | Fprintf(rfile, "%carti_wish_cnt=%ld", XLOG_SEP, u.uconduct.wisharti); |
| 387 | Fprintf(rfile, "%cbones=%ld", XLOG_SEP, u.uroleplay.numbones); |
| 388 | Fprintf(rfile, "%crerolls=%ld", XLOG_SEP, u.uroleplay.numrerolls); |
| 389 | Fprintf(rfile, "\n"); |
| 390 | #undef XLOG_SEP |
| 391 | } |
| 392 | |
| 393 | staticfn long |
| 394 | encodexlogflags(void) |
no test coverage detected