From 9f250c99ef62e6cc4f7a21486b98d111df6ceb86 Mon Sep 17 00:00:00 2001 From: eehouse Date: Sun, 31 Jan 2010 21:35:07 +0000 Subject: [PATCH] get rid of gameID param. This change breaks all other platforms... --- xwords4/android/XWords4/jni/xwjni.c | 7 +++---- .../src/org/eehouse/android/xw4/BoardActivity.java | 2 +- .../src/org/eehouse/android/xw4/jni/XwJNI.java | 3 +-- xwords4/common/game.c | 11 +++++++---- xwords4/common/game.h | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/xwords4/android/XWords4/jni/xwjni.c b/xwords4/android/XWords4/jni/xwjni.c index 683dd39c0..4631cb881 100644 --- a/xwords4/android/XWords4/jni/xwjni.c +++ b/xwords4/android/XWords4/jni/xwjni.c @@ -260,8 +260,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_initJNI JNIEXPORT void JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame ( JNIEnv* env, jclass C, jint gamePtr, jobject j_gi, jobject j_util, - jobject j_draw, jint gameID, jobject j_cp, jobject j_procs, - jbyteArray jDictBytes ) + jobject j_draw, jobject j_cp, jobject j_procs, jbyteArray jDictBytes ) { XWJNI_START(); CurGameInfo* gi = makeGI( MPPARM(mpool) env, j_gi ); @@ -276,8 +275,8 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame loadCommonPrefs( env, &cp, j_cp ); XP_LOGF( "calling game_makeNewGame" ); - game_makeNewGame( MPPARM(mpool) &state->game, gi, util, dctx, gameID, - &cp, globals->xportProcs ); + game_makeNewGame( MPPARM(mpool) &state->game, gi, util, dctx, &cp, + globals->xportProcs ); DictionaryCtxt* dict = makeDict( MPPARM(mpool) env, util, jDictBytes ); #ifdef STUBBED_DICT diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java index 6af4c8686..404b1ee54 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardActivity.java @@ -146,7 +146,7 @@ public class BoardActivity extends Activity implements UtilCtxt { m_gi, dictBytes, this, m_view, Utils.getCP(), m_xport ) ) { - XwJNI.game_makeNewGame( m_jniGamePtr, m_gi, this, m_view, 0, + XwJNI.game_makeNewGame( m_jniGamePtr, m_gi, this, m_view, Utils.getCP(), m_xport, dictBytes ); } diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java index 8fd81654f..366169ef1 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/XwJNI.java @@ -28,8 +28,7 @@ public class XwJNI { public static native void game_makeNewGame( int gamePtr, CurGameInfo gi, UtilCtxt util, - DrawCtx draw, int gameID, - CommonPrefs cp, + DrawCtx draw, CommonPrefs cp, TransportProcs procs, byte[] dict ); public static native boolean game_makeFromStream( int gamePtr, diff --git a/xwords4/common/game.c b/xwords4/common/game.c index 2678eb0b6..21ea739c9 100644 --- a/xwords4/common/game.c +++ b/xwords4/common/game.c @@ -73,14 +73,17 @@ checkServerRole( CurGameInfo* gi, XP_U16* nPlayersHere, XP_U16* nPlayersTotal ) void game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi, XW_UtilCtxt* util, DrawCtx* draw, - XP_U16 gameID, CommonPrefs* cp, - const TransportProcs* procs ) + CommonPrefs* cp, const TransportProcs* procs ) { + XP_U16 gameID = 0; XP_U16 nPlayersHere, nPlayersTotal; assertUtilOK( util ); checkServerRole( gi, &nPlayersHere, &nPlayersTotal ); + while ( 0 == gameID ) { + gameID = util_getCurSeconds( util ); + } gi->gameID = gameID; game->model = model_make( MPPARM(mpool) (DictionaryCtxt*)NULL, util, @@ -112,11 +115,11 @@ game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi, void game_reset( MPFORMAL XWGame* game, CurGameInfo* gi, XW_UtilCtxt* XP_UNUSED_STANDALONE(util), - XP_U16 gameID, CommonPrefs* cp, - const TransportProcs* procs ) + CommonPrefs* cp, const TransportProcs* procs ) { XP_U16 i; XP_U16 nPlayersHere, nPlayersTotal; + XP_U16 gameID = 0; XP_ASSERT( !!game->model ); XP_ASSERT( !!gi ); diff --git a/xwords4/common/game.h b/xwords4/common/game.h index 4b848e34d..e62d18c8a 100644 --- a/xwords4/common/game.h +++ b/xwords4/common/game.h @@ -85,10 +85,10 @@ typedef struct XWGame { } XWGame; void game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi, - XW_UtilCtxt* util, DrawCtx* draw, XP_U16 gameID, + XW_UtilCtxt* util, DrawCtx* draw, CommonPrefs* cp, const TransportProcs* procs ); void game_reset( MPFORMAL XWGame* game, CurGameInfo* gi, XW_UtilCtxt* util, - XP_U16 gameID, CommonPrefs* cp, const TransportProcs* procs ); + CommonPrefs* cp, const TransportProcs* procs ); XP_Bool game_makeFromStream( MPFORMAL XWStreamCtxt* stream, XWGame* game, CurGameInfo* gi,