mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
cleanup: remove dead and use new code
This commit is contained in:
parent
f13e81a4b5
commit
d74161958e
4 changed files with 19 additions and 37 deletions
|
@ -2245,29 +2245,22 @@ JNIEXPORT void JNICALL
|
||||||
Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
|
Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
|
||||||
( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jsummary )
|
( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jsummary )
|
||||||
{
|
{
|
||||||
XWJNI_START();
|
XWJNI_START_GLOBALS();
|
||||||
ModelCtxt* model = state->game.model;
|
GameSummary summary = {0};
|
||||||
ServerCtxt* server = state->game.server;
|
game_summarize( &state->game, globals->gi, &summary );
|
||||||
XP_S16 nMoves = model_getNMoves( model );
|
|
||||||
setInt( env, jsummary, "nMoves", nMoves );
|
setInt( env, jsummary, "nMoves", summary.nMoves );
|
||||||
XP_Bool gameOver = server_getGameIsOver( server );
|
setBool( env, jsummary, "gameOver", summary.gameOver );
|
||||||
setBool( env, jsummary, "gameOver", gameOver );
|
setInt( env, jsummary, "turn", summary.turn );
|
||||||
XP_Bool isLocal = XP_FALSE;
|
setBool( env, jsummary, "turnIsLocal", summary.turnIsLocal );
|
||||||
setInt( env, jsummary, "turn",
|
setInt( env, jsummary, "lastMoveTime", summary.lastMoveTime );
|
||||||
server_getCurrentTurn( server, &isLocal ) );
|
setInt( env, jsummary, "dupTimerExpires", summary.dupTimerExpires );
|
||||||
setBool( env, jsummary, "turnIsLocal", isLocal );
|
|
||||||
setInt( env, jsummary, "lastMoveTime",
|
|
||||||
server_getLastMoveTime(server) );
|
|
||||||
setInt( env, jsummary, "dupTimerExpires",
|
|
||||||
server_getDupTimerExpires(server) );
|
|
||||||
|
|
||||||
if ( !!state->game.comms ) {
|
if ( !!state->game.comms ) {
|
||||||
CommsCtxt* comms = state->game.comms;
|
CommsCtxt* comms = state->game.comms;
|
||||||
setInt( env, jsummary, "seed", comms_getChannelSeed( comms ) );
|
setInt( env, jsummary, "seed", comms_getChannelSeed( comms ) );
|
||||||
setInt( env, jsummary, "missingPlayers",
|
setInt( env, jsummary, "missingPlayers", summary.missingPlayers );
|
||||||
server_getMissingPlayers( server ) );
|
setInt( env, jsummary, "nPacketsPending", summary.nPacketsPending );
|
||||||
setInt( env, jsummary, "nPacketsPending",
|
|
||||||
comms_countPendingPackets( state->game.comms ) );
|
|
||||||
|
|
||||||
CommsAddrRec addr;
|
CommsAddrRec addr;
|
||||||
comms_getAddr( comms, &addr );
|
comms_getAddr( comms, &addr );
|
||||||
|
@ -2317,9 +2310,10 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ModelCtxt* model = state->game.model;
|
||||||
XP_U16 nPlayers = model_getNPlayers( model );
|
XP_U16 nPlayers = model_getNPlayers( model );
|
||||||
jint jvals[nPlayers];
|
jint jvals[nPlayers];
|
||||||
if ( gameOver ) {
|
if ( summary.gameOver ) {
|
||||||
ScoresArray scores;
|
ScoresArray scores;
|
||||||
model_figureFinalScores( model, &scores, NULL );
|
model_figureFinalScores( model, &scores, NULL );
|
||||||
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
for ( int ii = 0; ii < nPlayers; ++ii ) {
|
||||||
|
|
|
@ -36,9 +36,6 @@ typedef enum { UNPAUSED,
|
||||||
|
|
||||||
typedef XP_Bool (*OnOneProc)(void* closure, const XP_UCHAR* keys[]);
|
typedef XP_Bool (*OnOneProc)(void* closure, const XP_UCHAR* keys[]);
|
||||||
|
|
||||||
typedef void (*OnStoreProc)( void* closure, XP_Bool success );
|
|
||||||
typedef void (*OnLoadProc)( void* closure, const char* key, void* data, int len );
|
|
||||||
|
|
||||||
#define KEY_WILDCARD "*"
|
#define KEY_WILDCARD "*"
|
||||||
|
|
||||||
typedef struct _DUtilVtable {
|
typedef struct _DUtilVtable {
|
||||||
|
@ -163,16 +160,4 @@ void dutil_super_init( MPFORMAL XW_DUtilCtxt* dutil );
|
||||||
#define dutil_onGameGoneReceived(duc, xwe, gameID, from) \
|
#define dutil_onGameGoneReceived(duc, xwe, gameID, from) \
|
||||||
(duc)->vtable.m_dutil_onGameGoneReceived((duc),(xwe),(gameID),(from))
|
(duc)->vtable.m_dutil_onGameGoneReceived((duc),(xwe),(gameID),(from))
|
||||||
|
|
||||||
/* #define dutil_storePtrAt( duc, xwe, data, len, keys ) \ */
|
|
||||||
/* (duc)->vtable.m_dutil_storePtrAt((duc), (xwe), (data), (len), (keys)) */
|
|
||||||
|
|
||||||
/* #define dutil_storeStreamAt( duc, xwe, stream, keys ) \ */
|
|
||||||
/* (duc)->vtable.m_dutil_storeStreamAt((duc), (xwe), (stream), (keys)) */
|
|
||||||
|
|
||||||
/* #define dutil_loadStreamAt( duc, xwe, inOut, keys, ... ) \ */
|
|
||||||
/* (duc)->vtable.m_dutil_loadStreamAt((duc), (xwe), (inOut), (keys)) */
|
|
||||||
|
|
||||||
/* #define dutil_loadPtrAt( duc, xwe, ptr, lenp, keys ) \ */
|
|
||||||
/* (duc)->vtable.m_dutil_loadPtrAt( (duc), (xwe), (ptr), (lenp), (keys)) */
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -553,6 +553,8 @@ game_summarize( XWGame* game, CurGameInfo* gi, GameSummary* summary )
|
||||||
summary->lastMoveTime = server_getLastMoveTime(server);
|
summary->lastMoveTime = server_getLastMoveTime(server);
|
||||||
summary->lang = gi->dictLang;
|
summary->lang = gi->dictLang;
|
||||||
summary->gameOver = server_getGameIsOver( server );
|
summary->gameOver = server_getGameIsOver( server );
|
||||||
|
summary->nMoves = model_getNMoves( game->model );
|
||||||
|
summary->dupTimerExpires = server_getDupTimerExpires( server );
|
||||||
|
|
||||||
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
|
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
|
||||||
LocalPlayer* lp = &gi->players[ii];
|
LocalPlayer* lp = &gi->players[ii];
|
||||||
|
@ -564,9 +566,8 @@ game_summarize( XWGame* game, CurGameInfo* gi, GameSummary* summary )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !!game->comms ) {
|
if ( !!game->comms ) {
|
||||||
CommsCtxt* comms = game->comms;
|
|
||||||
summary->missingPlayers = server_getMissingPlayers( server );
|
summary->missingPlayers = server_getMissingPlayers( server );
|
||||||
summary->nPacketsPending = comms_countPendingPackets( comms );
|
summary->nPacketsPending = comms_countPendingPackets( game->comms );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,8 +56,10 @@ typedef struct _GameSummary {
|
||||||
XP_Bool gameOver;
|
XP_Bool gameOver;
|
||||||
XP_S8 turn;
|
XP_S8 turn;
|
||||||
XP_U32 lastMoveTime;
|
XP_U32 lastMoveTime;
|
||||||
|
XP_S32 dupTimerExpires;
|
||||||
XP_U8 missingPlayers;
|
XP_U8 missingPlayers;
|
||||||
XP_U8 nPacketsPending;
|
XP_U8 nPacketsPending;
|
||||||
|
XP_S16 nMoves;
|
||||||
XP_LangCode lang;
|
XP_LangCode lang;
|
||||||
XP_UCHAR opponents[64];
|
XP_UCHAR opponents[64];
|
||||||
} GameSummary;
|
} GameSummary;
|
||||||
|
|
Loading…
Reference in a new issue