mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +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
|
||||
( JNIEnv* env, jclass C, GamePtrType gamePtr, jobject jsummary )
|
||||
{
|
||||
XWJNI_START();
|
||||
ModelCtxt* model = state->game.model;
|
||||
ServerCtxt* server = state->game.server;
|
||||
XP_S16 nMoves = model_getNMoves( model );
|
||||
setInt( env, jsummary, "nMoves", nMoves );
|
||||
XP_Bool gameOver = server_getGameIsOver( server );
|
||||
setBool( env, jsummary, "gameOver", gameOver );
|
||||
XP_Bool isLocal = XP_FALSE;
|
||||
setInt( env, jsummary, "turn",
|
||||
server_getCurrentTurn( server, &isLocal ) );
|
||||
setBool( env, jsummary, "turnIsLocal", isLocal );
|
||||
setInt( env, jsummary, "lastMoveTime",
|
||||
server_getLastMoveTime(server) );
|
||||
setInt( env, jsummary, "dupTimerExpires",
|
||||
server_getDupTimerExpires(server) );
|
||||
XWJNI_START_GLOBALS();
|
||||
GameSummary summary = {0};
|
||||
game_summarize( &state->game, globals->gi, &summary );
|
||||
|
||||
setInt( env, jsummary, "nMoves", summary.nMoves );
|
||||
setBool( env, jsummary, "gameOver", summary.gameOver );
|
||||
setInt( env, jsummary, "turn", summary.turn );
|
||||
setBool( env, jsummary, "turnIsLocal", summary.turnIsLocal );
|
||||
setInt( env, jsummary, "lastMoveTime", summary.lastMoveTime );
|
||||
setInt( env, jsummary, "dupTimerExpires", summary.dupTimerExpires );
|
||||
|
||||
if ( !!state->game.comms ) {
|
||||
CommsCtxt* comms = state->game.comms;
|
||||
setInt( env, jsummary, "seed", comms_getChannelSeed( comms ) );
|
||||
setInt( env, jsummary, "missingPlayers",
|
||||
server_getMissingPlayers( server ) );
|
||||
setInt( env, jsummary, "nPacketsPending",
|
||||
comms_countPendingPackets( state->game.comms ) );
|
||||
setInt( env, jsummary, "missingPlayers", summary.missingPlayers );
|
||||
setInt( env, jsummary, "nPacketsPending", summary.nPacketsPending );
|
||||
|
||||
CommsAddrRec 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 );
|
||||
jint jvals[nPlayers];
|
||||
if ( gameOver ) {
|
||||
if ( summary.gameOver ) {
|
||||
ScoresArray scores;
|
||||
model_figureFinalScores( model, &scores, NULL );
|
||||
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 void (*OnStoreProc)( void* closure, XP_Bool success );
|
||||
typedef void (*OnLoadProc)( void* closure, const char* key, void* data, int len );
|
||||
|
||||
#define KEY_WILDCARD "*"
|
||||
|
||||
typedef struct _DUtilVtable {
|
||||
|
@ -163,16 +160,4 @@ void dutil_super_init( MPFORMAL XW_DUtilCtxt* dutil );
|
|||
#define 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
|
||||
|
|
|
@ -553,6 +553,8 @@ game_summarize( XWGame* game, CurGameInfo* gi, GameSummary* summary )
|
|||
summary->lastMoveTime = server_getLastMoveTime(server);
|
||||
summary->lang = gi->dictLang;
|
||||
summary->gameOver = server_getGameIsOver( server );
|
||||
summary->nMoves = model_getNMoves( game->model );
|
||||
summary->dupTimerExpires = server_getDupTimerExpires( server );
|
||||
|
||||
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
|
||||
LocalPlayer* lp = &gi->players[ii];
|
||||
|
@ -564,9 +566,8 @@ game_summarize( XWGame* game, CurGameInfo* gi, GameSummary* summary )
|
|||
}
|
||||
}
|
||||
if ( !!game->comms ) {
|
||||
CommsCtxt* comms = game->comms;
|
||||
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_S8 turn;
|
||||
XP_U32 lastMoveTime;
|
||||
XP_S32 dupTimerExpires;
|
||||
XP_U8 missingPlayers;
|
||||
XP_U8 nPacketsPending;
|
||||
XP_S16 nMoves;
|
||||
XP_LangCode lang;
|
||||
XP_UCHAR opponents[64];
|
||||
} GameSummary;
|
||||
|
|
Loading…
Reference in a new issue