From 826ce951e79967b2fb3a78152ba763b9f0b45405 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 21 Apr 2023 08:25:53 -0400 Subject: [PATCH] get rid of NetHack macro conflict with curses routine delay_output() --- include/winprocs.h | 2 +- include/wintty.h | 3 --- src/dig.c | 4 ++-- src/display.c | 8 ++++---- src/dothrow.c | 8 ++++---- src/explode.c | 8 ++++---- src/hack.c | 26 +++++++++++++------------- src/light.c | 2 +- src/mail.c | 4 ++-- src/mklev.c | 2 +- src/mthrowu.c | 4 ++-- src/shk.c | 2 +- src/trap.c | 2 +- src/uhitm.c | 4 ++-- src/windows.c | 2 +- src/zap.c | 6 +++--- sys/share/unixtty.c | 1 - win/X11/winX.c | 4 ++-- win/curses/Todo.txt | 4 ++-- win/tty/termcap.c | 1 - 20 files changed, 46 insertions(+), 51 deletions(-) diff --git a/include/winprocs.h b/include/winprocs.h index 23239642c..e0649b992 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -145,7 +145,7 @@ extern #define getlin (*windowprocs.win_getlin) #define get_ext_cmd (*windowprocs.win_get_ext_cmd) #define number_pad (*windowprocs.win_number_pad) -#define delay_output (*windowprocs.win_delay_output) +#define nh_delay_output (*windowprocs.win_delay_output) #ifdef CHANGE_COLOR #define change_color (*windowprocs.win_change_color) #ifdef MAC diff --git a/include/wintty.h b/include/wintty.h index 1a6f2ece3..3dbf13324 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -294,9 +294,6 @@ E void tty_refresh_inventory(int start, int stop, int y); /* termcap is implied if NO_TERMS is not defined */ #ifndef NO_TERMS #ifndef NO_TERMCAP_HEADERS -#ifdef delay_output /* avoid conflict in curses.h */ -#undef delay_output -#endif #include #ifdef clear_screen /* avoid a conflict */ #undef clear_screen diff --git a/src/dig.c b/src/dig.c index de6abc46a..d080142d1 100644 --- a/src/dig.c +++ b/src/dig.c @@ -122,7 +122,7 @@ mkcavearea(boolean rockit) } flush_screen(1); /* make sure the new glyphs shows up */ - delay_output(); + nh_delay_output(); } if (!rockit && levl[u.ux][u.uy].typ == CORR) { @@ -1492,7 +1492,7 @@ zap_dig(void) break; room = &levl[zx][zy]; tmp_at(zx, zy); - delay_output(); /* wait a little bit */ + nh_delay_output(); /* wait a little bit */ if (pitdig) { /* we are already in a pit if this is true */ coord cc; diff --git a/src/display.c b/src/display.c index 539b1b8e0..b98fc88c8 100644 --- a/src/display.c +++ b/src/display.c @@ -1032,7 +1032,7 @@ shieldeff(coordxy x, coordxy y) for (i = 0; i < SHIELD_COUNT; i++) { show_glyph(x, y, cmap_to_glyph(shield_static[i])); flush_screen(1); /* make sure the glyph shows up */ - delay_output(); + nh_delay_output(); } newsym(x, y); /* restore the old information */ } @@ -1050,7 +1050,7 @@ tether_glyph(coordxy x, coordxy y) /* * tmp_at() * - * Temporarily place glyphs on the screen. Do not call delay_output(). It + * Temporarily place glyphs on the screen. Do not call nh_delay_output(). It * is up to the caller to decide if it wants to wait [presently, everyone * but explode() wants to delay]. * @@ -1145,7 +1145,7 @@ tmp_at(coordxy x, coordxy y) show_glyph(tglyph->saved[i - 1].x, tglyph->saved[i - 1].y, tglyph->glyph); flush_screen(0); /* make sure it shows up */ - delay_output(); + nh_delay_output(); } tglyph->sidx = 1; } @@ -1229,7 +1229,7 @@ flash_glyph_at(coordxy x, coordxy y, int tg, int rpt) for (i = 0; i < rpt; i++) { show_glyph(x, y, glyph[i % 2]); flush_screen(1); - delay_output(); + nh_delay_output(); } } diff --git a/src/dothrow.c b/src/dothrow.c index 3ec5e8b3f..493f70aa0 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -971,7 +971,7 @@ hurtle_step(genericptr_t arg, coordxy x, coordxy y) if (--*range < 0) /* make sure our range never goes negative */ *range = 0; if (*range != 0) - delay_output(); + nh_delay_output(); return TRUE; } @@ -1014,7 +1014,7 @@ mhurtle_step(genericptr_t arg, coordxy x, coordxy y) vision_recalc(0); /* new location => different lines of sight */ } flush_screen(1); - delay_output(); + nh_delay_output(); set_apparxy(mon); if (is_waterwall(x, y)) return FALSE; @@ -1411,7 +1411,7 @@ sho_obj_return_to_u(struct obj *obj) tmp_at(DISP_FLASH, obj_to_glyph(obj, rn2_on_display_rng)); while (isok(x,y) && (x != u.ux || y != u.uy)) { tmp_at(x, y); - delay_output(); + nh_delay_output(); x -= u.dx; y -= u.dy; } @@ -1707,7 +1707,7 @@ throwit(struct obj *obj, || obj->oclass == VENOM_CLASS) { tmp_at(DISP_FLASH, obj_to_glyph(obj, rn2_on_display_rng)); tmp_at(gb.bhitpos.x, gb.bhitpos.y); - delay_output(); + nh_delay_output(); tmp_at(DISP_END, 0); breakmsg(obj, cansee(gb.bhitpos.x, gb.bhitpos.y)); breakobj(obj, gb.bhitpos.x, gb.bhitpos.y, TRUE, TRUE); diff --git a/src/explode.c b/src/explode.c index 17bf313c0..db6cd603e 100644 --- a/src/explode.c +++ b/src/explode.c @@ -415,7 +415,7 @@ explode( cmap_to_glyph(shield_static[k])); } curs_on_u(); /* will flush screen and output */ - delay_output(); + nh_delay_output(); } /* Cover last shield glyph with blast symbol. */ @@ -430,8 +430,8 @@ explode( } } else { /* delay a little bit. */ - delay_output(); - delay_output(); + nh_delay_output(); + nh_delay_output(); } tmp_at(DISP_END, 0); /* clear the explosion */ @@ -871,7 +871,7 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */ } else { if (scflags & VIS_EFFECTS) { /* tmp_at(gb.bhitpos.x, gb.bhitpos.y); */ - /* delay_output(); */ + /* nh_delay_output(); */ } } stmp->ox = gb.bhitpos.x; diff --git a/src/hack.c b/src/hack.c index b777fbd3a..808e6ea7c 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1322,10 +1322,10 @@ findtravelpath(int mode) for (i = 0; i < nn; ++i) { tmp_at(travelstepx[1 - set][i], travelstepy[1 - set][i]); } - delay_output(); + nh_delay_output(); if (flags.runmode == RUN_CRAWL) { - delay_output(); - delay_output(); + nh_delay_output(); + nh_delay_output(); } tmp_at(DISP_END, 0); } @@ -1381,12 +1381,12 @@ findtravelpath(int mode) /* Use of warning glyph is arbitrary. It stands out. */ tmp_at(DISP_ALL, warning_to_glyph(2)); tmp_at(px, py); - delay_output(); + nh_delay_output(); if (flags.runmode == RUN_CRAWL) { - delay_output(); - delay_output(); - delay_output(); - delay_output(); + nh_delay_output(); + nh_delay_output(); + nh_delay_output(); + nh_delay_output(); } tmp_at(DISP_END, 0); } @@ -2623,12 +2623,12 @@ runmode_delay_output(void) /* moveloop() suppresses time_botl when running */ iflags.time_botl = flags.time; curs_on_u(); - delay_output(); + nh_delay_output(); if (flags.runmode == RUN_CRAWL) { - delay_output(); - delay_output(); - delay_output(); - delay_output(); + nh_delay_output(); + nh_delay_output(); + nh_delay_output(); + nh_delay_output(); } } } diff --git a/src/light.c b/src/light.c index d7b4f916d..b37a2cd40 100644 --- a/src/light.c +++ b/src/light.c @@ -282,7 +282,7 @@ show_transient_light(struct obj *obj, coordxy x, coordxy y) } if (obj) { /* take thrown/kicked candle or lamp off the map */ - delay_output(); + nh_delay_output(); remove_object(obj); } } diff --git a/src/mail.c b/src/mail.c index ab89e29d4..92c8fe1cc 100644 --- a/src/mail.c +++ b/src/mail.c @@ -343,7 +343,7 @@ md_rush(struct monst *md, place_monster(md, fx, fy); /* put md down */ newsym(fx, fy); /* see it */ flush_screen(0); /* make sure md shows up */ - delay_output(); /* wait a little bit */ + nh_delay_output(); /* wait a little bit */ /* Remove md from the dungeon. Restore original mon, if necessary. */ remove_monster(fx, fy); @@ -380,7 +380,7 @@ md_rush(struct monst *md, place_monster(md, fx, fy); /* place at final spot */ newsym(fx, fy); flush_screen(0); - delay_output(); /* wait a little bit */ + nh_delay_output(); /* wait a little bit */ return TRUE; } diff --git a/src/mklev.c b/src/mklev.c index d5172bffd..485f0870b 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -2001,7 +2001,7 @@ mkinvokearea(void) } flush_screen(1); /* make sure the new glyphs shows up */ - delay_output(); + nh_delay_output(); } You("are standing at the top of a stairwell leading down!"); diff --git a/src/mthrowu.c b/src/mthrowu.c index 010e345b0..3dccb9256 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -757,10 +757,10 @@ m_throw( break; } tmp_at(gb.bhitpos.x, gb.bhitpos.y); - delay_output(); + nh_delay_output(); } tmp_at(gb.bhitpos.x, gb.bhitpos.y); - delay_output(); + nh_delay_output(); tmp_at(DISP_END, 0); gm.mesg_given = 0; /* reset */ diff --git a/src/shk.c b/src/shk.c index 8747d1331..dfd62d6fa 100644 --- a/src/shk.c +++ b/src/shk.c @@ -3680,7 +3680,7 @@ shkcatch( the(xname(obj))); if (!canspotmon(shkp)) map_invisible(x, y); - delay_output(); + nh_delay_output(); mark_synch(); } subfrombill(obj, shkp); diff --git a/src/trap.c b/src/trap.c index 5aa53738a..318864762 100644 --- a/src/trap.c +++ b/src/trap.c @@ -2943,7 +2943,7 @@ launch_obj( /* dstage@u.washington.edu -- Delay only if hero sees it */ if (cansee(gb.bhitpos.x, gb.bhitpos.y)) while (tmp-- > 0) - delay_output(); + nh_delay_output(); gb.bhitpos.x += dx; gb.bhitpos.y += dy; diff --git a/src/uhitm.c b/src/uhitm.c index e5b8c49e5..9cac3da4e 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -4605,8 +4605,8 @@ start_engulf(struct monst *mdef) You("%s %s%s!", u_digest ? "swallow" : u_enfold ? "enclose" : "engulf", mon_nam(mdef), u_digest ? " whole" : ""); - delay_output(); - delay_output(); + nh_delay_output(); + nh_delay_output(); } static void diff --git a/src/windows.c b/src/windows.c index d59b396a5..1c2c481e8 100644 --- a/src/windows.c +++ b/src/windows.c @@ -562,7 +562,7 @@ static struct window_procs hup_procs = { hup_int_ndecl, /* doprev_message */ hup_yn_function, hup_getlin, hup_int_ndecl, /* get_ext_cmd */ hup_void_fdecl_int, /* number_pad */ - hup_void_ndecl, /* delay_output */ + hup_void_ndecl, /* nh_delay_output */ #ifdef CHANGE_COLOR hup_change_color, #ifdef MAC diff --git a/src/zap.c b/src/zap.c index 1c6b9abfd..681ce46fd 100644 --- a/src/zap.c +++ b/src/zap.c @@ -3772,7 +3772,7 @@ bhit( newsym(x, y); } tmp_at(gb.bhitpos.x, gb.bhitpos.y); - delay_output(); + nh_delay_output(); /* kicked objects fall in pools */ if ((weapon == KICKED_WEAPON) && (is_pool(gb.bhitpos.x, gb.bhitpos.y) @@ -3891,7 +3891,7 @@ boomhit(struct obj *obj, coordxy dx, coordxy dy) } } tmp_at(gb.bhitpos.x, gb.bhitpos.y); - delay_output(); + nh_delay_output(); if (IS_SINK(levl[gb.bhitpos.x][gb.bhitpos.y].typ)) { Soundeffect(se_boomerang_klonk, 75); if (!Deaf) @@ -4467,7 +4467,7 @@ dobuzz( if (ZAP_POS(levl[sx][sy].typ) || (isok(lsx, lsy) && cansee(lsx, lsy))) tmp_at(sx, sy); - delay_output(); /* wait a little */ + nh_delay_output(); /* wait a little */ } /* hit() and miss() need gb.bhitpos to match the target */ diff --git a/sys/share/unixtty.c b/sys/share/unixtty.c index 176bdf7c8..02843b2f6 100644 --- a/sys/share/unixtty.c +++ b/sys/share/unixtty.c @@ -38,7 +38,6 @@ #endif /* POSIX_TYPES */ #ifdef LINUX #include -#undef delay_output /* curses redefines this */ #include #endif #define kill_sym c_cc[VKILL] diff --git a/win/X11/winX.c b/win/X11/winX.c index 013fd22e3..f984c5259 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -1725,10 +1725,10 @@ X11_sig_cb(XtPointer not_used, XtSignalId *id) } #endif -/* delay_output ----------------------------------------------------------- */ +/* X11_delay_output ------------------------------------------------------- */ /* - * Timeout callback for delay_output(). Send a fake message to the map + * Timeout callback for X11_delay_output(). Send a fake message to the map * window. */ /* ARGSUSED */ diff --git a/win/curses/Todo.txt b/win/curses/Todo.txt index 86529302a..e942a6fa0 100644 --- a/win/curses/Todo.txt +++ b/win/curses/Todo.txt @@ -8,7 +8,7 @@ NETHACK INTERFACE * Implement curses_rip for optional fancier color tombstone, as well as one that will display correctly on smaller terminals. - * I am confused as to how mark_synch, wait_synch, and delay_output + * I am confused as to how mark_synch, wait_synch, and nh_delay_output should work. Help, please? * Both PDCurses and Ncurses have mouse support, so the poskey function @@ -34,7 +34,7 @@ DISPLAY PDCurses, however. * Animation effects do not display properly - this could probably be - fixed with a correct implementation of the delay_output function. + fixed with a correct implementation of the curses_delay_output function. * Support option to set forground and background colors for individual windows diff --git a/win/tty/termcap.c b/win/tty/termcap.c index 3453e9685..4a1ed99a8 100644 --- a/win/tty/termcap.c +++ b/win/tty/termcap.c @@ -837,7 +837,6 @@ cl_eos(void) /* free after Robert Viduya */ macros used elsewhere within nethack; fortunately they're not needed beyond this point, so we don't need to worry about reconstructing them after the header file inclusion. */ -#undef delay_output #undef TRUE #undef FALSE #define m_move curses_m_move /* Some curses.h decl m_move(), not used here */