set gameID when saving CurGameInfo from java IFF it isn't already set.

This commit is contained in:
eehouse 2010-02-14 22:01:06 +00:00
parent 84ebc38882
commit 919c7be9d6
3 changed files with 10 additions and 1 deletions

View file

@ -253,7 +253,7 @@ and_util_altKeyDown( XW_UtilCtxt* uc )
}
static XP_U32
XP_U32
and_util_getCurSeconds( XW_UtilCtxt* uc )
{
struct timeval tv;

View file

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

View file

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