mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
Fix bug reported by user: if robot finishes a search but fails to find
a move it's still done with its turn and must trade or pass.
This commit is contained in:
parent
38ed6e4054
commit
3dba8ba13b
2 changed files with 11 additions and 9 deletions
|
@ -513,11 +513,13 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
|||
result = XP_FALSE;
|
||||
} else {
|
||||
PossibleMove* move;
|
||||
result = chooseMove( engine, &move );
|
||||
if ( result ) {
|
||||
if ( chooseMove( engine, &move ) ) {
|
||||
XP_ASSERT( !!newMove );
|
||||
XP_MEMCPY( newMove, &move->moveInfo, sizeof(*newMove) );
|
||||
} else {
|
||||
newMove->nTiles = 0;
|
||||
}
|
||||
result = XP_TRUE;
|
||||
}
|
||||
|
||||
util_engineStopping( engine->util );
|
||||
|
|
|
@ -642,7 +642,7 @@ static XP_Bool
|
|||
makeRobotMove( ServerCtxt* server )
|
||||
{
|
||||
XP_Bool result = XP_FALSE;
|
||||
XP_Bool finished;
|
||||
XP_Bool searchComplete;
|
||||
XP_S16 turn;
|
||||
const TrayTileSet* tileSet;
|
||||
MoveInfo newMove;
|
||||
|
@ -674,14 +674,14 @@ makeRobotMove( ServerCtxt* server )
|
|||
}
|
||||
|
||||
XP_ASSERT( !!server_getEngineFor( server, turn ) );
|
||||
finished = engine_findMove( server_getEngineFor( server, turn ),
|
||||
model, model_getDictionary( model ),
|
||||
tileSet->tiles, tileSet->nTiles, XP_FALSE,
|
||||
searchComplete = engine_findMove( server_getEngineFor( server, turn ),
|
||||
model, model_getDictionary( model ),
|
||||
tileSet->tiles, tileSet->nTiles, XP_FALSE,
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
NULL, XP_FALSE,
|
||||
NULL, XP_FALSE,
|
||||
#endif
|
||||
targetScore, &canMove, &newMove );
|
||||
if ( finished ) {
|
||||
targetScore, &canMove, &newMove );
|
||||
if ( searchComplete ) {
|
||||
const XP_UCHAR* str;
|
||||
XWStreamCtxt* stream = NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue