pass to engine boolean telling it whether to ask for tray hint limits;

address, for penDown only, confusion between whether pen events are
handled and whether the handling means a redraw is required.  Might
need to do same for penMoved and penUp.
This commit is contained in:
ehouse 2004-06-25 06:47:35 +00:00
parent ecc48fde1c
commit f900988bcc
2 changed files with 54 additions and 39 deletions

View file

@ -1455,7 +1455,11 @@ preflight( BoardCtxt* board )
* any redrawing to be done. * any redrawing to be done.
*/ */
XP_Bool XP_Bool
board_requestHint( BoardCtxt* board, XP_U16 nTilesToUse, XP_Bool* workRemainsP ) board_requestHint( BoardCtxt* board,
#ifdef XWFEATURE_SEARCHLIMIT
XP_Bool useTileLimits,
#endif
XP_Bool* workRemainsP )
{ {
MoveInfo newMove; MoveInfo newMove;
XP_Bool result = XP_FALSE; XP_Bool result = XP_FALSE;
@ -1506,11 +1510,12 @@ board_requestHint( BoardCtxt* board, XP_U16 nTilesToUse, XP_Bool* workRemainsP )
#endif #endif
searchComplete = engine_findMove(engine, model, searchComplete = engine_findMove(engine, model,
model_getDictionary(model), model_getDictionary(model),
tiles, nTiles, nTilesToUse, tiles, nTiles,
#ifdef XWFEATURE_SEARCHLIMIT #ifdef XWFEATURE_SEARCHLIMIT
(board->gi->allowHintRect && (board->gi->allowHintRect &&
board->hasHintRect[selPlayer])? board->hasHintRect[selPlayer])?
&board->limits[selPlayer] : NULL, &board->limits[selPlayer] : NULL,
useTileLimits,
#endif #endif
NO_SCORE_LIMIT, NO_SCORE_LIMIT,
&canMove, &newMove ); &canMove, &newMove );
@ -1835,7 +1840,7 @@ figureHintAtts( BoardCtxt* board, XP_U16 col, XP_U16 row )
HintAtts result = HINT_BORDER_NONE; HintAtts result = HINT_BORDER_NONE;
if ( board->trayVisState == TRAY_REVEALED && board->gi->allowHintRect ) { if ( board->trayVisState == TRAY_REVEALED && board->gi->allowHintRect ) {
HintLimits limits; BdHintLimits limits;
XP_Bool isFlipped = board->isFlipped; XP_Bool isFlipped = board->isFlipped;
limits = board->limits[board->selPlayer]; limits = board->limits[board->selPlayer];
@ -1923,7 +1928,7 @@ invalCellRegion( BoardCtxt* board, XP_U16 colA, XP_U16 rowA, XP_U16 colB,
static void static void
invalCurHintRect( BoardCtxt* board, XP_U16 player, XP_Bool doMirror ) invalCurHintRect( BoardCtxt* board, XP_U16 player, XP_Bool doMirror )
{ {
HintLimits* limits = &board->limits[player]; BdHintLimits* limits = &board->limits[player];
invalCellRegion( board, limits->left, limits->top, invalCellRegion( board, limits->left, limits->top,
limits->right, limits->bottom, doMirror ); limits->right, limits->bottom, doMirror );
} /* invalCurHintRect */ } /* invalCurHintRect */
@ -1938,7 +1943,7 @@ clearCurHintRect( BoardCtxt* board )
static void static void
setHintRect( BoardCtxt* board ) setHintRect( BoardCtxt* board )
{ {
HintLimits limits; BdHintLimits limits;
if ( board->hintDragStartRow < board->hintDragCurRow ) { if ( board->hintDragStartRow < board->hintDragCurRow ) {
limits.top = board->hintDragStartRow; limits.top = board->hintDragStartRow;
limits.bottom = board->hintDragCurRow; limits.bottom = board->hintDragCurRow;
@ -2119,15 +2124,18 @@ checkRevealTray( BoardCtxt* board )
#ifdef POINTER_SUPPORT #ifdef POINTER_SUPPORT
XP_Bool XP_Bool
board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Time when ) board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Time when,
XP_Bool* handled )
{ {
XP_Bool result = XP_FALSE; XP_Bool result = XP_FALSE;
XP_Bool penDidSomething;
BoardObjectType onWhich; BoardObjectType onWhich;
if ( !pointOnSomething( board, x, y, &onWhich ) ) { penDidSomething = pointOnSomething( board, x, y, &onWhich );
if ( !penDidSomething ) {
board->penDownObject = OBJ_NONE; board->penDownObject = OBJ_NONE;
return XP_FALSE; } else {
}
switch ( onWhich ) { switch ( onWhich ) {
@ -2158,6 +2166,9 @@ board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Time when )
board->penDownTime = when; board->penDownTime = when;
board->penDownObject = onWhich; board->penDownObject = onWhich;
/* board->inDrag = XP_TRUE; */ /* board->inDrag = XP_TRUE; */
}
*handled = penDidSomething;
return result; /* no redraw needed */ return result; /* no redraw needed */
} /* board_handlePenDown */ } /* board_handlePenDown */

View file

@ -104,7 +104,11 @@ XP_Bool board_getShowColors( BoardCtxt* board );
XP_Bool board_setShowColors( BoardCtxt* board, XP_Bool showColors ); XP_Bool board_setShowColors( BoardCtxt* board, XP_Bool showColors );
XP_Bool board_replaceTiles( BoardCtxt* board ); XP_Bool board_replaceTiles( BoardCtxt* board );
XP_Bool board_requestHint( BoardCtxt* board, XP_U16 nTilesToUse, XP_Bool* workRemainsP ); XP_Bool board_requestHint( BoardCtxt* board,
#ifdef XWFEATURE_SEARCHLIMIT
XP_Bool useTileLimits,
#endif
XP_Bool* workRemainsP );
void board_setScale( BoardCtxt* board, XP_U16 hScale, XP_U16 vScale ); void board_setScale( BoardCtxt* board, XP_U16 hScale, XP_U16 vScale );
void board_getScale( BoardCtxt* board, XP_U16* hScale, XP_U16* vScale ); void board_getScale( BoardCtxt* board, XP_U16* hScale, XP_U16* vScale );
@ -125,7 +129,7 @@ void board_popTimerSave( BoardCtxt* board );
#ifdef POINTER_SUPPORT #ifdef POINTER_SUPPORT
XP_Bool board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y,
XP_Time when ); XP_Time when, XP_Bool* handled );
XP_Bool board_handlePenMove( BoardCtxt* board, XP_U16 x, XP_U16 y ); XP_Bool board_handlePenMove( BoardCtxt* board, XP_U16 x, XP_U16 y );
XP_Bool board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Time when ); XP_Bool board_handlePenUp( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Time when );
#endif #endif