From 979f2f7b6e1996592b3b0b7ba8a9825601a0d084 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 21 Feb 2021 22:05:43 +0100 Subject: [PATCH] build with ncursesw Now we can display special characters and proper boxes --- CMakeLists.txt | 4 +++- src/gmtool.c | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94805444c..24c49a514 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,9 @@ endif (HAVE_LIBBSD) endif (MSVC) if (NOT CURSES_FOUND) -find_package (Curses) + set(CURSES_NEED_WIDE TRUE) + set(CURSES_NEED_NCURSES TRUE) + find_package (Curses) endif (NOT CURSES_FOUND) #find_package (BerkeleyDB REQUIRED) diff --git a/src/gmtool.c b/src/gmtool.c index a27b3edfc..760a365a7 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -4,6 +4,7 @@ #endif #endif #include +#define CURSES_UTF8 #include "gmtool.h" #include "direction.h" @@ -58,7 +59,7 @@ state *current_state = NULL; #define IFL_BUILDINGS (1<<3) static WINDOW *hstatus; -static int gm_utf8 = 0; /* does our curses support utf-8? */ +static int gm_utf8 = 1; /* does our curses support utf-8? */ static void unicode_remove_diacritics(const char *rp, char *wp) { while (*rp) { @@ -107,7 +108,7 @@ int umvwaddnstr(WINDOW *w, int y, int x, const char * str, int len) { static void init_curses(void) { -#ifdef PDCURSES +#ifdef CURSES_UTF8 /* PDCurses from vcpkg is compiled with UTF8 (and WIDE) support */ gm_utf8 = 1; #endif @@ -118,7 +119,7 @@ static void init_curses(void) short bcol = COLOR_BLACK; short hcol = COLOR_MAGENTA; start_color(); -#ifdef __PDCURSES__ +#ifdef CURSES_UTF8 /* looks crap on putty with TERM=linux */ if (can_change_color()) { init_color(COLOR_YELLOW, 1000, 1000, 0); @@ -398,8 +399,8 @@ static bool handle_info_region(window * wnd, state * st, int c) int wxborder(WINDOW *win) { -#ifdef __PDCURSES__ - return wborder(win, 0, 0, 0, 0, 0, 0, 0, 0); +#ifdef CURSES_UTF8 + return box(win, 0, 0); #else return wborder(win, '|', '|', '-', '-', '+', '+', '+', '+'); #endif @@ -792,8 +793,7 @@ static coordinate *region2coord(const region * r, coordinate * c) c->pl = rplane(r); return c; } - -#ifdef __PDCURSES__ +#ifdef PDCURSES #define FAST_UP CTL_UP #define FAST_DOWN CTL_DOWN #define FAST_LEFT CTL_LEFT