From a2d6881f61a1df196a16aa3128b4fd1d7274ede3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 28 Dec 2013 22:58:39 -0800 Subject: [PATCH] fix use of curses on windows. workaround for curses defining its own boolean type. --- core/src/bindings/bind_gmtool.c | 3 +++ core/src/gamecode/items.c | 1 - core/src/gmtool.c | 9 ++++++--- core/src/util/listbox.c | 5 ++++- src/CMakeLists.txt | 1 + 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/core/src/bindings/bind_gmtool.c b/core/src/bindings/bind_gmtool.c index 654f16f30..7e06a2ddc 100644 --- a/core/src/bindings/bind_gmtool.c +++ b/core/src/bindings/bind_gmtool.c @@ -1,6 +1,9 @@ #include #include + +#undef bool #include +#include #include "bind_gmtool.h" #include "../gmtool.h" diff --git a/core/src/gamecode/items.c b/core/src/gamecode/items.c index 8c6ec2688..7e04b4190 100644 --- a/core/src/gamecode/items.c +++ b/core/src/gamecode/items.c @@ -3,7 +3,6 @@ #include "items.h" #include "study.h" -#include "curses.h" #include #include diff --git a/core/src/gmtool.c b/core/src/gmtool.c index 83d637d04..3dc89fa75 100644 --- a/core/src/gmtool.c +++ b/core/src/gmtool.c @@ -10,7 +10,10 @@ /* wenn platform.h nicht vor curses included wird, kompiliert es unter windows nicht */ #include +#undef bool #include +#include + #include #include "gmtool.h" @@ -93,9 +96,9 @@ static void init_curses(void) /* looks crap on putty with TERM=linux */ if (can_change_color()) { init_color(COLOR_YELLOW, 1000, 1000, 0); + init_color(COLOR_CYAN, 0, 1000, 1000); } #endif - for (fg = 0; fg != 8; ++fg) { for (bg = 0; bg != 2; ++bg) { init_pair(fg + 8 * bg, fg, bg ? hcol : bcol); @@ -201,14 +204,14 @@ static int tagged_region(selection * s, int nx, int ny) return 0; } -static int mr_tile(const map_region * mr, int highlight) +static chtype mr_tile(const map_region * mr, int highlight) { int hl = 8 * highlight; if (mr != NULL && mr->r != NULL) { const region *r = mr->r; switch (r->terrain->_name[0]) { case 'o': - return '.' | COLOR_PAIR(hl + COLOR_CYAN); + return '.' | COLOR_PAIR(hl + COLOR_CYAN) | A_BOLD; case 'd': return 'D' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD; case 't': diff --git a/core/src/util/listbox.c b/core/src/util/listbox.c index ab3dd9eb9..7f056bfc2 100644 --- a/core/src/util/listbox.c +++ b/core/src/util/listbox.c @@ -10,9 +10,12 @@ /* wenn platform.h nicht vor curses included wird, kompiliert es unter windows nicht */ #include -#include #include +#undef bool +#include +#include + #include "listbox.h" #include "gmtool_structs.h" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0eb069c74..a3f93c27c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,6 +4,7 @@ project (server C) IF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL") +ELSEIF(MSVC) ELSE(CMAKE_COMPILER_IS_GNUCC) MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}") ENDIF(CMAKE_COMPILER_IS_GNUCC)