unsigned long wc_bit;
};
+/* Macro for the currently active Window Port whose function
+ pointers have been loaded */
+#define WINDOWPORT(wn) \
+ (windowprocs.name && !strncmpi((wn), windowprocs.name, strlen((wn))))
+
/* role selection by player_selection(); this ought to be in the core... */
#define RS_NAME 0
#define RS_ROLE 1
char *namebuf;
{
int c;
- boolean strip_8th_bit = (!strcmp(windowprocs.name, "tty")
+ boolean strip_8th_bit = (WINDOWPORT("tty")
&& !iflags.wc_eight_bit_input);
/* it's tempting to skip this for single-user platforms, since
int x, y;
char row[COLNO + 1];
struct rm *lev;
- boolean istty = !strcmp(windowprocs.name, "tty");
+ boolean istty = WINDOWPORT("tty");
win = create_nhwindow(NHW_TEXT);
if (istty)
int i = 0;
int f;
#ifdef TTY_GRAPHICS
- boolean istty = !strncmpi(windowprocs.name, "tty", 3);
+ boolean istty = WINDOWPORT("tty");
#endif
Strcpy(cfn, filename);
#ifdef AMII_GRAPHICS
{
extern struct window_procs amii_procs;
- if (windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) {
+ if (WINDOWPORT("amii") {
extern winid WIN_BASE;
clear_nhwindow(WIN_BASE); /* hack until there's a hook for this */
}
curs(WIN_MAP, 1, 1);
dotcnt = 0;
dotrow = 2;
- if (strncmpi("X11", windowprocs.name, 3))
+ if (!WINDOWPORT("X11"))
putstr(WIN_MAP, 0, "Restoring:");
#endif
restoreprocs.mread_flags = 1; /* return despite error */
dotrow++;
dotcnt = 0;
}
- if (strncmpi("X11", windowprocs.name, 3)) {
+ if (!WINDOWPORT("X11")) {
putstr(WIN_MAP, 0, ".");
}
mark_synch();
dotcnt = 0;
dotrow = 2;
curs(WIN_MAP, 1, 1);
- if (strncmpi("X11", windowprocs.name, 3))
+ if (!WINDOWPORT("X11"))
putstr(WIN_MAP, 0, "Saving:");
#endif
#ifdef MFLOPPY
dotrow++;
dotcnt = 0;
}
- if (strncmpi("X11", windowprocs.name, 3)) {
+ if (!WINDOWPORT("X11")) {
putstr(WIN_MAP, 0, ".");
}
mark_synch();
#ifdef WIN32
/*
- if (!strncmpi(windowprocs.name, "mswin", 5))
+ if (WINDOWPORT("mswin"))
NHWinMainInit();
else
*/
#ifdef TTY_GRAPHICS
- if (!strncmpi(windowprocs.name, "tty", 3)) {
+ if (WINDOWPORT("tty")) {
iflags.use_background_glyph = FALSE;
nttty_open(1);
} else {
#ifndef SELF_RECOVER
if (eraseoldlocks()) {
#if defined(WIN32) && defined(TTY_GRAPHICS)
- if (!strncmpi(windowprocs.name, "tty", 3))
+ if (WINDOWPORT("tty"))
clear_screen(); /* display gets fouled up otherwise */
#endif
goto gotlock;
#else /*SELF_RECOVER*/
if (recover_savefile()) {
#if defined(WIN32) && defined(TTY_GRAPHICS)
- if (!strncmpi(windowprocs.name, "tty", 3))
+ if (WINDOWPORT("tty"))
clear_screen(); /* display gets fouled up otherwise */
#endif
goto gotlock;
{
#ifdef TTY_GRAPHICS
/* Ugly hack to keep from changing tty modes for non-tty games -dlc */
- if (!strcmp(windowprocs.name, "tty") && intr_char != nonesuch
+ if (WINDOWPORT("tty") && intr_char != nonesuch
&& curttyb2.intr_sym != '\003') {
curttyb2.intr_sym = '\003';
setctty();
{
#ifdef TTY_GRAPHICS
/* Ugly hack to keep from changing tty modes for non-tty games -dlc */
- if (!strcmp(windowprocs.name, "tty") && curttyb2.intr_sym != nonesuch) {
+ if (WINDOWPORT("tty") && curttyb2.intr_sym != nonesuch) {
curttyb2.intr_sym = nonesuch;
setctty();
}
sco_mapon()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+ if (WINDOWPORT("tty") && sco_flag_console) {
if (sco_map_valid != -1) {
ioctl(0, LDSMAP, sco_chanmap_buf);
}
sco_mapoff()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+ if (WINDOWPORT("tty") && sco_flag_console) {
sco_map_valid = ioctl(0, LDGMAP, sco_chanmap_buf);
if (sco_map_valid != -1) {
ioctl(0, LDNMAP, (char *) 0);
init_sco_cons()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
+ if (WINDOWPORT("tty") && sco_flag_console) {
atexit(sco_mapon);
sco_mapoff();
load_symset("IBMGraphics", PRIMARY);
linux_mapon()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && linux_flag_console) {
+ if (WINDOWPORT("tty") && linux_flag_console) {
write(1, "\033(B", 3);
}
#endif
linux_mapoff()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && linux_flag_console) {
+ if (WINDOWPORT("tty") && linux_flag_console) {
write(1, "\033(U", 3);
}
#endif
init_linux_cons()
{
#ifdef TTY_GRAPHICS
- if (!strcmp(windowprocs.name, "tty") && linux_flag_console) {
+ if (WINDOWPORT("tty") && linux_flag_console) {
atexit(linux_mapon);
linux_mapoff();
#ifdef TEXTCOLOR
/* error() may get called before tty is initialized */
if (iflags.window_inited)
end_screen();
- if (windowprocs.name != NULL && !strncmpi(windowprocs.name, "tty", 3)) {
+ if (WINDOWPORT("tty")) {
buf[0] = '\n';
(void) vsprintf(&buf[1], s, VA_ARGS);
Strcat(buf, "\n");
void
win32_abort()
{
+ boolean is_tty = FALSE;
+
+#ifdef TTY_GRAPHICS
+ is_tty = WINDOWPORT("tty");
+#endif
if (wizard) {
int c, ci, ct;
msmsg("Execute debug breakpoint wizard?");
while ((ci = nhgetch()) != '\n') {
if (ct > 0) {
-#ifdef TTY_GRAPHICS
- backsp(); /* \b is visible on NT */
-#endif
+ if (is_tty)
+ backsp(); /* \b is visible on NT console */
(void) putchar(' ');
-#ifdef TTY_GRAPHICS
- backsp();
-#endif
+ if (is_tty)
+ backsp();
ct = 0;
c = 'n';
}