outrip() updating (trunk only)

Part II of the bones tracking patch.  Change umpteen different outrip()
routines to handle its new time_t argument, and use formatkiller() instead
of directly accessing killer.{format,name} and killed_by_prefix[].  The
latter is now static within formatkiller().

     The many sys/* and win/* changes are untested....
This commit is contained in:
nethack.rankin
2012-01-24 04:26:33 +00:00
parent 9721470635
commit a871ad06e9
19 changed files with 80 additions and 172 deletions

View File

@@ -896,9 +896,10 @@ void X11_start_screen() { return; } /* called from setftty() in unixtty.c */
void X11_end_screen() { return; } /* called from settty() in unixtty.c */
#ifdef GRAPHIC_TOMBSTONE
void X11_outrip(window, how)
void X11_outrip(window, how, when)
winid window;
int how;
time_t when;
{
struct xwindow *wp;
@@ -911,7 +912,7 @@ void X11_outrip(window, how)
panic("ripout on non-text window (window type [%d])", wp->type);
}
calculate_rip_text(how);
calculate_rip_text(how, when);
}
#endif

View File

@@ -453,16 +453,15 @@ static XImage* rip_image=0;
static char rip_line[YEAR_LINE+1][STONE_LINE_LEN+1];
extern const char *killed_by_prefix[];
void
calculate_rip_text(int how)
calculate_rip_text(int how, time_t when)
{
/* Follows same algorithm as genl_outrip() */
char buf[BUFSZ];
char *dpx;
int line;
long year;
/* Put name on stone */
Sprintf(rip_line[NAME_LINE], "%s", plname);
@@ -475,20 +474,7 @@ calculate_rip_text(int how)
done_money);
#endif
/* Put together death description */
switch (killer.format) {
default: impossible("bad killer format?");
case KILLED_BY_AN:
Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, an(killer.name));
break;
case KILLED_BY:
Strcpy(buf, killed_by_prefix[how]);
Strcat(buf, killer.name);
break;
case NO_KILLER_PREFIX:
Strcpy(buf, killer.name);
break;
}
formatkiller(buf, sizeof buf, how);
/* Put death type on stone */
for (line=DEATH_LINE, dpx = buf; line<YEAR_LINE; line++) {
@@ -511,7 +497,8 @@ calculate_rip_text(int how)
}
/* Put year on stone */
Sprintf(rip_line[YEAR_LINE], "%4d", getyear());
year = yyyymmdd(when) / 10000L;
Sprintf(rip_line[YEAR_LINE], "%4ld", year);
}