diff --git a/xwords4/android/XWords4/jni/utilwrapper.c b/xwords4/android/XWords4/jni/utilwrapper.c index b7648e863..f6f415a72 100644 --- a/xwords4/android/XWords4/jni/utilwrapper.c +++ b/xwords4/android/XWords4/jni/utilwrapper.c @@ -253,7 +253,7 @@ and_util_altKeyDown( XW_UtilCtxt* uc ) } -static XP_U32 +XP_U32 and_util_getCurSeconds( XW_UtilCtxt* uc ) { struct timeval tv; diff --git a/xwords4/android/XWords4/jni/utilwrapper.h b/xwords4/android/XWords4/jni/utilwrapper.h index f8f20b778..6c9d3cd23 100644 --- a/xwords4/android/XWords4/jni/utilwrapper.h +++ b/xwords4/android/XWords4/jni/utilwrapper.h @@ -33,4 +33,6 @@ void destroyUtil( XW_UtilCtxt** util ); bool utilTimerFired( XW_UtilCtxt* util, XWTimerReason why, int handle ); +XP_U32 and_util_getCurSeconds( XW_UtilCtxt* uc ); /* uc can be NULL */ + #endif diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index e82ba17dd..b07ea36a8 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -165,6 +165,13 @@ Java_org_eehouse_android_xw4_jni_XwJNI_gi_1to_1stream XWStreamCtxt* stream = mem_stream_make( MPPARM(mpool) vtMgr, NULL, 0, NULL ); + /* Unlike on other platforms, gi is created without a call to + game_makeNewGame, which sets gameID. So check here if it's still unset + and if necessary set it. */ + while ( 0 == gi->gameID ) { + gi->gameID = and_util_getCurSeconds( NULL ); + } + game_saveToStream( NULL, gi, stream ); destroyGI( MPPARM(mpool) &gi );