From fd9b9f85e22f1f21f274fc7b9b10886198b18e5f Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 5 Oct 2012 18:51:32 -0700 Subject: [PATCH] make util_hiliteCell conditional, and remove from android where it wasn't used anyway. --- xwords4/android/XWords4/jni/utilwrapper.c | 5 ++++- xwords4/common/engine.c | 4 ++++ xwords4/common/util.h | 7 +++++-- xwords4/linux/Makefile | 1 + xwords4/linux/cursesmain.c | 4 ++++ xwords4/linux/gtkmain.c | 4 ++++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/xwords4/android/XWords4/jni/utilwrapper.c b/xwords4/android/XWords4/jni/utilwrapper.c index a5f18f295..927b73228 100644 --- a/xwords4/android/XWords4/jni/utilwrapper.c +++ b/xwords4/android/XWords4/jni/utilwrapper.c @@ -291,13 +291,14 @@ and_util_notifyGameOver( XW_UtilCtxt* uc ) UTIL_CBK_TAIL(); } +#ifdef XWFEATURE_HILITECELL static XP_Bool and_util_hiliteCell( XW_UtilCtxt* uc, XP_U16 col, XP_U16 row ) { /* don't log; this is getting called a lot */ return XP_TRUE; /* means keep going */ } - +#endif static XP_Bool and_util_engineProgressCallback( XW_UtilCtxt* uc ) @@ -607,7 +608,9 @@ makeUtil( MPFORMAL JNIEnv** envp, jobject jutil, CurGameInfo* gi, SET_PROC(informUndo); SET_PROC(informNetDict); SET_PROC(notifyGameOver); +#ifdef XWFEATURE_HILITECELL SET_PROC(hiliteCell); +#endif SET_PROC(engineProgressCallback); SET_PROC(setTimer); SET_PROC(clearTimer); diff --git a/xwords4/common/engine.c b/xwords4/common/engine.c index ea6c95b5b..ecb7c5830 100644 --- a/xwords4/common/engine.c +++ b/xwords4/common/engine.c @@ -794,6 +794,7 @@ isAnchorSquare( EngineCtxt* engine, XP_U16 col, XP_U16 row ) return XP_FALSE; } /* isAnchorSquare */ +#ifdef XWFEATURE_HILITECELL static void hiliteForAnchor( EngineCtxt* engine, XP_U16 col, XP_U16 row ) { @@ -807,6 +808,9 @@ hiliteForAnchor( EngineCtxt* engine, XP_U16 col, XP_U16 row ) engine->returnNOW = XP_TRUE; } } /* hiliteForAnchor */ +#else +# define hiliteForAnchor( engine, col, row ) +#endif static void findMovesForAnchor( EngineCtxt* engine, XP_S16* prevAnchor, diff --git a/xwords4/common/util.h b/xwords4/common/util.h index 8bea2b878..8e4dd50b6 100644 --- a/xwords4/common/util.h +++ b/xwords4/common/util.h @@ -136,8 +136,9 @@ typedef struct UtilVtable { XWPhoniesChoice phoniesAction ); void (*m_util_notifyGameOver)( XW_UtilCtxt* uc ); - +#ifdef XWFEATURE_HILITECELL XP_Bool (*m_util_hiliteCell)( XW_UtilCtxt* uc, XP_U16 col, XP_U16 row ); +#endif XP_Bool (*m_util_engineProgressCallback)( XW_UtilCtxt* uc ); @@ -255,8 +256,10 @@ struct XW_UtilCtxt { #define util_notifyGameOver( uc ) \ (uc)->vtable->m_util_notifyGameOver((uc)) -#define util_hiliteCell( uc, c, r ) \ +#ifdef XWFEATURE_HILITECELL +# define util_hiliteCell( uc, c, r ) \ (uc)->vtable->m_util_hiliteCell((uc), (c), (r)) +#endif #define util_engineProgressCallback( uc ) \ (uc)->vtable->m_util_engineProgressCallback((uc)) diff --git a/xwords4/linux/Makefile b/xwords4/linux/Makefile index 0fc0e6578..aaf659e74 100644 --- a/xwords4/linux/Makefile +++ b/xwords4/linux/Makefile @@ -104,6 +104,7 @@ DEFINES += -DHASH_STREAM DEFINES += -DXWFEATURE_TRAYUNDO_ONE DEFINES += -DXWFEATURE_BONUSALL # DEFINES += -DXWFEATURE_BONUSALLHINT +DEFINES += -DXWFEATURE_HILITECELL # MAX_ROWS controls STREAM_VERS_BIGBOARD and with it move hashing DEFINES += -DMAX_ROWS=32 diff --git a/xwords4/linux/cursesmain.c b/xwords4/linux/cursesmain.c index d3d27f691..f2406e9b6 100644 --- a/xwords4/linux/cursesmain.c +++ b/xwords4/linux/cursesmain.c @@ -404,6 +404,7 @@ curses_util_informNetDict( XW_UtilCtxt* uc, const XP_UCHAR* oldName, XP_LOGF( "%s: %s => %s (cksum: %s)", __func__, oldName, newName, newSum ); } +#ifdef XWFEATURE_HILITECELL static XP_Bool curses_util_hiliteCell( XW_UtilCtxt* uc, XP_U16 XP_UNUSED(col), XP_U16 XP_UNUSED(row) ) @@ -414,6 +415,7 @@ curses_util_hiliteCell( XW_UtilCtxt* uc, } return XP_TRUE; } /* curses_util_hiliteCell */ +#endif static XP_Bool curses_util_engineProgressCallback( XW_UtilCtxt* XP_UNUSED(uc) ) @@ -1527,7 +1529,9 @@ setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util ) util->vtable->m_util_informUndo = curses_util_informUndo; util->vtable->m_util_notifyGameOver = curses_util_notifyGameOver; util->vtable->m_util_informNetDict = curses_util_informNetDict; +#ifdef XWFEATURE_HILITECELL util->vtable->m_util_hiliteCell = curses_util_hiliteCell; +#endif util->vtable->m_util_engineProgressCallback = curses_util_engineProgressCallback; diff --git a/xwords4/linux/gtkmain.c b/xwords4/linux/gtkmain.c index 9dd3eef83..097bb9c88 100644 --- a/xwords4/linux/gtkmain.c +++ b/xwords4/linux/gtkmain.c @@ -1479,6 +1479,7 @@ gtk_util_informNetDict( XW_UtilCtxt* uc, const XP_UCHAR* oldName, /* define this to prevent user events during debugging from stopping the engine */ /* #define DONT_ABORT_ENGINE */ +#ifdef XWFEATURE_HILITECELL static XP_Bool gtk_util_hiliteCell( XW_UtilCtxt* uc, XP_U16 col, XP_U16 row ) { @@ -1502,6 +1503,7 @@ gtk_util_hiliteCell( XW_UtilCtxt* uc, XP_U16 col, XP_U16 row ) return !pending; #endif } /* gtk_util_hiliteCell */ +#endif static XP_Bool gtk_util_altKeyDown( XW_UtilCtxt* uc ) @@ -2002,7 +2004,9 @@ setupGtkUtilCallbacks( GtkAppGlobals* globals, XW_UtilCtxt* util ) util->vtable->m_util_informUndo = gtk_util_informUndo; util->vtable->m_util_notifyGameOver = gtk_util_notifyGameOver; util->vtable->m_util_informNetDict = gtk_util_informNetDict; +#ifdef XWFEATURE_HILITECELL util->vtable->m_util_hiliteCell = gtk_util_hiliteCell; +#endif util->vtable->m_util_altKeyDown = gtk_util_altKeyDown; util->vtable->m_util_engineProgressCallback = gtk_util_engineProgressCallback;