<email deleted>

The following fixes several bugs:
1) Mismatch between docs and game in definition of what '+' resolved in
favor of docs...
2) When game needs to be recovered a message box is shown.  This is a very
deprecated fix.  It pretty much answers just the conditions that require
this (a yn question to an erroneous winid), and is not useful for other
purposes.
3) The score file is written.
This commit is contained in:
nethack.allison
2002-02-03 17:51:54 +00:00
parent ab55d29244
commit baa752d5f9
6 changed files with 32 additions and 16 deletions

View File

@@ -290,7 +290,7 @@ static const struct pad {
{'h', 'H', C('h')}, /* 4 */
{'g', 'g', 'g'}, /* 5 */
{'l', 'L', C('l')}, /* 6 */
{'p', 'P', C('p')}, /* + */
{'+', 'P', C('p')}, /* + */
{'b', 'B', C('b')}, /* 1 */
{'j', 'J', C('j')}, /* 2 */
{'n', 'N', C('n')}, /* 3 */
@@ -304,7 +304,7 @@ static const struct pad {
{'4', M('4'), '4'}, /* 4 */
{'g', 'G', 'g'}, /* 5 */
{'6', M('6'), '6'}, /* 6 */
{'p', 'P', C('p')}, /* + */
{'+', 'P', C('p')}, /* + */
{'1', M('1'), '1'}, /* 1 */
{'2', M('2'), '2'}, /* 2 */
{'3', M('3'), '3'}, /* 3 */

View File

@@ -28,7 +28,7 @@ OPTIONS=IBMGraphics
# General options. You might also set "silent" so as not to attract
# the boss's attention.
#
OPTIONS=time,noshowexp,number_pad,lit_corridor,rest_on_space
OPTIONS=time,noshowexp,number_pad,lit_corridor,rest_on_space,toptenwin
#
# If you want to get rid of "use #quit to quit..." use:
#OPTIONS=suppress_alert:3.3.1

View File

@@ -103,7 +103,7 @@ keypad[KEY_LAST][3] = {
{'h', 'H', C('h')}, /* 4 */
{'g', 'g', 'g'}, /* 5 */
{'l', 'L', C('l')}, /* 6 */
{'p', 'P', C('p')}, /* + */
{'+', 'P', C('p')}, /* + */
{'b', 'B', C('b')}, /* 1 */
{'j', 'J', C('j')}, /* 2 */
{'n', 'N', C('n')}, /* 3 */
@@ -118,7 +118,7 @@ numpad[KEY_LAST][3] = {
{'4', M('4'), '4'}, /* 4 */
{'g', 'G', 'g'}, /* 5 */
{'6', M('6'), '6'}, /* 6 */
{'p', 'P', C('p')}, /* + */
{'+', 'P', C('p')}, /* + */
{'1', M('1'), '1'}, /* 1 */
{'2', M('2'), '2'}, /* 2 */
{'3', M('3'), '3'}, /* 3 */

View File

@@ -141,14 +141,10 @@ void mswin_askname(void)
{
logDebug("mswin_askname()\n");
#ifdef _DEBUG
strcpy(plname, "wizard");
#else
if( mswin_getlin_window("who are you?", plname, PL_NSIZ)==IDCANCEL ) {
if( mswin_getlin_window("Who are you?", plname, PL_NSIZ)==IDCANCEL ) {
bail("bye-bye");
/* not reached */
}
#endif
}
@@ -167,8 +163,6 @@ void mswin_get_nh_event(void)
void mswin_exit_nhwindows(const char *str)
{
logDebug("mswin_exit_nhwindows(%s)\n", str);
terminate(EXIT_SUCCESS);
}
/* Prepare the window to be suspended. */
@@ -447,6 +441,13 @@ void mswin_putstr(winid wid, int attr, const char *text)
WM_MSNH_COMMAND, (WPARAM)MSNH_MSG_PUTSTR, (LPARAM)&data );
}
}
else
{
// build text to display later in message box
GetNHApp()->saved_text = realloc(GetNHApp()->saved_text, strlen(text) +
strlen(GetNHApp()->saved_text) + 1);
strcat(GetNHApp()->saved_text, text);
}
}
/* Display the file named str. Complain about missing files
@@ -854,6 +855,22 @@ char mswin_yn_function(const char *question, const char *choices,
logDebug("mswin_yn_function(%s, %s, %d)\n", question, choices, def);
if (WIN_MESSAGE == WIN_ERR && choices == ynchars) {
char *text = realloc(strdup(GetNHApp()->saved_text), strlen(question)
+ strlen(GetNHApp()->saved_text) + 1);
DWORD box_result;
strcat(text, question);
box_result = MessageBox(NULL,
NH_W2A(text, message, sizeof(message)),
TEXT("NetHack for Windows"),
MB_YESNOCANCEL |
((def == 'y') ? MB_DEFBUTTON1 :
(def == 'n') ? MB_DEFBUTTON2 : MB_DEFBUTTON3));
free(text);
GetNHApp()->saved_text = strdup(TEXT(""));
return box_result == IDYES ? 'y' : box_result == IDNO ? 'n' : '\033';
}
if (choices) {
char *cb, choicebuf[QBUFSZ];
Strcpy(choicebuf, choices);

View File

@@ -54,6 +54,8 @@ typedef struct mswin_nhwindow_app {
int winStatusAlign; /* alignment of the status window */
int winMessageAlign; /* alignment of the status window */
char* saved_text;
} NHWinApp, *PNHWinApp;
extern PNHWinApp GetNHApp();

View File

@@ -62,6 +62,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
_nethack_app.winStatusAlign = NHWND_ALIGN_BOTTOM;
_nethack_app.winMessageAlign = NHWND_ALIGN_TOP;
_nethack_app.mapCliparoundMargin = DEF_CLIPAROUND_MARGIN;
_nethack_app.saved_text = strdup(TEXT(""));
// init controls
ZeroMemory(&InitCtrls, sizeof(InitCtrls));
@@ -75,10 +76,6 @@ int APIENTRY WinMain(HINSTANCE hInstance,
return FALSE;
}
#ifdef _DEBUG
wizard = TRUE;
#endif
/* get command line parameters */
p = _tcstok(GetCommandLine(), TEXT(" "));
for( argc=0; p && argc<MAX_CMDLINE_PARAM; argc++ ) {