Merge branch 'NetHack-3.6.2-beta01' into NetHack-3.6.2

This commit is contained in:
nhmall
2018-12-13 08:45:47 -05:00
17 changed files with 168 additions and 35 deletions

View File

@@ -406,6 +406,7 @@ for ^X and enlightenment, display the information in a menu rather than a
'<' (menu_previous_page) and '^' (menu_first_page) menu keys;
needed for interfaces (tty) without text popup scrollbar support;
end of game disclosure of attributes remains single-forward-pass
for ^X, include current state of 'autopickup'
NetHack Community Patches (or Variation) Included

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1544401264 2018/12/10 00:21:04 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.666 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1544669659 2018/12/13 02:54:19 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.667 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -174,6 +174,7 @@ E boolean NDECL(status_hilite_menu);
/* ### cmd.c ### */
E char NDECL(randomkey);
E void FDECL(random_response, (char * buf, int size));
E int NDECL(doconduct);
E int NDECL(domonability);
E char FDECL(cmd_from_func, (int NDECL((*))));
@@ -1729,6 +1730,7 @@ E int FDECL(fruitadd, (char *, struct fruit *));
E int FDECL(choose_classes_menu, (const char *, int, BOOLEAN_P,
char *, char *));
E boolean FDECL(parsebindings, (char *));
E void FDECL(oc_to_str, (char *, char *));
E void FDECL(add_menu_cmd_alias, (CHAR_P, CHAR_P));
E char FDECL(get_menu_cmd_key, (CHAR_P));
E char FDECL(map_menu_cmd, (CHAR_P));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1544050555 2018/12/05 22:55:55 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.314 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1544695944 2018/12/13 10:12:24 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.318 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2019,6 +2019,22 @@ int final;
enl_msg(Your_wallet, "contains ", "contained ", buf, "");
}
}
if (flags.pickup) {
char ocl[MAXOCLASSES + 1];
Strcpy(buf, "on");
oc_to_str(flags.pickup_types, ocl);
Sprintf(eos(buf), " for %s%s%s",
*ocl ? "'" : "", *ocl ? ocl : "all types", *ocl ? "'" : "");
if (flags.pickup_thrown && *ocl) /* *ocl: don't show if 'all types' */
Strcat(buf, " plus thrown");
if (iflags.autopickup_exceptions[AP_GRAB]
|| iflags.autopickup_exceptions[AP_LEAVE])
Strcat(buf, ", with exceptions");
} else
Strcpy(buf, "off");
enl_msg("Auto-pickup ", "is ", "was ", buf, "");
}
/* characteristics: expanded version of bottom line strength, dexterity, &c */
@@ -4421,6 +4437,28 @@ randomkey()
return c;
}
void
random_response(buf, sz)
char *buf;
int sz;
{
char c;
int count = 0;
for (;;) {
c = randomkey();
if (c == '\n')
break;
if (c == '\033') {
count = 0;
break;
}
if (count < sz - 1)
buf[count++] = c;
}
buf[count] = '\0';
}
int
ch2spkeys(c, start, end)
char c;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 end.c $NHDT-Date: 1544003110 2018/12/05 09:45:10 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.156 $ */
/* NetHack 3.6 end.c $NHDT-Date: 1544666123 2018/12/13 01:55:23 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.157 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -577,13 +577,13 @@ VA_DECL(const char *, str)
? "Program initialization has failed."
: "Suddenly, the dungeon collapses.");
#ifndef MICRO
#if defined(NOTIFY_NETHACK_BUGS)
#ifdef NOTIFY_NETHACK_BUGS
if (!wizard)
raw_printf("Report the following error to \"%s\" or at \"%s\".",
DEVTEAM_EMAIL, DEVTEAM_URL);
else if (program_state.something_worth_saving)
raw_print("\nError save file being written.\n");
#else
#else /* !NOTIFY_NETHACK_BUGS */
if (!wizard) {
const char *maybe_rebuild = !program_state.something_worth_saving
? "."
@@ -599,7 +599,7 @@ VA_DECL(const char *, str)
raw_printf("Report error to \"%s\"%s", WIZARD_NAME,
maybe_rebuild);
}
#endif
#endif /* ?NOTIFY_NETHACK_BUGS */
/* XXX can we move this above the prints? Then we'd be able to
* suppress "it may be possible to rebuild" based on dosave0()
* or say it's NOT possible to rebuild. */
@@ -611,7 +611,7 @@ VA_DECL(const char *, str)
raw_printf("%s", sysopt.recover);
}
}
#endif
#endif /* !MICRO */
{
char buf[BUFSZ];
@@ -1055,7 +1055,16 @@ int how;
if (iflags.debug_fuzzer) {
if (!(program_state.panicking || how == PANICKED)) {
savelife(how);
killer.name[0] = 0;
/* periodically restore characteristics and lost exp levels */
if (!rn2(10)) {
struct obj *potion = mksobj(POT_RESTORE_ABILITY, TRUE, FALSE);
bless(potion);
(void) peffects(potion); /* always -1 for restore ability */
/* not useup(); we haven't put this potion into inventory */
obfree(potion, (struct obj *) 0);
}
killer.name[0] = '\0';
killer.format = 0;
return;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1544396581 2018/12/09 23:03:01 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.340 $ */
/* NetHack 3.6 options.c $NHDT-Date: 1544669666 2018/12/13 02:54:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.344 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -557,7 +557,6 @@ STATIC_DCL int NDECL(count_menucolors);
STATIC_DCL boolean FDECL(parse_role_opts, (BOOLEAN_P, const char *,
char *, char **));
STATIC_DCL void FDECL(oc_to_str, (char *, char *));
STATIC_DCL void FDECL(doset_add_menu, (winid, const char *, int));
STATIC_DCL void FDECL(opts_add_others, (winid, const char *, int,
char *, int));
@@ -2986,12 +2985,17 @@ boolean tinitial, tfrom_file;
use_menu = TRUE;
if (flags.menu_style == MENU_TRADITIONAL
|| flags.menu_style == MENU_COMBINATION) {
boolean wasspace;
use_menu = FALSE;
Sprintf(qbuf, "New %s: [%s am] (%s)", fullname, ocl,
*tbuf ? tbuf : "all");
getlin(qbuf, abuf);
wasspace = (abuf[0] == ' '); /* before mungspaces */
op = mungspaces(abuf);
if (abuf[0] == '\0' || abuf[0] == '\033')
if (wasspace && !abuf[0])
; /* one or more spaces will remove old value */
else if (!abuf[0] || abuf[0] == '\033')
op = tbuf; /* restore */
else if (abuf[0] == 'm')
use_menu = TRUE;
@@ -4081,7 +4085,7 @@ static NEARDATA const char *sortltype[] = { "none", "loot", "full" };
* Convert the given string of object classes to a string of default object
* symbols.
*/
STATIC_OVL void
void
oc_to_str(src, dest)
char *src, *dest;
{

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 steed.c $NHDT-Date: 1544608468 2018/12/12 09:54:28 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.60 $ */
/* NetHack 3.6 steed.c $NHDT-Date: 1544666049 2018/12/13 01:54:09 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.61 $ */
/* Copyright (c) Kevin Hugo, 1998-1999. */
/* NetHack may be freely redistributed. See license for details. */
@@ -756,7 +756,7 @@ int x, y;
return;
}
if (level.monsters[x][y])
impossible("placing monster over another?");
impossible("placing monster over another at <%d,%d>?", x, y);
mon->mx = x, mon->my = y;
level.monsters[x][y] = mon;
}

View File

@@ -348,7 +348,10 @@ attempt_restore:
if (discover)
You("are in non-scoring discovery mode.");
}
moveloop(resuming);
// iflags.debug_fuzzer = TRUE;
moveloop(resuming);
nethack_exit(EXIT_SUCCESS);
/*NOTREACHED*/
return 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mhdlg.c $NHDT-Date: 1432512812 2015/05/25 00:13:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.25 $ */
/* NetHack 3.6 mhdlg.c $NHDT-Date: 1544695946 2018/12/13 10:12:26 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.30 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
@@ -25,6 +25,14 @@ INT_PTR CALLBACK GetlinDlgProc(HWND, UINT, WPARAM, LPARAM);
int
mswin_getlin_window(const char *question, char *result, size_t result_size)
{
if (iflags.debug_fuzzer) {
random_response(result, (int) result_size);
if (result[0] != '\0')
return IDOK;
else
return IDCANCEL;
}
INT_PTR ret;
struct getlin_data data;

View File

@@ -529,6 +529,11 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
child = GetNHApp()->windowlist[msg_param->wid].win;
} break;
case MSNH_MSG_RANDOM_INPUT:
nhassert(0); // unexpected
break;
}
}

View File

@@ -722,7 +722,11 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
}
} break;
} /* end switch(wParam) */
case MSNH_MSG_RANDOM_INPUT:
nhassert(0); // unexpected
break;
} /* end switch(wParam) */
}
/* on WM_CREATE */

View File

@@ -687,6 +687,18 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
ZeroMemory(data->menu.prompt, sizeof(data->menu.prompt));
}
} break;
case MSNH_MSG_RANDOM_INPUT: {
char c = randomkey();
if (c == '\n')
PostMessage(hWnd, WM_COMMAND, MAKELONG(IDOK, 0), 0);
else if (c == '\033')
PostMessage(hWnd, WM_COMMAND, MAKELONG(IDCANCEL, 0), 0);
else
PostMessage(GetDlgItem(hWnd, IDC_TEXT_CONTROL), WM_CHAR, c, 0);
} break;
}
}
/*-----------------------------------------------------------------------------*/

View File

@@ -21,6 +21,7 @@
#define MSNH_MSG_CARET 110
#define MSNH_MSG_GETTEXT 111
#define MSNH_MSG_UPDATE_STATUS 112
#define MSNH_MSG_RANDOM_INPUT 113
typedef struct mswin_nhmsg_add_wnd {
winid wid;

View File

@@ -416,6 +416,10 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
}
} break;
case MSNH_MSG_RANDOM_INPUT:
nhassert(0); // unexpected
break;
} /* switch( wParam ) */
}

View File

@@ -282,6 +282,11 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
data->window_text = NULL;
break;
}
case MSNH_MSG_RANDOM_INPUT:
nhassert(0); // unexpected
break;
}
}

View File

@@ -219,6 +219,11 @@ StatusWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
data->status_lines = msg_data->status_lines;
InvalidateRect(hWnd, NULL, TRUE);
} break;
case MSNH_MSG_RANDOM_INPUT:
nhassert(0); // unexpected
break;
} /* end switch( wParam ) { */
} break;

View File

@@ -212,6 +212,19 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
_tcscat(data->window_text, TEXT("\r\n"));
break;
}
case MSNH_MSG_RANDOM_INPUT: {
char c = randomkey();
if (c == '\n')
PostMessage(hWnd, WM_COMMAND, MAKELONG(IDOK, 0), 0);
else if (c == '\033')
PostMessage(hWnd, WM_COMMAND, MAKELONG(IDCANCEL, 0), 0);
else
PostMessage(GetDlgItem(hWnd, IDC_TEXT_CONTROL), WM_CHAR, c, 0);
}
break;
}
}

View File

@@ -2102,14 +2102,24 @@ mswin_main_loop()
{
MSG msg;
while (!mswin_have_input() && GetMessage(&msg, NULL, 0, 0) != 0) {
if (GetNHApp()->regNetHackMode
|| !TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable,
&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
while (!mswin_have_input()) {
if (!iflags.debug_fuzzer || PeekMessage(&msg, NULL, 0, 0, FALSE)) {
if(GetMessage(&msg, NULL, 0, 0) != 0) {
if (GetNHApp()->regNetHackMode
|| !TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable,
&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} else {
/* WM_QUIT */
break;
}
} else {
nhassert(iflags.debug_fuzzer);
NHEVENT_KBD(randomkey());
}
}
}
/* clean up and quit */
@@ -2222,16 +2232,25 @@ mswin_popup_display(HWND hWnd, int *done_indicator)
SetFocus(hWnd);
/* go into message loop */
while (IsWindow(hWnd) && (done_indicator == NULL || !*done_indicator)
&& GetMessage(&msg, NULL, 0, 0) != 0) {
if (!IsDialogMessage(hWnd, &msg)) {
if (!TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable,
&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
while (IsWindow(hWnd) && (done_indicator == NULL || !*done_indicator)) {
if (!iflags.debug_fuzzer || PeekMessage(&msg, NULL, 0, 0, FALSE)) {
if(GetMessage(&msg, NULL, 0, 0) != 0) {
if (!IsDialogMessage(hWnd, &msg)) {
if (!TranslateAccelerator(msg.hwnd, GetNHApp()->hAccelTable,
&msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
} else {
/* WM_QUIT */
break;
}
} else {
nhassert(iflags.debug_fuzzer);
PostMessage(hWnd, WM_MSNH_COMMAND, MSNH_MSG_RANDOM_INPUT, 0);
}
}
}
void