curses follow-up bits

Move the curses global variable defininitions to cursmain.c.

Make the references to those global variables extern in
include/wincurs.h

Get rid of a warning:
../win/curses/cursmesg.c:379:9: warning: declaration shadows a
variable in the global scope [-Wshadow] int orig_cursor = curs_set(0);

Kludge for Visual Studio compiler: Add a stub- file for use
in Windows curses port builds to ensure that a needed #pragma
is invoked prior to compiling the file pdcscrn.c in the
PDCurses source distribution. All command line options and
compile of the file. It is unreasonable to expect a NetHack
builder to have to tinker with the PDCurses source files in
order to build NetHack. This kludge means the NetHack builder
doesn't have to.
The file stub-pdcscrn.c contains only two lines:
	#pragma warning(disable : 4996)
	#include "pdcscrn.c"
Some day, if the PDCurses sources corrects the issue, this
can go away.
This commit is contained in:
nhmall
2018-11-30 16:00:24 -05:00
parent 75bf7c1975
commit 8a9f98f179
5 changed files with 43 additions and 20 deletions

View File

@@ -80,6 +80,16 @@ struct window_procs curses_procs = {
genl_can_suspend_yes,
};
/*
* Global variables for curses interface
*/
int term_rows, term_cols; /* size of underlying terminal */
int orig_cursor; /* Preserve initial cursor state */
WINDOW *base_term; /* underlying terminal window */
boolean counting; /* Count window is active */
WINDOW *mapwin, *statuswin, *messagewin; /* Main windows */
/* Track if we're performing an update to the permanent window.
Needed since we aren't using the normal menu functions to handle
the inventory window. */

View File

@@ -371,12 +371,12 @@ curses_message_win_getline(const char *prompt, char *answer, int buffer)
char *tmpstr; /* for free() */
int maxy, maxx; /* linewrap / scroll */
int ch;
WINDOW *win = curses_get_nhwin(MESSAGE_WIN);
int border_space = 0;
int len = 0; /* of answer string */
boolean border = curses_window_has_border(MESSAGE_WIN);
int orig_cursor = curs_set(0);
orig_cursor = curs_set(0);
curses_get_window_size(MESSAGE_WIN, &height, &width);
if (border) {