mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
don't claim "no move" when search interrupted
I *think* the reason I'm occasionally seeing toasts about not finding a move is that when the engine's interrupted by there being a UI event in the queue that error is posted. Instead try posting only when at the end of the search nothing's been found.
This commit is contained in:
parent
6de1305c8e
commit
4f7a12f5a1
3 changed files with 13 additions and 9 deletions
|
@ -266,15 +266,19 @@ public class JNIThread extends Thread {
|
|||
}
|
||||
|
||||
public boolean busy()
|
||||
{ // synchronize this!!!
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
// Docs: The returned iterator is a "weakly consistent" iterator that
|
||||
// will never throw ConcurrentModificationException, and guarantees to
|
||||
// traverse elements as they existed upon construction of the
|
||||
// iterator, and may (but is not guaranteed to) reflect any
|
||||
// modifications subsequent to construction.
|
||||
Iterator<QueueElem> iter = m_queue.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
if ( iter.next().m_isUIEvent ) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
while ( iter.hasNext() && !result ) {
|
||||
result = iter.next().m_isUIEvent;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -2128,13 +2128,13 @@ board_requestHint( BoardCtxt* board,
|
|||
result = nTiles > 0;
|
||||
}
|
||||
|
||||
XP_Bool canMove = XP_FALSE;
|
||||
if ( result ) {
|
||||
#ifdef XWFEATURE_SEARCHLIMIT
|
||||
BdHintLimits limits;
|
||||
BdHintLimits* lp = NULL;
|
||||
#endif
|
||||
XP_Bool wasVisible;
|
||||
XP_Bool canMove;
|
||||
|
||||
wasVisible = setArrowVisible( board, XP_FALSE );
|
||||
|
||||
|
@ -2196,7 +2196,7 @@ board_requestHint( BoardCtxt* board,
|
|||
}
|
||||
}
|
||||
|
||||
if ( !result ) {
|
||||
if ( !canMove ) {
|
||||
util_userError( board->util, ERR_NO_HINT_FOUND );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -528,7 +528,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
|||
newMove->nTiles = 0;
|
||||
canMove = XP_FALSE;
|
||||
}
|
||||
result = XP_TRUE;
|
||||
XP_ASSERT( result );
|
||||
}
|
||||
|
||||
util_engineStopping( engine->util );
|
||||
|
|
Loading…
Reference in a new issue