From 35a0a3a291cd9c514401cfe25c3e0f5fbb1b79bb Mon Sep 17 00:00:00 2001 From: Andy2 Date: Thu, 22 Sep 2011 06:41:48 -0700 Subject: [PATCH] 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. --- xwords4/common/model.c | 8 +++----- xwords4/common/model.h | 4 ++-- xwords4/common/server.c | 6 ------ xwords4/common/server.h | 3 --- xwords4/linux/gtkmain.c | 2 +- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/xwords4/common/model.c b/xwords4/common/model.c index 4f996ea60..92290be0a 100644 --- a/xwords4/common/model.c +++ b/xwords4/common/model.c @@ -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 diff --git a/xwords4/common/model.h b/xwords4/common/model.h index 5775b7c52..399f3df77 100644 --- a/xwords4/common/model.h +++ b/xwords4/common/model.h @@ -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 ); diff --git a/xwords4/common/server.c b/xwords4/common/server.c index 83218fbf1..d259cfa6e 100644 --- a/xwords4/common/server.c +++ b/xwords4/common/server.c @@ -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 ) diff --git a/xwords4/common/server.h b/xwords4/common/server.h index 3e23f2c13..54bc8c577 100644 --- a/xwords4/common/server.h +++ b/xwords4/common/server.h @@ -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 diff --git a/xwords4/linux/gtkmain.c b/xwords4/linux/gtkmain.c index 4b16568a2..0316ee376 100644 --- a/xwords4/linux/gtkmain.c +++ b/xwords4/linux/gtkmain.c @@ -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