mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-26 09:58:20 +01:00
add util_informMove to jni. Use it, but not to advantage yet.
This commit is contained in:
parent
77b9fa11a5
commit
35e4c21f17
4 changed files with 30 additions and 5 deletions
|
@ -215,6 +215,19 @@ and_util_turnChanged(XW_UtilCtxt* uc)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
and_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl,
|
||||
XWStreamCtxt* words, XP_U16 wordCount )
|
||||
{
|
||||
UTIL_CBK_HEADER( "informMove", "(Ljava/lang/String;Ljava/lang/String;I)V" );
|
||||
jstring jexpl = streamToJString( MPPARM(util->util.mpool) env, expl );
|
||||
jstring jwords = streamToJString( MPPARM(util->util.mpool) env, words );
|
||||
(*env)->CallVoidMethod( env, util->jutil, mid, jexpl, jwords, wordCount );
|
||||
(*env)->DeleteLocalRef( env, jexpl );
|
||||
(*env)->DeleteLocalRef( env, jwords );
|
||||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
||||
static void
|
||||
and_util_notifyGameOver( XW_UtilCtxt* uc )
|
||||
{
|
||||
|
@ -476,6 +489,7 @@ makeUtil( MPFORMAL JNIEnv** envp, jobject jutil, CurGameInfo* gi,
|
|||
#ifdef XWFEATURE_TURNCHANGENOTIFY
|
||||
SET_PROC( turnChanged);
|
||||
#endif
|
||||
SET_PROC(informMove);
|
||||
SET_PROC(notifyGameOver);
|
||||
SET_PROC(hiliteCell);
|
||||
SET_PROC(engineProgressCallback);
|
||||
|
|
|
@ -1128,12 +1128,10 @@ public class BoardActivity extends XWActivity
|
|||
// if the player after this one is also a robot and we
|
||||
// don't block then a second dialog will replace this one.
|
||||
// So block. Yuck.
|
||||
case UtilCtxt.QUERY_ROBOT_MOVE:
|
||||
case UtilCtxt.QUERY_ROBOT_TRADE:
|
||||
m_dlgBytes = query;
|
||||
m_dlgTitle = R.string.info_title;
|
||||
waitBlockingDialog( QUERY_ROBOT_MOVE == id ?
|
||||
DLG_SCORES_BLK : QUERY_INFORM_BLK, 0 );
|
||||
waitBlockingDialog( QUERY_INFORM_BLK, 0 );
|
||||
result = true;
|
||||
break;
|
||||
|
||||
|
@ -1211,6 +1209,13 @@ public class BoardActivity extends XWActivity
|
|||
}
|
||||
} // userError
|
||||
|
||||
public void informMove( String expl, String words, int wordCount )
|
||||
{
|
||||
m_dlgBytes = expl;
|
||||
m_dlgTitle = R.string.info_title;
|
||||
waitBlockingDialog( DLG_SCORES_BLK, 0 );
|
||||
}
|
||||
|
||||
public void notifyGameOver()
|
||||
{
|
||||
m_jniThread.handle( JNIThread.JNICmd.CMD_POST_OVER );
|
||||
|
|
|
@ -76,8 +76,7 @@ public interface UtilCtxt {
|
|||
|
||||
static final int QUERY_COMMIT_TURN = 0;
|
||||
static final int QUERY_COMMIT_TRADE = 1;
|
||||
static final int QUERY_ROBOT_MOVE = 2;
|
||||
static final int QUERY_ROBOT_TRADE = 3;
|
||||
static final int QUERY_ROBOT_TRADE = 2;
|
||||
boolean userQuery( int id, String query );
|
||||
|
||||
|
||||
|
@ -101,6 +100,8 @@ public interface UtilCtxt {
|
|||
static final int ERR_RELAY_BASE = 16;
|
||||
void userError( int id );
|
||||
|
||||
void informMove( String expl, String words, int wordCount );
|
||||
|
||||
void notifyGameOver();
|
||||
// Don't need this unless we have a scroll thumb to indicate position
|
||||
//void yOffsetChange( int maxOffset, int oldOffset, int newOffset );
|
||||
|
|
|
@ -185,6 +185,11 @@ public class UtilCtxtImpl implements UtilCtxt {
|
|||
subclassOverride( "userError" );
|
||||
}
|
||||
|
||||
public void informMove( String expl, String words, int wordCount )
|
||||
{
|
||||
subclassOverride( "informMove" );
|
||||
}
|
||||
|
||||
// Probably want to cache the fact that the game over notification
|
||||
// showed up and then display it next time game's opened.
|
||||
public void notifyGameOver()
|
||||
|
|
Loading…
Reference in a new issue