mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
add util_informUndo() that gets called, and puts up a dialog, after
remote device has performed an undo on a committed turn.
This commit is contained in:
parent
61453b8720
commit
3a54aa0ebc
9 changed files with 44 additions and 2 deletions
|
@ -260,6 +260,14 @@ and_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl, XWStreamCtxt* words )
|
|||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
||||
static void
|
||||
and_util_informUndo( XW_UtilCtxt* uc )
|
||||
{
|
||||
UTIL_CBK_HEADER( "informUndo", "()V" );
|
||||
(*env)->CallVoidMethod( env, util->jutil, mid );
|
||||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
||||
static void
|
||||
and_util_notifyGameOver( XW_UtilCtxt* uc )
|
||||
{
|
||||
|
@ -268,7 +276,6 @@ and_util_notifyGameOver( XW_UtilCtxt* uc )
|
|||
UTIL_CBK_TAIL();
|
||||
}
|
||||
|
||||
|
||||
static XP_Bool
|
||||
and_util_hiliteCell( XW_UtilCtxt* uc, XP_U16 col, XP_U16 row )
|
||||
{
|
||||
|
@ -567,6 +574,7 @@ makeUtil( MPFORMAL JNIEnv** envp, jobject jutil, CurGameInfo* gi,
|
|||
SET_PROC( turnChanged);
|
||||
#endif
|
||||
SET_PROC(informMove);
|
||||
SET_PROC(informUndo);
|
||||
SET_PROC(notifyGameOver);
|
||||
SET_PROC(hiliteCell);
|
||||
SET_PROC(engineProgressCallback);
|
||||
|
|
|
@ -1927,4 +1927,6 @@
|
|||
<string name="summary_conn_sms">Game in play with %s</string>
|
||||
<string name="warn_unlimited">Are you certain this number is on an
|
||||
account with unlimited texting? Click cancel if you are not.</string>
|
||||
|
||||
<string name="remote_undone">Remote device undid a turn.</string>
|
||||
</resources>
|
||||
|
|
|
@ -1394,6 +1394,12 @@ public class BoardActivity extends XWActivity
|
|||
waitBlockingDialog( DLG_SCORES_BLK, 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void informUndo()
|
||||
{
|
||||
nonBlockingDialog( DLG_OKONLY, getString( R.string.remote_undone ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyGameOver()
|
||||
{
|
||||
|
|
|
@ -107,6 +107,7 @@ public interface UtilCtxt {
|
|||
void userError( int id );
|
||||
|
||||
void informMove( String expl, String words );
|
||||
void informUndo();
|
||||
|
||||
void informMissing( boolean isServer, CommsAddrRec.CommsConnType connType,
|
||||
int nMissingPlayers );
|
||||
|
|
|
@ -207,6 +207,11 @@ public class UtilCtxtImpl implements UtilCtxt {
|
|||
subclassOverride( "informMove" );
|
||||
}
|
||||
|
||||
public void informUndo()
|
||||
{
|
||||
subclassOverride( "informUndo" );
|
||||
}
|
||||
|
||||
public void informMissing( boolean isServer,
|
||||
CommsAddrRec.CommsConnType connType,
|
||||
int nMissingPlayers )
|
||||
|
|
|
@ -2529,8 +2529,9 @@ reflectUndos( ServerCtxt* server, XWStreamCtxt* stream, XW_Proto code )
|
|||
|
||||
sendUndoToClientsExcept( server, sourceClientIndex, nUndone,
|
||||
lastUndone );
|
||||
|
||||
}
|
||||
|
||||
util_informUndo( server->vol.util );
|
||||
nextTurn( server, turn );
|
||||
}
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ typedef struct UtilVtable {
|
|||
#endif
|
||||
void (*m_util_informMove)( XW_UtilCtxt* uc, XWStreamCtxt* expl,
|
||||
XWStreamCtxt* words );
|
||||
void (*m_util_informUndo)( XW_UtilCtxt* uc );
|
||||
void (*m_util_notifyGameOver)( XW_UtilCtxt* uc );
|
||||
|
||||
XP_Bool (*m_util_hiliteCell)( XW_UtilCtxt* uc, XP_U16 col, XP_U16 row );
|
||||
|
@ -241,6 +242,8 @@ struct XW_UtilCtxt {
|
|||
|
||||
#define util_informMove(uc,e,w) \
|
||||
(uc)->vtable->m_util_informMove( (uc),(e),(w))
|
||||
#define util_informUndo(uc) \
|
||||
(uc)->vtable->m_util_informUndo( (uc))
|
||||
#define util_notifyGameOver( uc ) \
|
||||
(uc)->vtable->m_util_notifyGameOver((uc))
|
||||
|
||||
|
|
|
@ -364,6 +364,12 @@ curses_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl,
|
|||
free( question );
|
||||
}
|
||||
|
||||
static void
|
||||
curses_util_informUndo( XW_UtilCtxt* XP_UNUSED(uc))
|
||||
{
|
||||
LOG_FUNC();
|
||||
}
|
||||
|
||||
static void
|
||||
curses_util_notifyGameOver( XW_UtilCtxt* uc )
|
||||
{
|
||||
|
@ -1508,6 +1514,7 @@ setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util )
|
|||
util->vtable->m_util_userPickTileTray = curses_util_userPickTileTray;
|
||||
util->vtable->m_util_trayHiddenChange = curses_util_trayHiddenChange;
|
||||
util->vtable->m_util_informMove = curses_util_informMove;
|
||||
util->vtable->m_util_informUndo = curses_util_informUndo;
|
||||
util->vtable->m_util_notifyGameOver = curses_util_notifyGameOver;
|
||||
util->vtable->m_util_hiliteCell = curses_util_hiliteCell;
|
||||
util->vtable->m_util_engineProgressCallback =
|
||||
|
|
|
@ -1432,6 +1432,14 @@ gtk_util_informMove( XW_UtilCtxt* uc, XWStreamCtxt* expl,
|
|||
free( question );
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_util_informUndo( XW_UtilCtxt* uc )
|
||||
{
|
||||
GtkAppGlobals* globals = (GtkAppGlobals*)uc->closure;
|
||||
(void)gtkask_timeout( globals->window, "Remote player undid a move",
|
||||
GTK_BUTTONS_OK, 500 );
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_util_notifyGameOver( XW_UtilCtxt* uc )
|
||||
{
|
||||
|
@ -1978,6 +1986,7 @@ setupGtkUtilCallbacks( GtkAppGlobals* globals, XW_UtilCtxt* util )
|
|||
util->vtable->m_util_trayHiddenChange = gtk_util_trayHiddenChange;
|
||||
util->vtable->m_util_yOffsetChange = gtk_util_yOffsetChange;
|
||||
util->vtable->m_util_informMove = gtk_util_informMove;
|
||||
util->vtable->m_util_informUndo = gtk_util_informUndo;
|
||||
util->vtable->m_util_notifyGameOver = gtk_util_notifyGameOver;
|
||||
util->vtable->m_util_hiliteCell = gtk_util_hiliteCell;
|
||||
util->vtable->m_util_altKeyDown = gtk_util_altKeyDown;
|
||||
|
|
Loading…
Add table
Reference in a new issue