From 9069615861484d4fa9f410e094398d0b8f345621 Mon Sep 17 00:00:00 2001 From: Bart House Date: Mon, 24 Dec 2018 21:28:44 -0800 Subject: [PATCH] Global changes for qt, qt4, amiga, x11 and curses. --- src/decl.c | 2 ++ sys/amiga/winfuncs.c | 2 +- sys/share/pcunix.c | 4 ++-- sys/wince/mhstatus.c | 4 ++-- win/Qt/qt_win.cpp | 4 ++-- win/Qt4/qt4menu.cpp | 2 +- win/Qt4/qt4stat.cpp | 4 ++-- win/X11/winstat.c | 4 ++-- win/curses/cursdial.c | 4 ++-- win/curses/cursmesg.c | 6 +++--- win/curses/cursstat.c | 12 ++++++------ win/curses/curswins.c | 10 +++++----- win/gnome/gnstatus.c | 4 ++-- 13 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/decl.c b/src/decl.c index c418612f3..ed30e4c6e 100644 --- a/src/decl.c +++ b/src/decl.c @@ -313,7 +313,9 @@ const struct instance_globals g_init = { 0, /* wailmsg */ NULL, /* migrating_objs */ NULL, /* billobjs */ +#if defined(MICRO) || defined(WIN32) UNDEFINED_VALUES, /* hackdir */ +#endif /* MICRO || WIN32 */ DUMMY, /* youmonst */ NULL, /* invent */ diff --git a/sys/amiga/winfuncs.c b/sys/amiga/winfuncs.c index d565b1af4..e87daed84 100644 --- a/sys/amiga/winfuncs.c +++ b/sys/amiga/winfuncs.c @@ -2317,7 +2317,7 @@ register int x, y; clipymax = saveymax; clipxmax = savexmax; #endif - if (on_level(&u.uz0, &u.uz) && !restoring && moves > 1) + if (on_level(&u.uz0, &u.uz) && !restoring && g.moves > 1) (void) doredraw(); flush_glyph_buffer(amii_wins[WIN_MAP]->win); } diff --git a/sys/share/pcunix.c b/sys/share/pcunix.c index eb78ff55f..064d57d57 100644 --- a/sys/share/pcunix.c +++ b/sys/share/pcunix.c @@ -51,12 +51,12 @@ int fd; #else #if (defined(MICRO)) && !defined(NO_FSTAT) if(fstat(fd, &buf)) { - if(moves > 1) pline("Cannot get status of saved level? "); + if(g.moves > 1) pline("Cannot get status of saved level? "); else pline("Cannot get status of saved game."); return(0); } if(comp_times(buf.st_mtime)) { - if(moves > 1) pline("Saved level is out of date."); + if(g.moves > 1) pline("Saved level is out of date."); else pline("Saved game is out of date. "); /* This problem occurs enough times we need to give the player * some more information about what causes it, and how to fix. diff --git a/sys/wince/mhstatus.c b/sys/wince/mhstatus.c index 7f541a124..5b3b496a5 100644 --- a/sys/wince/mhstatus.c +++ b/sys/wince/mhstatus.c @@ -237,7 +237,7 @@ FormatStatusString(char *text, int format) hp = 0; (void) describe_level(nb = eos(nb)); Sprintf(nb = eos(nb), "%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", - showsyms[COIN_CLASS + SYM_OFF_O], money_cnt(invent), hp, hpmax, + showsyms[COIN_CLASS + SYM_OFF_O], money_cnt(g.invent), hp, hpmax, u.uen, u.uenmax, u.uac); if (Upolyd) @@ -253,7 +253,7 @@ FormatStatusString(char *text, int format) /* forth line */ if (flags.time) - Sprintf(nb = eos(nb), "T:%ld ", moves); + Sprintf(nb = eos(nb), "T:%ld ", g.moves); if (strcmp(hu_stat[u.uhs], " ")) { Strcat(text, hu_stat[u.uhs]); diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index f1014b866..bb6800359 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -2558,7 +2558,7 @@ void NetHackQtStatusWindow::updateStats() dlevel.setLabel(buf,(long)depth(&u.uz)); } - gold.setLabel("Au:", money_cnt(invent)); + gold.setLabel("Au:", money_cnt(g.invent)); if (u.mtimedone) { // You're a monster! @@ -2592,7 +2592,7 @@ void NetHackQtStatusWindow::updateStats() align.setLabel("Lawful"); } - if (::flags.time) time.setLabel("Time:",(long)moves); + if (::flags.time) time.setLabel("Time:",(long)g.moves); else time.setLabel(""); #ifdef SCORE_ON_BOTL if (::flags.showscore) { diff --git a/win/Qt4/qt4menu.cpp b/win/Qt4/qt4menu.cpp index a33fdd48f..19d073cfe 100644 --- a/win/Qt4/qt4menu.cpp +++ b/win/Qt4/qt4menu.cpp @@ -670,7 +670,7 @@ static char** rip_line=0; snprintf(rip_line[NAME_LINE], STONE_LINE_LEN+1, "%s", g.plname); /* Put $ on stone */ - snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN+1, "%ld Au", money_cnt(invent)); + snprintf(rip_line[GOLD_LINE], STONE_LINE_LEN+1, "%ld Au", money_cnt(g.invent)); /* Put together death description */ formatkiller(buf, sizeof buf, how, FALSE); diff --git a/win/Qt4/qt4stat.cpp b/win/Qt4/qt4stat.cpp index 57e8b213c..be0ceb1cc 100644 --- a/win/Qt4/qt4stat.cpp +++ b/win/Qt4/qt4stat.cpp @@ -445,7 +445,7 @@ void NetHackQtStatusWindow::updateStats() dlevel.setLabel(buf,(long)::depth(&u.uz)); } - gold.setLabel("Au:", money_cnt(invent)); + gold.setLabel("Au:", money_cnt(g.invent)); if (u.mtimedone) { // You're a monster! @@ -483,7 +483,7 @@ void NetHackQtStatusWindow::updateStats() } align.setLabel(text); - if (::flags.time) time.setLabel("Time:",(long)moves); + if (::flags.time) time.setLabel("Time:",(long)g.moves); else time.setLabel(""); #ifdef SCORE_ON_BOTL if (::flags.showscore) { diff --git a/win/X11/winstat.c b/win/X11/winstat.c index 0d0a9002c..06d882c29 100644 --- a/win/X11/winstat.c +++ b/win/X11/winstat.c @@ -1362,7 +1362,7 @@ int i; val = (long) 0L; break; /* special */ case F_GOLD: - val = money_cnt(invent); + val = money_cnt(g.invent); if (val < 0L) val = 0L; /* ought to issue impossible() and discard gold */ break; @@ -1392,7 +1392,7 @@ int i; val = (long) u.ualign.type; break; case F_TIME: - val = flags.time ? (long) moves : 0L; + val = flags.time ? (long) g.moves : 0L; break; case F_SCORE: #ifdef SCORE_ON_BOTL diff --git a/win/curses/cursdial.c b/win/curses/cursdial.c index 41d8e9ffa..a81f4292d 100644 --- a/win/curses/cursdial.c +++ b/win/curses/cursdial.c @@ -174,7 +174,7 @@ curses_character_input_dialog(const char *prompt, const char *choices, boolean any_choice = FALSE; boolean accept_count = FALSE; - if (invent || (moves > 1)) { + if (g.invent || (g.moves > 1)) { curses_get_window_size(MAP_WIN, &map_height, &map_width); } else { map_height = term_rows; @@ -623,7 +623,7 @@ curses_display_nhmenu(winid wid, int how, MENU_ITEM_P ** _selected) menu_determine_pages(current_menu); /* Display pre and post-game menus centered */ - if (((moves <= 1) && !invent) || program_state.gameover) { + if (((g.moves <= 1) && !g.invent) || program_state.gameover) { win = curses_create_window(current_menu->width, current_menu->height, CENTER); } else { /* Display during-game menus on the right out of the way */ diff --git a/win/curses/cursmesg.c b/win/curses/cursmesg.c index a0554aa79..eaf55bc13 100644 --- a/win/curses/cursmesg.c +++ b/win/curses/cursmesg.c @@ -55,7 +55,7 @@ curses_message_win_puts(const char *message, boolean recursed) return; } - if (suppress_turn == moves) { + if (suppress_turn == g.moves) { return; } @@ -94,7 +94,7 @@ curses_message_win_puts(const char *message, boolean recursed) /* Pause until key is hit - Esc suppresses any further messages that turn */ if (curses_more() == '\033') { - suppress_turn = moves; + suppress_turn = g.moves; return; } } else { @@ -566,7 +566,7 @@ mesg_add_line(char *mline) nhprev_mesg *current_mesg = malloc(sizeof (nhprev_mesg)); current_mesg->str = curses_copy_of(mline); - current_mesg->turn = moves; + current_mesg->turn = g.moves; current_mesg->next_mesg = NULL; if (num_messages == 0) { diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index c9e886efb..642083d82 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -1182,7 +1182,7 @@ draw_horizontal(int x, int y, int hp, int hpmax) wprintw(win, "%s", buf); - print_statdiff("$", &prevau, money_cnt(invent), STAT_GOLD); + print_statdiff("$", &prevau, money_cnt(g.invent), STAT_GOLD); /* HP/Pw use special coloring rules */ attr_t hpattr, pwattr; @@ -1220,7 +1220,7 @@ draw_horizontal(int x, int y, int hp, int hpmax) print_statdiff(" Exp:", &prevlevel, u.ulevel, STAT_OTHER); if (flags.time) - print_statdiff(" T:", &prevtime, moves, STAT_TIME); + print_statdiff(" T:", &prevtime, g.moves, STAT_TIME); curses_add_statuses(win, FALSE, FALSE, NULL, NULL); } @@ -1293,7 +1293,7 @@ draw_horizontal_new(int x, int y, int hp, int hpmax) wprintw(win, "Pw:"); draw_bar(FALSE, u.uen, u.uenmax, NULL); - print_statdiff(" $", &prevau, money_cnt(invent), STAT_GOLD); + print_statdiff(" $", &prevau, money_cnt(g.invent), STAT_GOLD); #ifdef SCORE_ON_BOTL if (flags.showscore) @@ -1301,7 +1301,7 @@ draw_horizontal_new(int x, int y, int hp, int hpmax) #endif /* SCORE_ON_BOTL */ if (flags.time) - print_statdiff(" T:", &prevtime, moves, STAT_TIME); + print_statdiff(" T:", &prevtime, g.moves, STAT_TIME); curses_add_statuses(win, TRUE, FALSE, &x, &y); @@ -1409,7 +1409,7 @@ draw_vertical(int x, int y, int hp, int hpmax) wprintw(win, "%d", depth(&u.uz)); wmove(win, y++, x); - print_statdiff("Gold: ", &prevau, money_cnt(invent), STAT_GOLD); + print_statdiff("Gold: ", &prevau, money_cnt(g.invent), STAT_GOLD); wmove(win, y++, x); /* HP/Pw use special coloring rules */ @@ -1453,7 +1453,7 @@ draw_vertical(int x, int y, int hp, int hpmax) wmove(win, y++, x); if (flags.time) { - print_statdiff("Time: ", &prevtime, moves, STAT_TIME); + print_statdiff("Time: ", &prevtime, g.moves, STAT_TIME); wmove(win, y++, x); } diff --git a/win/curses/curswins.c b/win/curses/curswins.c index c74a39871..2ff6adaee 100644 --- a/win/curses/curswins.c +++ b/win/curses/curswins.c @@ -58,7 +58,7 @@ curses_create_window(int width, int height, orient orientation) if ((orientation == UP) || (orientation == DOWN) || (orientation == LEFT) || (orientation == RIGHT)) { - if (invent || (moves > 1)) { + if (g.invent || (g.moves > 1)) { map_border = curses_window_has_border(MAP_WIN); curses_get_window_xy(MAP_WIN, &mapx, &mapy); curses_get_window_size(MAP_WIN, &maph, &mapw); @@ -92,7 +92,7 @@ curses_create_window(int width, int height, orient orientation) starty = (term_rows / 2) - (height / 2); break; case UP: - if (invent || (moves > 1)) { + if (g.invent || (g.moves > 1)) { startx = (mapw / 2) - (width / 2) + mapx + mapb_offset; } else { startx = 0; @@ -101,7 +101,7 @@ curses_create_window(int width, int height, orient orientation) starty = mapy + mapb_offset; break; case DOWN: - if (invent || (moves > 1)) { + if (g.invent || (g.moves > 1)) { startx = (mapw / 2) - (width / 2) + mapx + mapb_offset; } else { startx = 0; @@ -117,7 +117,7 @@ curses_create_window(int width, int height, orient orientation) starty = term_rows - height; break; case RIGHT: - if (invent || (moves > 1)) { + if (g.invent || (g.moves > 1)) { startx = (mapw + mapx + (mapb_offset * 2)) - width; } else { startx = term_cols - width; @@ -167,7 +167,7 @@ curses_refresh_nethack_windows() map_window = curses_get_nhwin(MAP_WIN); inv_window = curses_get_nhwin(INV_WIN); - if ((moves <= 1) && !invent) { + if ((g.moves <= 1) && !g.invent) { /* Main windows not yet displayed; refresh base window instead */ touchwin(stdscr); refresh(); diff --git a/win/gnome/gnstatus.c b/win/gnome/gnstatus.c index 3d9a7520d..a1031fb69 100644 --- a/win/gnome/gnstatus.c +++ b/win/gnome/gnstatus.c @@ -558,7 +558,7 @@ ghack_status_window_update_stats() gtk_label_set(GTK_LABEL(chaLabel), buf); /* Now do the non-pixmaped stats (gold and such) */ - umoney = money_cnt(invent); + umoney = money_cnt(g.invent); sprintf(buf, "Au:%ld", umoney); if (lastAu < umoney && firstTime == FALSE) { /* Ok, this changed so add it to the highlighing list */ @@ -662,7 +662,7 @@ ghack_status_window_update_stats() } if (flags.time) { - sprintf(buf, "Time:%ld", moves); + sprintf(buf, "Time:%ld", g.moves); gtk_label_set(GTK_LABEL(timeLabel), buf); } else gtk_label_set(GTK_LABEL(timeLabel), "");