add turn as param to util_turnChanged, and call from server rather

than board.
This commit is contained in:
Eric House 2012-09-27 07:04:57 -07:00
parent 94103a4212
commit 2c89f13383
8 changed files with 23 additions and 22 deletions

View file

@ -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);

View file

@ -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

View file

@ -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;
}

View file

@ -40,7 +40,7 @@ public interface UtilCtxt {
String[] curTiles, int nPicked );
String askPassword( String name );
void turnChanged();
void turnChanged( int newTurn );
boolean engineProgressCallback();

View file

@ -62,7 +62,7 @@ public class UtilCtxtImpl implements UtilCtxt {
return null;
}
public void turnChanged()
public void turnChanged( int newTurn )
{
subclassOverride( "turnChanged" );
}

View file

@ -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

View file

@ -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;

View file

@ -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) \