pass and display the blocked word

This commit is contained in:
Eric House 2020-04-19 22:27:14 -07:00
parent 0a80ac6e70
commit 10f509ea1f
8 changed files with 25 additions and 20 deletions

View file

@ -1862,13 +1862,13 @@ public class BoardDelegate extends DelegateBase
}
@Override
public void informWordBlocked()
public void informWordBlocked( final String word )
{
runOnUiThread( new Runnable() {
@Override
public void run() {
makeOkOnlyBuilder( "Word blocked" )
.show();
String msg = String.format( "Word \"%s\" blocked", word );
makeOkOnlyBuilder( msg ).show();
}
} );
}

View file

@ -62,7 +62,7 @@ public interface UtilCtxt {
void remSelected();
void timerSelected( boolean inDuplicateMode, boolean canPause );
void setIsServer( boolean isServer );
void informWordBlocked();
void informWordBlocked( String word );
void bonusSquareHeld( int bonus );
void playerScoreHeld( int player );

View file

@ -107,7 +107,7 @@ public class UtilCtxtImpl implements UtilCtxt {
}
@Override
public void informWordBlocked()
public void informWordBlocked( String word )
{
subclassOverride( "informWordBlocked" );
}

View file

@ -707,10 +707,12 @@ and_util_setIsServer( XW_UtilCtxt* uc, XP_Bool isServer )
}
static void
and_util_informWordBlocked( XW_UtilCtxt* uc )
and_util_informWordBlocked( XW_UtilCtxt* uc, const XP_UCHAR* word )
{
UTIL_CBK_HEADER( "informWordBlocked", "()V" );
(*env)->CallVoidMethod( env, util->jutil, mid );
UTIL_CBK_HEADER( "informWordBlocked", "(Ljava/lang/String;)V" );
jstring jword = (*env)->NewStringUTF( env, word );
(*env)->CallVoidMethod( env, util->jutil, mid, jword );
deleteLocalRef( env, jword );
UTIL_CBK_TAIL();
}

View file

@ -219,7 +219,7 @@ model_figureFinalScores( ModelCtxt* model, ScoresArray* finalScoresP,
typedef struct _BlockCheckState {
WordNotifierInfo* chainNI;
XP_Bool allLegal;
XP_UCHAR word[32];
} BlockCheckState;
static void
@ -230,8 +230,8 @@ blockCheck( const WNParams* wnp, void* closure )
if ( !!bcs->chainNI ) {
(bcs->chainNI->proc)( wnp, bcs->chainNI->closure );
}
if ( !wnp->isLegal ) {
bcs->allLegal = XP_FALSE;
if ( !wnp->isLegal && '\0' == bcs->word[0] ) {
XP_STRCAT( bcs->word, wnp->word );
}
}
@ -271,7 +271,7 @@ checkScoreMove( ModelCtxt* model, XP_S16 turn, EngineCtxt* engine,
WordNotifierInfo blockWNI;
BlockCheckState bcs;
if ( checkDict ) {
bcs.allLegal = XP_TRUE;
XP_MEMSET( &bcs, 0, sizeof(bcs) );
bcs.chainNI = notifyInfo;
blockWNI.proc = blockCheck;
blockWNI.closure = &bcs;
@ -280,9 +280,9 @@ checkScoreMove( ModelCtxt* model, XP_S16 turn, EngineCtxt* engine,
XP_S16 tmpScore = figureMoveScore( model, turn, &moveInfo,
engine, stream, notifyInfo );
if ( checkDict && !bcs.allLegal ) {
if ( checkDict && '\0' != bcs.word[0] ) {
if ( !silent ) {
util_informWordBlocked( model->vol.util );
util_informWordBlocked( model->vol.util, bcs.word );
}
} else {
score = tmpScore;

View file

@ -173,7 +173,7 @@ typedef struct UtilVtable {
void (*m_util_setIsServer)(XW_UtilCtxt* uc, XP_Bool isServer );
#endif
void (*m_util_informWordBlocked)( XW_UtilCtxt* uc );
void (*m_util_informWordBlocked)( XW_UtilCtxt* uc, const XP_UCHAR* word );
#ifdef XWFEATURE_SEARCHLIMIT
XP_Bool (*m_util_getTraySearchLimits)(XW_UtilCtxt* uc,
@ -310,7 +310,7 @@ struct XW_UtilCtxt {
# define util_addrChange( uc, addro, addrn )
#endif
#define util_informWordBlocked(uc) (uc)->vtable->m_util_informWordBlocked( uc )
#define util_informWordBlocked(uc, w) (uc)->vtable->m_util_informWordBlocked( (uc), (w) )
#ifdef XWFEATURE_SEARCHLIMIT
#define util_getTraySearchLimits(uc,min,max) \

View file

@ -1050,9 +1050,10 @@ curses_util_cellSquareHeld( XW_UtilCtxt* uc, XWStreamCtxt* words )
#endif
static void
curses_util_informWordBlocked( XW_UtilCtxt* XP_UNUSED(uc) )
curses_util_informWordBlocked( XW_UtilCtxt* XP_UNUSED(uc),
const XP_UCHAR* XP_UNUSED_DBG(word) )
{
LOG_FUNC();
XP_LOGFF( "(word=%s)", word );
}
#ifndef XWFEATURE_STANDALONE_ONLY

View file

@ -1998,10 +1998,12 @@ gtk_util_cellSquareHeld( XW_UtilCtxt* uc, XWStreamCtxt* words )
#endif
static void
gtk_util_informWordBlocked( XW_UtilCtxt* uc )
gtk_util_informWordBlocked( XW_UtilCtxt* uc, const XP_UCHAR* word )
{
GtkGameGlobals* globals = (GtkGameGlobals*)uc->closure;
gtkUserError( globals, "Word blocked by phonies setting" );
gchar* msg = g_strdup_printf( "Word \"%s\" blocked by phonies setting", word );
gtkUserError( globals, msg );
g_free( msg );
}
static void