]> granicus.if.org Git - nethack/commitdiff
outrip() updating (trunk only)
authornethack.rankin <nethack.rankin>
Tue, 24 Jan 2012 04:26:33 +0000 (04:26 +0000)
committernethack.rankin <nethack.rankin>
Tue, 24 Jan 2012 04:26:33 +0000 (04:26 +0000)
     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....

19 files changed:
include/.gitignore
include/qt_win.h
include/winX.h
include/wingem.h
src/end.c
src/rip.c
src/topten.c
sys/amiga/amirip.c
sys/amiga/winproto.h
sys/wince/mswproc.c
sys/wince/winMS.h
win/Qt/qt_win.cpp
win/X11/winX.c
win/X11/wintext.c
win/gem/wingem.c
win/gnome/gnbind.c
win/gnome/gnbind.h
win/win32/mswproc.c
win/win32/winMS.h

index fa846a3ac201ecb90af409e153ccda0114a5e807..5bae20a5f560729ca53f84b482a075bb24f2077e 100644 (file)
@@ -1,7 +1,3 @@
-pm.h
-vis_tab.h
-onames.h
-date.h
-dgn_comp.h
-tile.h
-lev_comp.h
+.cvsignore
+date.h onames.h pm.h vis_tab.h
+dgn_comp.h lev_comp.h
index 58085745d02bba232fff0f8400daf6b35028c94c..f430ff25bc877c5b076c1945d890b1b1218ea65a 100644 (file)
@@ -1,5 +1,4 @@
 // NetHack 3.5 qt_win.h        $Date$  $Revision$
-//     SCCS Id: @(#)qt_win.h   3.5     1999/11/19
 // Copyright (c) Warwick Allison, 1999.
 // NetHack may be freely redistributed.  See license for details.
 //
@@ -256,7 +255,7 @@ public:
        virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
        virtual void ClipAround(int x,int y);
        virtual void PrintGlyph(int x,int y,int glyph);
-       virtual void UseRIP(int how);
+       virtual void UseRIP(int how, time_t when);
 
        int nhid;
 };
@@ -621,7 +620,7 @@ public:
        virtual bool Destroy();
        virtual void Display(bool block);
        virtual void PutStr(int attr, const char* text);
-       virtual void UseRIP(int how);
+       virtual void UseRIP(int how, time_t when);
 
 public slots:
        void Search();
@@ -839,7 +838,7 @@ public:
        static void qt_start_screen();
        static void qt_end_screen();
 
-       static void qt_outrip(winid wid, int how);
+       static void qt_outrip(winid wid, int how, time_t when);
        static int qt_kbhit();
 
 private:
index 0dc6034be5f24d03814bb17e57a830b57484d2a0..9ceea5fee4a80f43be10fe484e9ca4114449b374 100644 (file)
@@ -349,7 +349,7 @@ E void FDECL(init_text_buffer,(struct text_buffer*));
 E void FDECL(clear_text_buffer,(struct text_buffer*));
 E void FDECL(free_text_buffer,(struct text_buffer*));
 #ifdef GRAPHIC_TOMBSTONE
-E void FDECL(calculate_rip_text, (int));
+E void FDECL(calculate_rip_text, (int,time_t));
 #endif
 
 
@@ -408,9 +408,9 @@ E void NDECL(X11_start_screen);
 E void NDECL(X11_end_screen);
 
 #ifdef GRAPHIC_TOMBSTONE
-E void FDECL(X11_outrip, (winid,int));
+E void FDECL(X11_outrip, (winid,int,time_t));
 #else
-E void FDECL(genl_outrip, (winid,int));
+E void FDECL(genl_outrip, (winid,int,time_t));
 #endif
 
 E void FDECL(X11_preference_update, (const char *));
index 616f38826a642710444a2e8710a69d8102b9e5b7..7eb57b6ff1d5f36b38fcf8f89c178bc04bb0608f 100644 (file)
@@ -105,7 +105,7 @@ E char * NDECL(Gem_get_color_string);
 E void NDECL(Gem_start_screen);
 E void NDECL(Gem_end_screen);
 
-E void FDECL(genl_outrip, (winid,int));
+E void FDECL(genl_outrip, (winid,int,time_t));
 
 #undef E
 
index f6487cb84e2f80f4935ef64279b1f89c78888226..332a6277ab3fd6c5ca80b5cf97ee1307035e6b89 100644 (file)
--- a/src/end.c
+++ b/src/end.c
@@ -283,8 +283,6 @@ static NEARDATA const char *ends[] = {              /* "when you..." */
 
 static boolean Schroedingers_cat = FALSE;
 
-extern const char * const killed_by_prefix[];  /* from topten.c */
-
 /*ARGSUSED*/
 void
 done1(sig_unused)   /* called as signal() handler, so sent at least one arg */
@@ -956,12 +954,9 @@ die:
                        urace.femalenum : urace.malenum;
                }
                corpse = mk_named_object(CORPSE, &mons[mnum],
-                                      u.ux, u.uy, plname);
-               Sprintf(pbuf, "%s, %s%s", plname,
-                       killer.format == NO_KILLER_PREFIX ? "" :
-                       killed_by_prefix[how],
-                       killer.format == KILLED_BY_AN ? an(killer.name) :
-                       killer.name);
+                                        u.ux, u.uy, plname);
+               Sprintf(pbuf, "%s, ", plname);
+               formatkiller(eos(pbuf), sizeof pbuf - strlen(pbuf), how);
                make_grave(u.ux, u.uy, pbuf);
        }
        /* if pets will contribute to score, populate mydogs list now
index 1fe094d844384ee971e265dd380fcf23b8966348..1e39b2377301e2184cc7cd9f364f8358d28960c3 100644 (file)
--- a/src/rip.c
+++ b/src/rip.c
@@ -6,8 +6,6 @@
 
 STATIC_DCL void FDECL(center, (int, char *));
 
-extern const char * const killed_by_prefix[];  /* from topten.c */
-
 #if defined(TTY_GRAPHICS) || defined(X11_GRAPHICS) || defined(GEM_GRAPHICS) || defined(MSWIN_GRAPHICS)
 # define TEXT_TOMBSTONE
 #endif
index 3d0f566681ed25923b3afbff0186527b21e9a3fe..a2d205803a7adecdd7076a4c2cfaeb70120b034a 100644 (file)
@@ -73,12 +73,6 @@ STATIC_DCL void FDECL(nsb_mung_line,(char*));
 STATIC_DCL void FDECL(nsb_unmung_line,(char*));
 #endif
 
-/* must fit with end.c; used in rip.c */
-NEARDATA const char * const killed_by_prefix[] = {
-       "killed by ", "choked on ", "poisoned by ", "died of ", "drowned in ",
-       "burned by ", "dissolved in ", "crushed to death by ", "petrified by ",
-       "turned to slime by ", "killed by ", "", "", "", "", ""
-};
 
 static winid toptenwin = WIN_ERR;
 
@@ -89,6 +83,16 @@ char *buf;
 unsigned siz;
 int how;
 {
+    static NEARDATA const char * const killed_by_prefix[] = {
+       /* DIED, CHOKING, POISONING, STARVING, */
+       "killed by ", "choked on ", "poisoned by ", "died of ",
+       /* DROWNING, BURNING, DISSOLVED, CRUSHING, */
+       "drowned in ", "burned by ", "dissolved in ", "crushed to death by ",
+       /* STONING, TURNED_SLIME, GENOCIDED, */
+       "petrified by ", "turned to slime by ", "killed by ",
+       /* PANICKED, TRICKED, QUIT, ESCAPED, ASCENDED */
+       "", "", "", "", ""
+    };
     unsigned l;
     char *kname = killer.name;
 
index 41875dd380d7bcd65727cfe0db9fd914a4f563f3..a7460258da34447fb6d8c3f95a8a5a7236c95d92 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 amirip.c        $Date$  $Revision$ */
-/*     SCCS Id: @(#)amirip.c   3.5     1996/02/04      */
 /* Copyright (c) Kenneth Lorber, Bethesda, Maryland 1991,1992,1993,1995,1996. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -68,7 +67,6 @@ static xoff, yoff;                    /* image centering */
 # endif
 #endif /* AZTEC_C */
 
-extern char *killed_by_prefix[];
 static struct Window *ripwin=0;
 static void tomb_text(char*);
 static void dofade(int,int,int);
@@ -101,9 +99,10 @@ int wh; /* was local in outrip, but needed for SCALE macro */
 int cmap_white, cmap_black;
 
 void
-amii_outrip( tmpwin, how )
+amii_outrip( tmpwin, how, when )
 winid tmpwin;
 int how;
+time_t when;
 {
     int just_return = 0;
     int done, rtxth;
@@ -113,6 +112,7 @@ int how;
     char buf[ 200 ];
     int line, tw, ww;
     char *errstr = NULL;
+    long year;
 
     if(!WINVERS_AMIV || HackScreen->RastPort.BitMap->Depth < 4)goto cleanup;
 
@@ -153,21 +153,7 @@ int how;
     BltBitMap(*tbmp, 0, 0, rp->BitMap, xoff, yoff, tomb_bmhd.w, tomb_bmhd.h, 0xc0, 0xff, NULL);
 
     /* 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);
 
     tw = TextLength(rp,buf,STONE_LINE_LEN) + 40;
 
@@ -206,21 +192,7 @@ int how;
     tomb_text(buf);
 
     /* 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++)
@@ -255,7 +227,8 @@ int how;
     }
 
     /* Put year on stone */
-    Sprintf(buf, "%4d", getyear());
+    year = yyyymmdd(when) / 10000L;
+    Sprintf(buf, "%4ld", year);
     tomb_text(buf);
 
 #ifdef NH320_DEDICATION
@@ -316,7 +289,7 @@ cleanup:
     if(tbmp[0])FreeImageFiles(load_list, tbmp);
     if(just_return) return;
        /* fall back to the straight-ASCII version */
-    genl_outrip(tmpwin, how);
+    genl_outrip(tmpwin, how, when);
 }
 
 static void tomb_text(p)
index c8becac0c6da0bb0820903766f3a3474da007647..b3abb712c0f78918e73f75a9d6b63cfff62238c5 100644 (file)
@@ -1,5 +1,4 @@
 /* NetHack 3.5 winproto.h      $Date$  $Revision$ */
-/*     SCCS Id: @(#)winproto.h 3.5     1996/01/15      */
 /* Copyright (c) Gregg Wonderly, Naperville, Illinois,  1991,1992,1993. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -140,7 +139,7 @@ void Abort ( long rc );
 #endif
 
 /* amirip.c */
-void FDECL(amii_outrip, ( winid tmpwin, int how ));
+void FDECL(amii_outrip, ( winid tmpwin, int how, time_t when ));
 
 /* winchar.c */
 void SetMazeType(MazeType);
index eb9256183b4543f678427500eb81c7f08ce0a8e6..b069d12845d366affa8d48f15b59809c295e983e 100644 (file)
@@ -1564,21 +1564,20 @@ void mswin_end_screen()
 }
 
 /*
-outrip(winid, int)
+outrip(winid, int, when)
            -- The tombstone code.  If you want the traditional code use
               genl_outrip for the value and check the #if in rip.c.
 */
-void mswin_outrip(winid wid, int how)
+void mswin_outrip(winid wid, int how, time_t when)
 {
-       logDebug("mswin_outrip(%d)\n", wid, how);
+  logDebug("mswin_outrip(%d, %d, %ld)\n", wid, how, (long)when);
     if ((wid >= 0) && (wid < MAXWINDOWS) ) {
                DestroyWindow(GetNHApp()->windowlist[wid].win);
                GetNHApp()->windowlist[wid].win = mswin_init_RIP_window();
                GetNHApp()->windowlist[wid].type = NHW_RIP;
                GetNHApp()->windowlist[wid].dead = 0;
        }
-
-       genl_outrip(wid, how);
+    genl_outrip(wid, how, when);
 }
 
 /* handle options updates here */
index 4d85c446738df29d2fac5a2ace2721f9589fd36a..c8df312194f7ca4b9e91b0dff1b9c55dd258e3ce 100644 (file)
@@ -154,7 +154,7 @@ void mswin_change_color(void);
 char *mswin_get_color_string(void);
 void mswin_start_screen(void);
 void mswin_end_screen(void);
-void mswin_outrip(winid wid, int how);
+void mswin_outrip(winid wid, int how, time_t when);
 void mswin_preference_update(const char *pref);
 
 /* helper function */
index 4de493903267558a16d1d17490b055e33e248f0a..8a4b6ee8396e0e7f7182f29611879fd8c132ddc3 100644 (file)
@@ -1,5 +1,4 @@
 // NetHack 3.5 qt_win.cpp      $Date$  $Revision$
-//     SCCS Id: @(#)qt_win.cpp 3.5     2005/11/19
 // Copyright (c) Warwick Allison, 1999.
 // NetHack may be freely redistributed.  See license for details.
 
@@ -205,7 +204,6 @@ int qt_compact_mode = 0;
 #endif
 extern const char *enc_stat[]; /* from botl.c */
 extern const char *hu_stat[]; /* from eat.c */
-extern const char *killed_by_prefix[];
 extern int total_tiles_used; // from tile.c
 extern short glyph2tile[]; // from tile.c
 }
@@ -1453,7 +1451,7 @@ int NetHackQtWindow::SelectMenu(int how, MENU_ITEM_P **menu_list) { puts("unexpe
 void NetHackQtWindow::ClipAround(int x,int y) { puts("unexpected ClipAround"); }
 void NetHackQtWindow::PrintGlyph(int x,int y,int glyph) { puts("unexpected PrintGlyph"); }
 //void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); }
-void NetHackQtWindow::UseRIP(int how) { puts("unexpected UseRIP"); }
+void NetHackQtWindow::UseRIP(int how, time_t when) { puts("unexpected UseRIP"); }
 
 
 
@@ -3276,7 +3274,7 @@ bool NetHackQtTextWindow::Destroy()
     return !isVisible();
 }
 
-void NetHackQtTextWindow::UseRIP(int how)
+void NetHackQtTextWindow::UseRIP(int how, time_t when)
 {
 // Code from X11 windowport
 #define STONE_LINE_LEN 16    /* # chars that fit on one line */
@@ -3298,6 +3296,7 @@ static char** rip_line=0;
     char buf[BUFSZ];
     char *dpx;
     int line;
+    long year;
 
     /* Put name on stone */
     Sprintf(rip_line[NAME_LINE], "%s", plname);
@@ -3310,20 +3309,7 @@ static char** rip_line=0;
 #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++) {
@@ -3346,7 +3332,8 @@ static char** rip_line=0;
     }
 
     /* Put year on stone */
-    Sprintf(rip_line[YEAR_LINE], "%4d", getyear());
+    year = yyyymmdd(when) / 10000L;
+    Sprintf(rip_line[YEAR_LINE], "%4ld", year);
 
     rip.setLines(rip_line,YEAR_LINE+1);
 
@@ -5156,11 +5143,11 @@ void NetHackQtBind::qt_end_screen()
     // Ignore.
 }
 
-void NetHackQtBind::qt_outrip(winid wid, int how)
+void NetHackQtBind::qt_outrip(winid wid, int how, time_t when)
 {
     NetHackQtWindow* window=id_to_window[wid];
 
-    window->UseRIP(how);
+    window->UseRIP(how, when);
 }
 
 bool NetHackQtBind::notify(QObject *receiver, QEvent *event)
index dbc8d9f987997aa7471971d4c800febf4ef69c3b..b3425f1e92eaff1fd06bcfb468978f859c9e436e 100644 (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
 
index 0d74f960f69a1c6f82a5a438017b3da498dafdc6..1af4e3d57bf2e69f0d24192534fe295b42f6040e 100644 (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);
 }
 
 
index a1635b5f0a6aa3fe545360c16812993241b08bfa..abfdd5c6a1b97830d6e08c9ad1cd6a3a3ebe72a3 100644 (file)
@@ -33,7 +33,7 @@ extern void mar_set_tiley(int);
 extern short glyph2tile[MAX_GLYPH];            /* from tile.c */
 extern void mar_display_nhwindow(winid);       /* from wingem1.c */
 
-void Gem_outrip(winid,int);
+void Gem_outrip(winid,int,time_t);
 void Gem_preference_update(const char *);
 /* Interface definition, for windows.c */
 struct window_procs Gem_procs = {
@@ -1063,11 +1063,12 @@ char *posbar;
 /** Gem_outrip **/
 void mar_set_text_to_rip(winid);
 char** rip_line=0;
-extern const char *killed_by_prefix[];
+
 void
-Gem_outrip(w, how)
+Gem_outrip(w, how, when)
 winid w;
 int how;
+time_t when;
 {
 /* Code from X11 windowport */
 #define STONE_LINE_LEN 15    /* # chars that fit on one line */
@@ -1078,6 +1079,8 @@ int how;
        char buf[BUFSZ];
        char *dpx;
        int line;
+       long year;
+
        if (!rip_line) {
                int i;
                rip_line= (char **)malloc((YEAR_LINE+1)*sizeof(char *));
@@ -1096,20 +1099,8 @@ 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++) {
                register int i,i0;
@@ -1129,7 +1120,9 @@ int how;
                } else  dpx= &dpx[i0+1];
        }
        /* Put year on stone */
-       Sprintf(rip_line[YEAR_LINE], "%4d", getyear());
+       year = yyyymmdd(when) / 10000L;
+       Sprintf(rip_line[YEAR_LINE], "%4ld", year);
+
        mar_set_text_to_rip(w);
        for(line=0;line<13;line++)
                putstr(w, 0, "");
index 9093408ca26870e1d7a15989eb0c8b12baaeb172..14b315392f82010a9f791544bcc28ae34b6e105d 100644 (file)
@@ -1166,16 +1166,16 @@ void gnome_end_screen()
 }
 
 /*
-outrip(winid, int)
+outrip(winid, int, when)
            -- The tombstone code.  If you want the traditional code use
               genl_outrip for the value and check the #if in rip.c.
 */
-void gnome_outrip(winid wid, int how)
+void gnome_outrip(winid wid, int how, time_t when)
 {
     /* Follows roughly the same algorithm as genl_outrip() */
     char buf[BUFSZ];
     char ripString[BUFSZ]="\0";
-    extern const char *killed_by_prefix[];
+    long year;
     
     /* Put name on stone */
     Sprintf(buf, "%s\n", plname);
@@ -1191,26 +1191,15 @@ void gnome_outrip(winid wid, int how)
     Strcat(ripString, buf);
 
     /* 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 */
     Strcat(ripString, buf);
     Strcat(ripString, "\n");
 
     /* Put year on stone */
-    Sprintf(buf, "%4d\n", getyear());
+    year = yyyymmdd(when) / 10000L;
+    Sprintf(buf, "%4ld\n", year);
     Strcat(ripString, buf);
 
     ghack_text_window_rip_string( ripString);
index 05df5b77fafe9e1466ae51047c89c9ac60dbea36..dc1bd598643cbb9166e04ae0448586d5976a781e 100644 (file)
@@ -86,7 +86,7 @@ void gnome_number_pad(int state);
 void gnome_delay_output(void);
 void gnome_start_screen(void);
 void gnome_end_screen(void);
-void gnome_outrip(winid wid, int how);
+void gnome_outrip(winid wid, int how, time_t when);
 void gnome_delete_nhwindow_by_reference( GtkWidget *menuWin);
 
 
index 11929ac208bea0cf539317320be7b252e27de383..3dd2a5528e1e55ab49e342296a1c5e10e2194630 100644 (file)
@@ -28,7 +28,6 @@
 
 #define LLEN 128
 
-extern const char *killed_by_prefix[];
 extern winid WIN_STATUS;
 
 #ifdef _DEBUG
@@ -1774,16 +1773,17 @@ void mswin_end_screen()
 }
 
 /*
-outrip(winid, int)
+outrip(winid, int, when)
            -- The tombstone code.  If you want the traditional code use
               genl_outrip for the value and check the #if in rip.c.
 */
 #define STONE_LINE_LEN 16
-void mswin_outrip(winid wid, int how)
+void mswin_outrip(winid wid, int how, time_t when)
 {
        char buf[BUFSZ];
+       long year;
 
-       logDebug("mswin_outrip(%d)\n", wid, how);
+       logDebug("mswin_outrip(%d, %d, %ld)\n", wid, how, (long)when);
     if ((wid >= 0) && (wid < MAXWINDOWS) ) {
                DestroyWindow(GetNHApp()->windowlist[wid].win);
                GetNHApp()->windowlist[wid].win = mswin_init_RIP_window();
@@ -1806,26 +1806,14 @@ void mswin_outrip(winid wid, int how)
        putstr(wid, 0, buf);
 
        /* 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 */
        putstr(wid, 0, buf);
 
        /* Put year on stone */
-       Sprintf(buf, "%4d", getyear());
+       year = yyyymmdd(when) / 10000L;
+       Sprintf(buf, "%4ld", year);
        putstr(wid, 0, buf);
        mswin_finish_rip_text(wid);
 }
index 50295afb58ca9f60e575adc60ddfdc6732b93f97..1e1352670110ccb50527b7f1fe7e905392fa7017 100644 (file)
@@ -158,7 +158,7 @@ void mswin_change_color(void);
 char *mswin_get_color_string(void);
 void mswin_start_screen(void);
 void mswin_end_screen(void);
-void mswin_outrip(winid wid, int how);
+void mswin_outrip(winid wid, int how, time_t when);
 void mswin_preference_update(const char *pref);
 char *mswin_getmsghistory(BOOLEAN_P init);
 void mswin_putmsghistory(const char * msg,BOOLEAN_P);