]> granicus.if.org Git - nethack/commitdiff
some build fixes for compile issues reported
authornhmall <nhmall@nethack.org>
Sat, 12 May 2018 10:57:34 +0000 (06:57 -0400)
committernhmall <nhmall@nethack.org>
Sat, 12 May 2018 10:57:34 +0000 (06:57 -0400)
include/extern.h
include/wintty.h
src/allmain.c
src/mapglyph.c
win/tty/wintty.c

index 8ef6e617f08b75e31c88e5a09c5cc5a122356e0b..96a5ade8ba3b7d7c24566ebb930c35efff841903 100644 (file)
@@ -1158,7 +1158,7 @@ E boolean FDECL(usmellmon, (struct permonst *));
 
 E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int));
 E char *FDECL(encglyph, (int));
-E char *FDECL(decode_mixed, (char *,const char *));
+E const char *FDECL(decode_mixed, (char *,const char *));
 E void FDECL(genl_putmixed, (winid, int, const char *));
 
 /* ### mcastu.c ### */
index 1f270128fa108b3ebd2ec364c9910e3b80cfd24c..4ff0ddb3cfcdde54bed1810a2770437c3607b2e5 100644 (file)
@@ -69,6 +69,18 @@ struct DisplayDesc {
 
 #endif /* WINDOW_STRUCTS */
 
+#ifdef STATUS_HILITES
+struct tty_status_fields {
+    int idx;
+    int color;
+    int attr;
+    int x, y;
+    size_t lth;
+    boolean valid;
+    boolean redraw;
+};
+#endif
+
 #define MAXWIN 20 /* maximum number of windows, cop-out */
 
 /* tty dependent window types */
index 569c6e45603afbc989d24ce4587d6d8aeadb224d..2c1364d75d01e66bbb5b714ed827ee9f4bc94e30 100644 (file)
@@ -854,7 +854,6 @@ const char *opts;
 {
     char *op;
     boolean negated = FALSE;
-    boolean retval = TRUE;
 
     while ((op = index(opts, ',')) != 0) {
         *op++ = 0;
index 587d317c8d67d9b1531ca45679d79bc50921bdd6..04ef068e9f193ea7713e3cad3ef8f96c8fbfd9ff 100644 (file)
@@ -247,7 +247,7 @@ int glyph;
     return encbuf;
 }
 
-char *
+const char *
 decode_mixed(buf, str)
 char *buf;
 const char *str;
index ffc8ccadbd9c58ce747d70921b2f4fb3d093a1f6..821859efa69443f32de0f15608c55063d84a487c 100644 (file)
@@ -176,10 +176,13 @@ STATIC_DCL void FDECL(setup_racemenu, (winid, BOOLEAN_P, int, int, int));
 STATIC_DCL void FDECL(setup_gendmenu, (winid, BOOLEAN_P, int, int, int));
 STATIC_DCL void FDECL(setup_algnmenu, (winid, BOOLEAN_P, int, int, int));
 STATIC_DCL boolean NDECL(reset_role_filtering);
+#ifdef STATUS_HILITES
 STATIC_DCL boolean FDECL(check_fields, (BOOLEAN_P));
 STATIC_DCL void NDECL(render_status);
-STATIC_DCL void FDECL(tty_putstatusfield, (struct tty_status_fields *, const char *, int, int));
+STATIC_DCL void FDECL(tty_putstatusfield, (struct tty_status_fields *,
+                                           const char *, int, int));
 STATIC_DCL int FDECL(set_cond_shrinklvl, (int, int));
+#endif
 
 /*
  * A string containing all the default commands -- to add to a list
@@ -2494,7 +2497,6 @@ const char *str;
     register struct WinDesc *cw = 0;
     register char *ob;
     register long i, n0;
-    boolean attr_match = FALSE;
 
     /* Assume there's a real problem if the window is missing --
      * probably a panic message
@@ -2507,11 +2509,7 @@ const char *str;
     if (str == (const char *) 0
         || ((cw->flags & WIN_CANCELLED) && (cw->type != NHW_MESSAGE)))
         return;
-#ifndef STATUS_HILITES
     if (cw->type != NHW_MESSAGE)
-#else
-    if (cw->type != NHW_MESSAGE && cw->type != NHW_STATUS)
-#endif
         str = compress_str(str);
 
     ttyDisplay->lastwin = window;
@@ -2526,7 +2524,39 @@ const char *str;
 #endif
         update_topl(str);
         break;
+#ifndef STATUS_HILITES
+    case NHW_STATUS:
+        ob = &cw->data[cw->cury][j = cw->curx];
+        if (context.botlx)
+            *ob = 0;
+        if (!cw->cury && (int) strlen(str) >= CO) {
+            /* the characters before "St:" are unnecessary */
+            nb = index(str, ':');
+            if (nb && nb > str + 2)
+                str = nb - 2;
+        }
+        nb = str;
+        for (i = cw->curx + 1, n0 = cw->cols; i < n0; i++, nb++) {
+            if (!*nb) {
+                if (*ob || context.botlx) {
+                    /* last char printed may be in middle of line */
+                    tty_curs(WIN_STATUS, i, cw->cury);
+                    cl_end();
+                }
+                break;
+            }
+            if (*ob != *nb)
+                tty_putsym(WIN_STATUS, i, cw->cury, *nb);
+            if (*ob)
+                ob++;
+        }
 
+        (void) strncpy(&cw->data[cw->cury][j], str, cw->cols - j - 1);
+        cw->data[cw->cury][cw->cols - 1] = '\0'; /* null terminate */
+        cw->cury = (cw->cury + 1) % 2;
+        cw->curx = 0;
+        break;
+#endif /* STATUS_HILITES */
     case NHW_MAP:
         tty_curs(window, cw->curx + 1, cw->cury);
         term_start_attr(attr);
@@ -3415,20 +3445,15 @@ static int FDECL(condcolor, (long, unsigned long *));
 static int FDECL(condattr, (long, unsigned long *));
 static long tty_condition_bits;
 static unsigned long *tty_colormasks;
-static struct tty_status_fields {
-    int idx;
-    int color;
-    int attr;
-    int x, y;
-    size_t lth;
-    boolean valid;
-    boolean redraw;
-} tty_status[2][MAXBLSTATS];
+static struct tty_status_fields
+                tty_status[2][MAXBLSTATS]; /* 2: first index is for current
+                                                 and previous */
 static int st_fld;
-int hpbar_percent, hpbar_color;
-struct condition_t {
+static int hpbar_percent, hpbar_color;
+static struct condition_t {
     long mask;
-    char *text[3];  /* 3 potential display values, progressively smaller */
+    const char *text[3];  /* 3: potential display values, progressively
+                           * smaller */
 } conditions[] = {   
     /* The sequence order of these matters */
    { BL_MASK_STONE,    {"Stone", "Ston", "Sto"}},
@@ -3445,7 +3470,7 @@ struct condition_t {
    { BL_MASK_FLY,      {"Fly", "Fly", "Fl"}},
    { BL_MASK_RIDE,     {"Ride", "Rid", "Ri"}},
 };
-enum statusfields fieldorder[2][15] = {
+static enum statusfields fieldorder[2][15] = { /* 2: two status lines */
     { BL_TITLE, BL_STR, BL_DX, BL_CO, BL_IN, BL_WI, BL_CH, BL_ALIGN,
       BL_SCORE, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH, BL_FLUSH,
       BL_FLUSH },