diff --git a/xwords4/android/XWords4/jni/utilwrapper.c b/xwords4/android/XWords4/jni/utilwrapper.c index 461bc28a4..081d67c19 100644 --- a/xwords4/android/XWords4/jni/utilwrapper.c +++ b/xwords4/android/XWords4/jni/utilwrapper.c @@ -235,10 +235,10 @@ and_util_yOffsetChange(XW_UtilCtxt* uc, XP_U16 maxOffset, #ifdef XWFEATURE_TURNCHANGENOTIFY static void -and_util_turnChanged(XW_UtilCtxt* uc) +and_util_turnChanged( XW_UtilCtxt* uc, XP_S16 turn ) { - UTIL_CBK_HEADER( "turnChanged", "()V" ); - (*env)->CallVoidMethod( env, util->jutil, mid ); + UTIL_CBK_HEADER( "turnChanged", "(I)V" ); + (*env)->CallVoidMethod( env, util->jutil, mid, turn ); UTIL_CBK_TAIL(); } #endif @@ -598,7 +598,7 @@ makeUtil( MPFORMAL JNIEnv** envp, jobject jutil, CurGameInfo* gi, SET_PROC(trayHiddenChange); SET_PROC(yOffsetChange); #ifdef XWFEATURE_TURNCHANGENOTIFY - SET_PROC( turnChanged); + SET_PROC(turnChanged); #endif SET_PROC(informMove); SET_PROC(informUndo); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index a4e26134b..36671ff0e 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -1306,15 +1306,18 @@ public class BoardActivity extends XWActivity } @Override - public void turnChanged() + public void turnChanged( int newTurn ) { - post( new Runnable() { - public void run() { - showNotAgainDlgThen( R.string.not_again_turnchanged, - R.string.key_notagain_turnchanged ); - } - } ); - m_jniThread.handle( JNIThread.JNICmd. CMD_ZOOM, -8 ); + DbgUtils.logf( "turnChanged(%d)", newTurn ); + if ( 0 <= newTurn ) { + post( new Runnable() { + public void run() { + showNotAgainDlgThen( R.string.not_again_turnchanged, + R.string.key_notagain_turnchanged ); + } + } ); + m_jniThread.handle( JNIThread.JNICmd. CMD_ZOOM, -8 ); + } } @Override diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java index 15866b626..d5d66b54a 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/GameUtils.java @@ -680,7 +680,7 @@ public class GameUtils { DBUtils.appendChatHistory( m_context, m_rowid, msg, false ); m_gotChat = true; } - public void turnChanged() + public void turnChanged( int newTurn ) { m_gotMsg = true; } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java index 8926a3a1e..8e975a334 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxt.java @@ -40,7 +40,7 @@ public interface UtilCtxt { String[] curTiles, int nPicked ); String askPassword( String name ); - void turnChanged(); + void turnChanged( int newTurn ); boolean engineProgressCallback(); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java index a070d552e..ddbed884c 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/UtilCtxtImpl.java @@ -62,7 +62,7 @@ public class UtilCtxtImpl implements UtilCtxt { return null; } - public void turnChanged() + public void turnChanged( int newTurn ) { subclassOverride( "turnChanged" ); } diff --git a/xwords4/common/board.c b/xwords4/common/board.c index 2e29f4317..4a2efecb3 100644 --- a/xwords4/common/board.c +++ b/xwords4/common/board.c @@ -165,7 +165,6 @@ board_make( MPFORMAL ModelCtxt* model, ServerCtxt* server, DrawCtx* draw, result->star_row = (XP_U16)(model_numRows(model) / 2); - /* could just pass in invalCell.... PENDING(eeh) */ model_setBoardListener( model, boardCellChanged, result ); model_setTrayListener( model, boardTilesChanged, result ); model_setDictListener( model, dictChanged, result ); @@ -3465,8 +3464,6 @@ boardTurnChanged( void* p_board ) setTimerIf( board ); board->scoreBoardInvalid = XP_TRUE; - - util_turnChanged( board->util ); } /* boardTurnChanged */ static void diff --git a/xwords4/common/server.c b/xwords4/common/server.c index 1085ebc5e..2e1a66bbe 100644 --- a/xwords4/common/server.c +++ b/xwords4/common/server.c @@ -1858,6 +1858,7 @@ nextTurn( ServerCtxt* server, XP_S16 nxtTurn ) XP_ASSERT( server->nv.gameState != XWSTATE_GAMEOVER ); callTurnChangeListener( server ); + util_turnChanged( server->vol.util, server->nv.currentTurn ); if ( robotMovePending(server) && !POSTPONEROBOTMOVE(server) ) { moreToDo = XP_TRUE; diff --git a/xwords4/common/util.h b/xwords4/common/util.h index 20f80c506..8bea2b878 100644 --- a/xwords4/common/util.h +++ b/xwords4/common/util.h @@ -125,7 +125,7 @@ typedef struct UtilVtable { void (*m_util_yOffsetChange)(XW_UtilCtxt* uc, XP_U16 maxOffset, XP_U16 oldOffset, XP_U16 newOffset ); #ifdef XWFEATURE_TURNCHANGENOTIFY - void (*m_util_turnChanged)(XW_UtilCtxt* uc); + void (*m_util_turnChanged)(XW_UtilCtxt* uc, XP_S16 newTurn); #endif void (*m_util_informMove)( XW_UtilCtxt* uc, XWStreamCtxt* expl, XWStreamCtxt* words ); @@ -240,10 +240,10 @@ struct XW_UtilCtxt { (uc)->vtable->m_util_yOffsetChange((uc), (m), (o), (n) ) #ifdef XWFEATURE_TURNCHANGENOTIFY -# define util_turnChanged( uc ) \ - (uc)->vtable->m_util_turnChanged((uc) ) +# define util_turnChanged( uc, t ) \ + (uc)->vtable->m_util_turnChanged( (uc), (t) ) #else -# define util_turnChanged( uc ) +# define util_turnChanged( uc, t ) #endif #define util_informMove(uc,e,w) \