diff --git a/xwords4/common/board.c b/xwords4/common/board.c index ac1d7d9b5..2252b004c 100644 --- a/xwords4/common/board.c +++ b/xwords4/common/board.c @@ -2107,6 +2107,7 @@ board_requestHint( BoardCtxt* board, if ( searchComplete && canMove ) { model_makeTurnFromMoveInfo( model, selPlayer, &newMove); } else { + result = XP_FALSE; XP_STATUSF( "unable to complete hint request\n" ); } *workRemainsP = !searchComplete; @@ -2124,6 +2125,10 @@ board_requestHint( BoardCtxt* board, } else { util_userError( board->util, ERR_NO_HINT_FOUND ); } + + if ( !result ) { + util_userError( board->util, ERR_NO_HINT_FOUND ); + } } return result || redraw; } /* board_requestHint */ diff --git a/xwords4/common/engine.c b/xwords4/common/engine.c index ecb7c5830..b1aa40c62 100644 --- a/xwords4/common/engine.c +++ b/xwords4/common/engine.c @@ -393,6 +393,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model, { XP_Bool result = XP_TRUE; XP_U16 star_row; + XP_Bool canMove = XP_FALSE; engine->nTilesMax = XP_MIN( MAX_TRAY_TILES, nTiles ); #ifdef XWFEATURE_BONUSALL @@ -445,9 +446,9 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model, dictionary's emtpy or there are no tiles, still return TRUE so we don't get scheduled again. Fixes infinite loop with empty dict and a robot. */ - *canMoveP = NULL != dict_getTopEdge(engine->dict) + canMove = NULL != dict_getTopEdge(engine->dict) && initTray( engine, tiles, nTiles ); - if ( *canMoveP ) { + if ( canMove ) { util_engineStarting( engine->util, engine->rack[engine->blankTile] ); @@ -528,6 +529,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model, XP_MEMCPY( newMove, &move->moveInfo, sizeof(*newMove) ); } else { newMove->nTiles = 0; + canMove = XP_FALSE; } result = XP_TRUE; } @@ -540,6 +542,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model, newMove->nTiles = 0; } + *canMoveP = canMove; return result; } /* engine_findMove */