bones tracking (trunk only)
[See cvs log for include/rm.h or doc/window.doc for more complete description.] Attach hero info, death reason, and date+time to a level that's being saved as bones. Read such data back when loading a bones file, then treat it as part of that level for the rest of the game. Dying on a loaded bones file will chain the new hero+death+date to previous one(s) if new bones get saved. outrip() now takes an extra argument of type time_t, and interface-specific implementations of this routine need to be updated to handle that.
This commit is contained in:
24
src/end.c
24
src/end.c
@@ -830,6 +830,7 @@ int how;
|
||||
winid endwin = WIN_ERR;
|
||||
boolean bones_ok, have_windows = iflags.window_inited;
|
||||
struct obj *corpse = (struct obj *)0;
|
||||
time_t endtime;
|
||||
long umoney;
|
||||
long tmp;
|
||||
|
||||
@@ -909,6 +910,11 @@ die:
|
||||
if (thrownobj && thrownobj->where == OBJ_FREE) dealloc_obj(thrownobj);
|
||||
if (kickedobj && kickedobj->where == OBJ_FREE) dealloc_obj(kickedobj);
|
||||
|
||||
/* remember time of death here instead of having bones, rip, and
|
||||
topten figure it out separately and possibly getting different
|
||||
time or even day if player is slow responding to --More-- */
|
||||
endtime = getnow();
|
||||
|
||||
/* Sometimes you die on the first move. Life's not fair.
|
||||
* On those rare occasions you get hosed immediately, go out
|
||||
* smiling... :-) -3.
|
||||
@@ -1035,7 +1041,7 @@ die:
|
||||
#ifdef WIZARD
|
||||
if (!wizard || paranoid_query(ParanoidBones, "Save bones?"))
|
||||
#endif
|
||||
savebones(corpse);
|
||||
savebones(how, endtime, corpse);
|
||||
/* corpse may be invalid pointer now so
|
||||
ensure that it isn't used again */
|
||||
corpse = (struct obj *)0;
|
||||
@@ -1067,7 +1073,7 @@ die:
|
||||
endwin = create_nhwindow(NHW_TEXT);
|
||||
|
||||
if (how < GENOCIDED && flags.tombstone && endwin != WIN_ERR)
|
||||
outrip(endwin, how);
|
||||
outrip(endwin, how, endtime);
|
||||
} else
|
||||
done_stopprint = 1; /* just avoid any more output */
|
||||
|
||||
@@ -1220,15 +1226,11 @@ die:
|
||||
|
||||
/* "So when I die, the first thing I will see in Heaven is a
|
||||
* score list?" */
|
||||
if (iflags.toptenwin) {
|
||||
topten(how);
|
||||
if (have_windows)
|
||||
exit_nhwindows((char *)0);
|
||||
} else {
|
||||
if (have_windows)
|
||||
exit_nhwindows((char *)0);
|
||||
topten(how);
|
||||
}
|
||||
if (have_windows && !iflags.toptenwin)
|
||||
exit_nhwindows((char *)0), have_windows = FALSE;
|
||||
topten(how, endtime);
|
||||
if (have_windows)
|
||||
exit_nhwindows((char *)0);
|
||||
|
||||
if(done_stopprint) { raw_print(""); raw_print(""); }
|
||||
terminate(EXIT_SUCCESS);
|
||||
|
||||
Reference in New Issue
Block a user