support hint limits feature

This commit is contained in:
ehouse 2004-07-10 17:46:36 +00:00
parent 74aa6ec990
commit a8ad591ebe
2 changed files with 63 additions and 16 deletions

View file

@ -41,6 +41,7 @@
#include "ceutil.h"
#include "ceir.h"
#include "ceclrsel.h"
#include "cehntlim.h"
#include "LocalizedStrIncludes.h"
@ -94,6 +95,10 @@ static XWStreamCtxt* ce_util_makeStreamFromAddr( XW_UtilCtxt* uc,
static XP_UCHAR* ce_util_getUserString( XW_UtilCtxt* uc, XP_U16 stringCode );
static XP_Bool ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi,
XP_U16 turn, XP_Bool turnLost );
#ifdef XWFEATURE_SEARCHLIMIT
static XP_Bool ce_util_getTraySearchLimits( XW_UtilCtxt* uc, XP_U16* min,
XP_U16* max );
#endif
#ifdef SHOW_PROGRESS
static void ce_util_engineStarting( XW_UtilCtxt* uc );
static void ce_util_engineStopping( XW_UtilCtxt* uc );
@ -233,6 +238,9 @@ ceInitUtilFuncs( CEAppGlobals* globals )
vtable->m_util_makeEmptyDict = ce_util_makeEmptyDict;
vtable->m_util_getUserString = ce_util_getUserString;
vtable->m_util_warnIllegalWord = ce_util_warnIllegalWord;
#ifdef XWFEATURE_SEARCHLIMIT
vtable->m_util_getTraySearchLimits = ce_util_getTraySearchLimits;
#endif
#ifdef SHOW_PROGRESS
vtable->m_util_engineStarting = ce_util_engineStarting;
vtable->m_util_engineStopping = ce_util_engineStopping;
@ -774,7 +782,8 @@ ceHandleHintRequest( CEAppGlobals* globals )
XP_Bool draw;
XP_ASSERT( !!globals->game.board );
draw = board_requestHint( globals->game.board, XP_FALSE, &notDone );
draw = board_requestHint( globals->game.board, globals->askTrayLimits,
&notDone );
globals->hintPending = notDone;
return draw;
} /* ceHandleHintRequest */
@ -1301,7 +1310,12 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
break;
case ID_MOVE_HINT:
#ifdef XWFEATURE_SEARCHLIMIT
case ID_MOVE_LIMITEDHINT:
globals->askTrayLimits = wmId == ID_MOVE_LIMITEDHINT;
#endif
board_resetEngine( globals->game.board );
/* fallthru */
case ID_MOVE_NEXTHINT:
case HINT_BUTTON_ID:
draw = ceHandleHintRequest( globals );
@ -1792,7 +1806,6 @@ ce_util_askPassword( XW_UtilCtxt* uc, const XP_UCHAR* name,
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
XP_MEMSET( &state, 0, sizeof(state) );
state.globals = globals;
state.name = name;
state.buf = buf;
state.lenp = len;
@ -1994,6 +2007,31 @@ ce_util_warnIllegalWord( XW_UtilCtxt* uc, BadWordInfo* bwi,
return isOk;
} /* ce_util_warnIllegalWord */
#ifdef XWFEATURE_SEARCHLIMIT
static XP_Bool
ce_util_getTraySearchLimits( XW_UtilCtxt* uc, XP_U16* min, XP_U16* max )
{
CEAppGlobals* globals = (CEAppGlobals*)uc->closure;
HintLimitsState hls;
XP_MEMSET( &hls, 0, sizeof(hls) );
hls.globals = globals;
hls.min = *min;
hls.max = *max;
DialogBoxParam( globals->hInst, (LPCTSTR)IDD_ASKHINTLIMTS, globals->hWnd,
(DLGPROC)HintLimitsDlg, (long)&hls );
if ( !hls.cancelled ) {
*min = hls.min;
*max = hls.max;
}
return !hls.cancelled;
} /* ce_util_getTraySearchLimits */
#endif
#ifdef SHOW_PROGRESS
static void
ce_util_engineStarting( XW_UtilCtxt* uc )

View file

@ -16,13 +16,16 @@
#define IDD_ASKBLANK 113
#define IDD_ASKPASS 116
#define IDD_OPTIONSDLG 117
#define IDD_COLORSDLG 118
#define IDD_COLOREDITDLG 119
#define IDD_COLORSDLG 118
#define IDD_COLOREDITDLG 119
#define IDB_FLIPBUTTON 120
#define IDB_VALUESBUTTON 121
#define IDB_HINTBUTTON 122
#define IDB_JUGGLEBUTTON 123
#define IDB_ORIGIN 124
#ifdef XWFEATURE_SEARCHLIMIT
# define IDD_ASKHINTLIMTS 125
#endif
#define FLIP_BUTTON_ID 1001
#define VALUE_BUTTON_ID 1002
@ -126,6 +129,9 @@
# define BLUE_LABEL 1084
#endif // MY_COLOR_SEL
#define HC_MIN_COMBO 1085
#define HC_MAX_COMBO 1086
#define IDM_FILE_EXIT 40002
#define IDM_HELP_ABOUT 40003
#define ID_FILE_ABOUT 40004
@ -134,17 +140,20 @@
#define ID_GAME_FINALSCORES 40007
#define ID_GAME_TILECOUNTSANDVALUES 40008
#define ID_MOVE_HINT 40009
#define ID_MOVE_NEXTHINT 40010
#define ID_MOVE_UNDOCURRENT 40011
#define ID_MOVE_UNDOLAST 40012
#define ID_MOVE_TRADE 40013
#define ID_MOVE_JUGGLE 40014
#define ID_MOVE_HIDETRAY 40015
#define ID_MOVE_TURNDONE 40016
#define ID_FILE_NEWGAME 40017
#define ID_FILE_SAVEDGAMES 40018
#define ID_EDITTEXT 40019
#define ID_FILE_PREFERENCES 40020
#ifdef XWFEATURE_SEARCHLIMIT
# define ID_MOVE_LIMITEDHINT 40010
#endif
#define ID_MOVE_NEXTHINT 40011
#define ID_MOVE_UNDOCURRENT 40012
#define ID_MOVE_UNDOLAST 40013
#define ID_MOVE_TRADE 40014
#define ID_MOVE_JUGGLE 40015
#define ID_MOVE_HIDETRAY 40016
#define ID_MOVE_TURNDONE 40017
#define ID_FILE_NEWGAME 40018
#define ID_FILE_SAVEDGAMES 40019
#define ID_EDITTEXT 40020
#define ID_FILE_PREFERENCES 40021
#define ID_FILE_BEAMDICT 40022
#define ID_FILE_BEAMBOARDS 40023
#define ID_GAME_RESENDMSGS 40024
@ -158,7 +167,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 125
#define _APS_NEXT_COMMAND_VALUE 40025
#define _APS_NEXT_CONTROL_VALUE 1085
#define _APS_NEXT_CONTROL_VALUE 1087
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif