mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +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()
|
public boolean busy()
|
||||||
{ // synchronize this!!!
|
{
|
||||||
boolean result = false;
|
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();
|
Iterator<QueueElem> iter = m_queue.iterator();
|
||||||
while ( iter.hasNext() ) {
|
while ( iter.hasNext() && !result ) {
|
||||||
if ( iter.next().m_isUIEvent ) {
|
result = iter.next().m_isUIEvent;
|
||||||
result = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2128,13 +2128,13 @@ board_requestHint( BoardCtxt* board,
|
||||||
result = nTiles > 0;
|
result = nTiles > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XP_Bool canMove = XP_FALSE;
|
||||||
if ( result ) {
|
if ( result ) {
|
||||||
#ifdef XWFEATURE_SEARCHLIMIT
|
#ifdef XWFEATURE_SEARCHLIMIT
|
||||||
BdHintLimits limits;
|
BdHintLimits limits;
|
||||||
BdHintLimits* lp = NULL;
|
BdHintLimits* lp = NULL;
|
||||||
#endif
|
#endif
|
||||||
XP_Bool wasVisible;
|
XP_Bool wasVisible;
|
||||||
XP_Bool canMove;
|
|
||||||
|
|
||||||
wasVisible = setArrowVisible( board, XP_FALSE );
|
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 );
|
util_userError( board->util, ERR_NO_HINT_FOUND );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -528,7 +528,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
newMove->nTiles = 0;
|
newMove->nTiles = 0;
|
||||||
canMove = XP_FALSE;
|
canMove = XP_FALSE;
|
||||||
}
|
}
|
||||||
result = XP_TRUE;
|
XP_ASSERT( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
util_engineStopping( engine->util );
|
util_engineStopping( engine->util );
|
||||||
|
|
Loading…
Add table
Reference in a new issue