Merge branch 'paxed-xlogfile'
This commit is contained in:
@@ -533,6 +533,13 @@ newgame()
|
||||
#endif
|
||||
program_state.something_worth_saving++; /* useful data now exists */
|
||||
|
||||
u.urealtime.realtime = (time_t)0L;
|
||||
#if defined(BSD) && !defined(POSIX_TYPES)
|
||||
(void) time((long *)&u.urealtime.restored);
|
||||
#else
|
||||
(void) time(&u.urealtime.restored);
|
||||
#endif
|
||||
|
||||
/* Success! */
|
||||
welcome(TRUE);
|
||||
return;
|
||||
|
||||
1
src/do.c
1
src/do.c
@@ -1321,6 +1321,7 @@ boolean at_stairs, falling, portal;
|
||||
#endif
|
||||
You_hear("groans and moans everywhere.");
|
||||
} else pline("It is hot here. You smell smoke...");
|
||||
u.uachieve.enter_gehennom = 1;
|
||||
}
|
||||
/* in case we've managed to bypass the Valley's stairway down */
|
||||
if (Inhell && !Is_valley(&u.uz)) u.uevent.gehennom_entered = 1;
|
||||
|
||||
@@ -672,6 +672,8 @@ struct level_map {
|
||||
{ "wizard1", &wiz1_level },
|
||||
{ "wizard2", &wiz2_level },
|
||||
{ "wizard3", &wiz3_level },
|
||||
{ "minend", &mineend_level },
|
||||
{ "soko1", &sokoend_level },
|
||||
{ X_START, &qstart_level },
|
||||
{ X_LOCATE, &qlocate_level },
|
||||
{ X_GOAL, &nemesis_level },
|
||||
|
||||
@@ -911,6 +911,7 @@ die:
|
||||
topten figure it out separately and possibly getting different
|
||||
time or even day if player is slow responding to --More-- */
|
||||
endtime = getnow();
|
||||
u.urealtime.realtime += (endtime - u.urealtime.restored);
|
||||
|
||||
/* Sometimes you die on the first move. Life's not fair.
|
||||
* On those rare occasions you get hosed immediately, go out
|
||||
|
||||
13
src/invent.c
13
src/invent.c
@@ -240,15 +240,19 @@ struct obj *obj;
|
||||
} else if (obj->otyp == AMULET_OF_YENDOR) {
|
||||
if (u.uhave.amulet) impossible("already have amulet?");
|
||||
u.uhave.amulet = 1;
|
||||
u.uachieve.amulet = 1;
|
||||
} else if (obj->otyp == CANDELABRUM_OF_INVOCATION) {
|
||||
if (u.uhave.menorah) impossible("already have candelabrum?");
|
||||
u.uhave.menorah = 1;
|
||||
u.uachieve.menorah = 1;
|
||||
} else if (obj->otyp == BELL_OF_OPENING) {
|
||||
if (u.uhave.bell) impossible("already have silver bell?");
|
||||
u.uhave.bell = 1;
|
||||
u.uachieve.bell = 1;
|
||||
} else if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
|
||||
if (u.uhave.book) impossible("already have the book?");
|
||||
u.uhave.book = 1;
|
||||
u.uachieve.book = 1;
|
||||
} else if (obj->oartifact) {
|
||||
if (is_quest_artifact(obj)) {
|
||||
if (u.uhave.questart)
|
||||
@@ -258,6 +262,15 @@ struct obj *obj;
|
||||
}
|
||||
set_artifact_intrinsic(obj, 1, W_ART);
|
||||
}
|
||||
if(obj->otyp == LUCKSTONE && obj->record_achieve_special) {
|
||||
u.uachieve.mines_luckstone = 1;
|
||||
obj->record_achieve_special = 0;
|
||||
} else if((obj->otyp == AMULET_OF_REFLECTION ||
|
||||
obj->otyp == BAG_OF_HOLDING) &&
|
||||
obj->record_achieve_special) {
|
||||
u.uachieve.finish_sokoban = 1;
|
||||
obj->record_achieve_special = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1604,6 +1604,8 @@ register struct monst *mtmp;
|
||||
}
|
||||
if(mtmp->iswiz) wizdead();
|
||||
if(mtmp->data->msound == MS_NEMESIS) nemdead();
|
||||
if(mtmp->data == &mons[PM_MEDUSA])
|
||||
u.uachieve.killed_medusa = 1;
|
||||
if(glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph))
|
||||
unmap_object(mtmp->mx, mtmp->my);
|
||||
m_detach(mtmp, mptr);
|
||||
|
||||
@@ -1373,6 +1373,7 @@ dosacrifice()
|
||||
done(ESCAPED);
|
||||
} else { /* super big win */
|
||||
adjalign(10);
|
||||
u.uachieve.ascended = 1;
|
||||
pline("An invisible choir sings, and you are bathed in radiance...");
|
||||
godvoice(altaralign, "Congratulations, mortal!");
|
||||
display_nhwindow(WIN_MESSAGE, FALSE);
|
||||
|
||||
@@ -554,6 +554,12 @@ unsigned int *stuckid, *steedid;
|
||||
mread(fd, (genericptr_t) timebuf, 14);
|
||||
timebuf[14] = '\0';
|
||||
ubirthday = time_from_yyyymmddhhmmss(timebuf);
|
||||
#if defined(BSD) && !defined(POSIX_TYPES)
|
||||
(void) time((long *)&u.urealtime.restored);
|
||||
#else
|
||||
(void) time(&u.urealtime.restored);
|
||||
#endif
|
||||
|
||||
|
||||
set_uasmon();
|
||||
#ifdef CLIPPING
|
||||
|
||||
@@ -307,6 +307,7 @@ register int fd, mode;
|
||||
#ifdef SYSFLAGS
|
||||
bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag));
|
||||
#endif
|
||||
u.urealtime.realtime += (getnow() - u.urealtime.restored);
|
||||
bwrite(fd, (genericptr_t) &u, sizeof(struct you));
|
||||
bwrite(fd, yyyymmddhhmmss(ubirthday), 14);
|
||||
save_killers(fd, mode);
|
||||
|
||||
12
src/sp_lev.c
12
src/sp_lev.c
@@ -1062,6 +1062,18 @@ struct mkroom *croom;
|
||||
mongone(was);
|
||||
}
|
||||
|
||||
/* Nasty hack here: try to determine if this is the Mines or Sokoban
|
||||
* "prize" and then set record_achieve_special (maps to corpsenm)
|
||||
* for the object. That field will later be checked to find out if
|
||||
* the player obtained the prize. */
|
||||
if(otmp->otyp == LUCKSTONE && Is_mineend_level(&u.uz)) {
|
||||
otmp->record_achieve_special = 1;
|
||||
} else if((otmp->otyp == AMULET_OF_REFLECTION ||
|
||||
otmp->otyp == BAG_OF_HOLDING) &&
|
||||
Is_sokoend_level(&u.uz)) {
|
||||
otmp->record_achieve_special = 1;
|
||||
}
|
||||
|
||||
stackobj(otmp);
|
||||
|
||||
} /* if (rn2(100) < o->chance) */
|
||||
|
||||
107
src/topten.c
107
src/topten.c
@@ -65,6 +65,9 @@ STATIC_DCL void FDECL(outentry, (int,struct toptenentry *,BOOLEAN_P));
|
||||
STATIC_DCL void FDECL(discardexcess, (FILE *));
|
||||
STATIC_DCL void FDECL(readentry, (FILE *,struct toptenentry *));
|
||||
STATIC_DCL void FDECL(writeentry, (FILE *,struct toptenentry *));
|
||||
STATIC_DCL void FDECL(writexlentry, (FILE*, struct toptenentry *));
|
||||
STATIC_DCL long FDECL(encodeconduct, (void));
|
||||
STATIC_DCL long FDECL(encodeachieve, (void));
|
||||
STATIC_DCL void FDECL(free_ttlist, (struct toptenentry *));
|
||||
STATIC_DCL int FDECL(classmon, (char *,BOOLEAN_P));
|
||||
STATIC_DCL int FDECL(score_wanted,
|
||||
@@ -292,6 +295,95 @@ struct toptenentry *tt;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define XLOG_SEP "\t" /* xlogfile field separator. */
|
||||
/* as tab is never used in eg. plname or death, no need to mangle those. */
|
||||
STATIC_OVL void
|
||||
writexlentry(rfile,tt)
|
||||
FILE *rfile;
|
||||
struct toptenentry *tt;
|
||||
{
|
||||
char buf[DTHSZ+1];
|
||||
(void)fprintf(rfile,
|
||||
"version=%d.%d.%d"
|
||||
XLOG_SEP "points=%ld"
|
||||
XLOG_SEP "deathdnum=%d"
|
||||
XLOG_SEP "deathlev=%d"
|
||||
XLOG_SEP "maxlvl=%d"
|
||||
XLOG_SEP "hp=%d"
|
||||
XLOG_SEP "maxhp=%d"
|
||||
XLOG_SEP "deaths=%d"
|
||||
XLOG_SEP "deathdate=%d"
|
||||
XLOG_SEP "birthdate=%d"
|
||||
XLOG_SEP "uid=%d",
|
||||
tt->ver_major, tt->ver_minor, tt->patchlevel,
|
||||
tt->points, tt->deathdnum, tt->deathlev,
|
||||
tt->maxlvl, tt->hp, tt->maxhp, tt->deaths,
|
||||
tt->deathdate, tt->birthdate, tt->uid);
|
||||
(void)fprintf(rfile,
|
||||
XLOG_SEP "role=%s"
|
||||
XLOG_SEP "race=%s"
|
||||
XLOG_SEP "gender=%s"
|
||||
XLOG_SEP "align=%s",
|
||||
tt->plrole, tt->plrace, tt->plgend, tt->plalign);
|
||||
(void)fprintf(rfile, XLOG_SEP "name=%s", plname);
|
||||
(void)fprintf(rfile, XLOG_SEP "death=%s", tt->death);
|
||||
(void)fprintf(rfile, XLOG_SEP "conduct=0x%lx", encodeconduct());
|
||||
(void)fprintf(rfile, XLOG_SEP "turns=%ld", moves);
|
||||
(void)fprintf(rfile, XLOG_SEP "achieve=0x%lx", encodeachieve());
|
||||
(void)fprintf(rfile, XLOG_SEP "realtime=%ld", (long)u.urealtime.realtime);
|
||||
(void)fprintf(rfile, XLOG_SEP "starttime=%ld", (long)ubirthday);
|
||||
(void)fprintf(rfile, XLOG_SEP "endtime=%ld", (long)u.urealtime.endtime);
|
||||
(void)fprintf(rfile, XLOG_SEP "gender0=%s", genders[flags.initgend].filecode);
|
||||
(void)fprintf(rfile, XLOG_SEP "align0=%s",
|
||||
aligns[1 - u.ualignbase[A_ORIGINAL]].filecode);
|
||||
fprintf(rfile, "\n");
|
||||
}
|
||||
#undef XLOG_SEP
|
||||
|
||||
long
|
||||
encodeconduct(void)
|
||||
{
|
||||
long e = 0L;
|
||||
|
||||
if(!u.uconduct.food) e |= 1L << 0;
|
||||
if(!u.uconduct.unvegan) e |= 1L << 1;
|
||||
if(!u.uconduct.unvegetarian) e |= 1L << 2;
|
||||
if(!u.uconduct.gnostic) e |= 1L << 3;
|
||||
if(!u.uconduct.weaphit) e |= 1L << 4;
|
||||
if(!u.uconduct.killer) e |= 1L << 5;
|
||||
if(!u.uconduct.literate) e |= 1L << 6;
|
||||
if(!u.uconduct.polypiles) e |= 1L << 7;
|
||||
if(!u.uconduct.polyselfs) e |= 1L << 8;
|
||||
if(!u.uconduct.wishes) e |= 1L << 9;
|
||||
if(!u.uconduct.wisharti) e |= 1L << 10;
|
||||
if(!num_genocides()) e |= 1L << 11;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
long
|
||||
encodeachieve(void)
|
||||
{
|
||||
long r = 0L;
|
||||
|
||||
if(u.uachieve.bell) r |= 1L << 0;
|
||||
if(u.uachieve.enter_gehennom) r |= 1L << 1;
|
||||
if(u.uachieve.menorah) r |= 1L << 2;
|
||||
if(u.uachieve.book) r |= 1L << 3;
|
||||
if(u.uevent.invoked) r |= 1L << 4;
|
||||
if(u.uachieve.amulet) r |= 1L << 5;
|
||||
if(In_endgame(&u.uz)) r |= 1L << 6;
|
||||
if(Is_astralevel(&u.uz)) r |= 1L << 7;
|
||||
if(u.uachieve.ascended) r |= 1L << 8;
|
||||
if(u.uachieve.mines_luckstone) r |= 1L << 9;
|
||||
if(u.uachieve.finish_sokoban) r |= 1L << 10;
|
||||
if(u.uachieve.killed_medusa) r |= 1L << 11;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
STATIC_OVL void
|
||||
free_ttlist(tt)
|
||||
struct toptenentry *tt;
|
||||
@@ -322,6 +414,9 @@ time_t when;
|
||||
#ifdef LOGFILE
|
||||
FILE *lfile;
|
||||
#endif /* LOGFILE */
|
||||
#ifdef XLOGFILE
|
||||
FILE *xlfile;
|
||||
#endif /* XLOGFILE */
|
||||
|
||||
/* Under DICE 3.0, this crashes the system consistently, apparently due to
|
||||
* corruption of *rfile somewhere. Until I figure this out, just cut out
|
||||
@@ -380,6 +475,7 @@ time_t when;
|
||||
t0->birthdate = yyyymmdd(ubirthday);
|
||||
t0->deathdate = yyyymmdd(when);
|
||||
t0->tt_next = 0;
|
||||
u.urealtime.endtime = when;
|
||||
#ifdef UPDATE_RECORD_IN_PLACE
|
||||
t0->fpos = -1L;
|
||||
#endif
|
||||
@@ -395,6 +491,17 @@ time_t when;
|
||||
unlock_file(LOGFILE);
|
||||
}
|
||||
#endif /* LOGFILE */
|
||||
#ifdef XLOGFILE
|
||||
if (lock_file(XLOGFILE, SCOREPREFIX, 10)) {
|
||||
if(!(xlfile = fopen_datafile(XLOGFILE, "a", SCOREPREFIX))) {
|
||||
HUP raw_print("Cannot open extended log file!");
|
||||
} else {
|
||||
writexlentry(xlfile, t0);
|
||||
(void) fclose(xlfile);
|
||||
}
|
||||
unlock_file(XLOGFILE);
|
||||
}
|
||||
#endif /* XLOGFILE */
|
||||
|
||||
if (wizard || discover) {
|
||||
if (how != PANICKED) HUP {
|
||||
|
||||
Reference in New Issue
Block a user