]> granicus.if.org Git - nethack/commitdiff
build with TEXTCOLOR undef'd turned up a couple of things
authornhmall <nhmall@nethack.org>
Sat, 30 Nov 2019 20:05:48 +0000 (15:05 -0500)
committernhmall <nhmall@nethack.org>
Sat, 30 Nov 2019 20:05:48 +0000 (15:05 -0500)
Also, one more has_color in obsolete sys/mac folder. Adjusted code.

sys/mac/mttymain.c
sys/winnt/nttty.c
win/tty/wintty.c

index 5231e84dacbedf9830cb366c698ec1b17dad470d..2cd59a9d26eee4733e9f3cfd4c75ef96019b538a 100644 (file)
@@ -269,6 +269,33 @@ _mt_init_stuff(void)
     clear_tty(_mt_window);
 
     InitMenuRes();
+
+    {
+        /* update the window proc has_color table */
+        int i, setting = 0;
+        Rect r;
+//     Point p = {0, 0};
+        GDHandle gh = (GDHandle) 0;
+
+        if (_mt_in_color) {
+            GetWindowBounds(_mt_window, kWindowContentRgn, &r);
+//          SetPortWindowPort(_mt_window);
+//          LocalToGlobal (&p);
+//          OffsetRect (&r, p.h, p.v);
+            gh = GetMaxDevice(&r);
+            /* > 4 bpp */
+            setting = ((*((*gh)->gdPMap))->pixelSize > 4) ? 1 : 0;
+       }
+
+        for (i = 0; i < CLR_MAX ; ++i) {
+            tty_procs.has_color[i] =
+                (i == CLR_BLACK || i == NO_COLOR || i == CLR_WHITE)
+                    ? 1
+                    : (_mt_in_color && gh)
+                        ? setting
+                        : 0;
+        }
+    }
 }
 
 int
@@ -302,6 +329,8 @@ getreturn(char *str)
     (void) tgetch();
 }
 
+#if 0       /* this function is commented out */
+/* the tty has_color[] table is filled in during init above */
 int
 has_color(int color)
 {
@@ -327,6 +356,7 @@ has_color(int color)
 
     return (*((*gh)->gdPMap))->pixelSize > 4; /* > 4 bpp */
 }
+#endif
 
 void
 tty_delay_output(void)
index 8a52fb6837ab7e0b92bc3ed18af28c3fa4c99bcd..88aea5aadaf9cad25cdf887e81c1afc1618f7061 100644 (file)
@@ -715,7 +715,6 @@ tty_delay_output()
     }
 }
 
-#ifdef TEXTCOLOR
 /*
  * CLR_BLACK           0
  * CLR_RED             1
@@ -788,7 +787,6 @@ init_ttycolor()
 #endif
     init_ttycolor_completed = TRUE;
 }
-#endif /* TEXTCOLOR */
 
 #if 0
 int
index 475767ec447ce2303fe18d33d428b578ddd5320e..bcd039a71365a8df31f04be54cf25bbfef68214e 100644 (file)
@@ -4311,7 +4311,7 @@ unsigned long *bmarray;
    the condition where this gets used always has the same value */
 #define condcolor(bm,bmarray) NO_COLOR
 #define term_start_color(color) /*empty*/
-#define term_end_color(color) /*empty*/
+#define term_end_color() /*empty*/
 #endif /* TEXTCOLOR */
 
 STATIC_OVL int