OSDN Git Service

update year to 2020
[jnethack/source.git] / src / topten.c
index dded344..9a5d741 100644 (file)
@@ -5,7 +5,7 @@
 
 /* JNetHack Copyright */
 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
-/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016            */
+/* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2020            */
 /* JNetHack may be freely redistributed.  See license for details. */
 
 #include "hack.h"
@@ -67,7 +67,6 @@ struct toptenentry {
 
 STATIC_DCL void FDECL(topten_print, (const char *));
 STATIC_DCL void FDECL(topten_print_bold, (const char *));
-STATIC_DCL xchar FDECL(observable_depth, (d_level *));
 STATIC_DCL void NDECL(outheader);
 STATIC_DCL void FDECL(outentry, (int, struct toptenentry *, BOOLEAN_P));
 STATIC_DCL void FDECL(discardexcess, (FILE *));
@@ -108,19 +107,21 @@ boolean incl_helpless;
 /*JP
         "drowned in ", "burned by ", "dissolved in ", "crushed to death by ",
 */
-         "\93M\8e\80\82µ\82½","\8fÄ\8e\80\82µ\82½", "\97n\8aâ\82É\97n\82¯\82½", "\89\9f\82µ\92×\82³\82ê\82½",
+        "\93M\8e\80\82µ\82½","\8fÄ\8e\80\82µ\82½", "\97n\8aâ\82É\97n\82¯\82½", "\89\9f\82µ\92×\82³\82ê\82½",
         /* STONING, TURNED_SLIME, GENOCIDED, */
 /*JP
         "petrified by ", "turned to slime by ", "killed by ",
 */
-         "\90Î\82É\82È\82Á\82½", "\82É\83X\83\89\83C\83\80\82É\82³\82ê\82½", "\8bs\8eE\82³\82ê\82½",
+        "\90Î\82É\82È\82Á\82½", "\82É\83X\83\89\83C\83\80\82É\82³\82ê\82½", "\8bs\8eE\82³\82ê\82½",
         /* PANICKED, TRICKED, QUIT, ESCAPED, ASCENDED */
         "", "", "", "", ""
     };
 #if 0 /*JP*/
     unsigned l;
-#endif
     char c, *kname = killer.name;
+#else
+    char *kname = killer.name;
+#endif
 
     buf[0] = '\0'; /* lint suppression */
 #if 1 /*JP*//*\90æ\82É\91Î\8fÛ\82ð\83R\83s\81[*/
@@ -161,7 +162,9 @@ boolean incl_helpless;
      */
     while (--siz > 0) {
         c = *kname++;
-        if (c == ',')
+        if (!c)
+            break;
+        else if (c == ',')
             c = ';';
         /* 'xlogfile' doesn't really need protection for '=', but
            fixrecord.awk for corrupted 3.6.0 'record' does (only
@@ -210,7 +213,7 @@ const char *x;
         putstr(toptenwin, ATR_BOLD, x);
 }
 
-STATIC_OVL xchar
+int
 observable_depth(lev)
 d_level *lev;
 {
@@ -629,11 +632,12 @@ time_t when;
                 char pbuf[BUFSZ];
 
                 topten_print("");
+#if 0 /*JP:T*/
                 Sprintf(pbuf,
-#if 0 /*JP*/
              "Since you were in %s mode, the score list will not be checked.",
                         wizard ? "wizard" : "discover");
 #else
+                Sprintf(pbuf,
              "%s\83\82\81[\83h\82Å\83v\83\8c\83C\82µ\82½\82Ì\82Å\83X\83R\83A\83\8a\83X\83g\82É\82Í\8dÚ\82ç\82È\82¢\81D",
                         wizard ? "\83E\83B\83U\81[\83h" : "\94­\8c©");
 #endif
@@ -745,7 +749,7 @@ time_t when;
                 } else {
                     char pbuf[BUFSZ];
 
-#if 0 /*JP*/
+#if 0 /*JP:T*/
                     Sprintf(pbuf,
                             "You reached the %d%s place on the top %d list.",
                             rank0, ordin(rank0), sysopt.entrymax);
@@ -960,9 +964,7 @@ boolean so;
             Strcat(action, t1->death);
 #endif
             second_line = FALSE;
-#if 1 /*JP*/
-        }
-#else
+#if 0 /*JP*/
         } else if (!strncmp(t1->death, "died of st", 10)) {
             Strcat(linebuf, "starved to death");
             second_line = FALSE;
@@ -977,6 +979,8 @@ boolean so;
             Strcat(linebuf, "turned to stone");
         } else
             Strcat(linebuf, "died");
+#else
+        }
 #endif /*JP*/
 
         if (t1->deathdnum == astral_level.dnum) {
@@ -1188,6 +1192,7 @@ int uid;
  * print selected parts of score list.
  * argc >= 2, with argv[0] untrustworthy (directory names, et al.),
  * and argv[1] starting with "-s".
+ * caveat: some shells might allow argv elements to be arbitrarily long.
  */
 void
 prscore(argc, argv)
@@ -1266,16 +1271,16 @@ char **argv;
         playerct = --argc;
         players = (const char **) ++argv;
 #else
-        int i;
+        int j;
         playerct = --argc;
         ++argv;
         players = (const char **)alloc(sizeof(char *) * argc + 1);
-        for (i = 0; i < argc; i++) {
-            char *p = (char *)str2ic(argv[i]);
-            players[i] = (char *)alloc(strlen(p) + 1);
-            strcpy((void *)players[i], p);
+        for (j = 0; j < argc; j++) {
+            char *p = (char *)str2ic(argv[j]);
+            players[j] = (char *)alloc(strlen(p) + 1);
+            strcpy((void *)players[j], p);
         }
-        players[i] = NULL;
+        players[j] = NULL;
 #endif
     }
     raw_print("");