hook up prev hint button -- and finally fix infinite loop that

happened when you clicked hint while a hint was being calculated.
This commit is contained in:
Andy2 2010-07-07 06:51:46 -07:00
parent c98451c62a
commit b8c905204e
2 changed files with 15 additions and 4 deletions

View file

@ -726,7 +726,8 @@ public class BoardActivity extends Activity implements UtilCtxt {
new View.OnClickListener() {
@Override
public void onClick( View view ) {
Utils.notImpl( BoardActivity.this );
m_jniThread.handle( JNIThread.JNICmd
.CMD_PREV_HINT );
}
} );
m_toolbar.setListener( Toolbar.BUTTON_HINT_NEXT,

View file

@ -64,6 +64,7 @@ public class JNIThread extends Thread {
CMD_UNDO_LAST,
CMD_HINT,
CMD_ZOOM,
CMD_PREV_HINT,
CMD_NEXT_HINT,
CMD_VALUES,
CMD_COUNTS_VALUES,
@ -397,11 +398,20 @@ public class JNIThread extends Thread {
case CMD_HINT:
XwJNI.board_resetEngine( m_jniGamePtr );
// fallthru
handle( JNICmd.CMD_NEXT_HINT );
break;
case CMD_NEXT_HINT:
draw = XwJNI.board_requestHint( m_jniGamePtr, false, barr );
case CMD_PREV_HINT:
if ( nextSame( elem.m_cmd ) ) {
continue;
}
draw = XwJNI.board_requestHint( m_jniGamePtr, false,
JNICmd.CMD_PREV_HINT==elem.m_cmd,
barr );
if ( barr[0] ) {
handle( JNICmd.CMD_NEXT_HINT );
handle( elem.m_cmd );
draw = false;
}
break;