passing pool into word-listing code a mistake as it put tiles back

when undoing and so the pool grew each time.  Fix, and remove server
API as it's unneeded.
This commit is contained in:
Andy2 2011-09-22 06:41:48 -07:00
parent d000c430b9
commit 35a0a3a291
5 changed files with 6 additions and 17 deletions

View file

@ -2052,9 +2052,8 @@ recordWord( const XP_UCHAR* word, XP_Bool isLegal, void* closure )
return XP_TRUE;
}
XP_Bool
model_getWordsPlayed( ModelCtxt* model, PoolContext* pool,
XP_U16 nTurns, XWStreamCtxt* stream )
void
model_getWordsPlayed( ModelCtxt* model, XP_U16 nTurns, XWStreamCtxt* stream )
{
XP_ASSERT( !!stream );
StackCtxt* stack = model->vol.stack;
@ -2067,7 +2066,7 @@ model_getWordsPlayed( ModelCtxt* model, PoolContext* pool,
nTurns = nEntries;
}
if ( model_undoLatestMoves( model, pool, nTurns, NULL, NULL ) ) {
if ( model_undoLatestMoves( model, NULL, nTurns, NULL, NULL ) ) {
RecordWordsInfo info = { .stream = stream, .nWords = 0 };
WordNotifierInfo notifyInfo = { .proc = recordWord,
.closure = &info,
@ -2083,7 +2082,6 @@ model_getWordsPlayed( ModelCtxt* model, PoolContext* pool,
NULL );
}
stack_destroy( tmpStack );
return XP_TRUE;
}
XP_Bool

View file

@ -252,8 +252,8 @@ XP_S16 model_getPlayerScore( ModelCtxt* model, XP_S16 player );
XP_Bool model_getPlayersLastScore( ModelCtxt* model, XP_S16 player,
XP_UCHAR* expl, XP_U16* explLen );
XP_Bool model_getWordsPlayed( ModelCtxt* model, PoolContext* pool,
XP_U16 nTurns, XWStreamCtxt* stream );
void model_getWordsPlayed( ModelCtxt* model, XP_U16 nTurns,
XWStreamCtxt* stream );
/* Have there been too many passes (so game should end)? */
XP_Bool model_recentPassCountOk( ModelCtxt* model );

View file

@ -2631,12 +2631,6 @@ server_formatRemainingTiles( ServerCtxt* server, XWStreamCtxt* stream,
}
} /* server_formatRemainingTiles */
void
server_listWordsPlayed( ServerCtxt* server, XWStreamCtxt* stream, XP_U16 nMoves )
{
(void)model_getWordsPlayed( server->vol.model, server->pool, nMoves, stream );
}
#define IMPOSSIBLY_LOW_SCORE -1000
void
server_writeFinalScores( ServerCtxt* server, XWStreamCtxt* stream )

View file

@ -124,9 +124,6 @@ void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
void server_formatRemainingTiles( ServerCtxt* server, XWStreamCtxt* stream,
XP_S16 player );
void server_listWordsPlayed( ServerCtxt* server, XWStreamCtxt* stream,
XP_U16 nMoves );
void server_writeFinalScores( ServerCtxt* server, XWStreamCtxt* stream );
#ifdef CPLUS

View file

@ -1714,7 +1714,7 @@ gtk_util_playerScoreHeld( XW_UtilCtxt* uc, XP_U16 player )
XWStreamCtxt* stream =
mem_stream_make( MEMPOOL globals->cGlobals.params->vtMgr, globals,
CHANNEL_NONE, catOnClose );
server_listWordsPlayed( globals->cGlobals.game.server, stream, 1000 );
(void)model_getWordsPlayed( globals->cGlobals.game.model, 1000, stream );
stream_destroy( stream );
#else