just print the upper-case versions of tile faces

This commit is contained in:
Eric House 2020-04-24 22:21:02 -07:00
parent a35cc760f2
commit b618c99fa8
5 changed files with 22 additions and 8 deletions

View file

@ -1653,7 +1653,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_server_1formatDictCounts
jstring result;
XWJNI_START_GLOBALS();
XWStreamCtxt* stream = and_empty_stream( MPPARM(mpool) globals );
server_formatDictCounts( state->game.server, stream, nCols );
server_formatDictCounts( state->game.server, stream, nCols, XP_FALSE );
result = streamToJString( env, stream );
stream_destroy( stream );
XWJNI_END();

View file

@ -4177,7 +4177,7 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming )
void
server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
XP_U16 nCols )
XP_U16 nCols, XP_Bool allFaces )
{
DictionaryCtxt* dict;
Tile tile;
@ -4206,14 +4206,14 @@ server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
const XP_UCHAR* face = NULL;
XP_UCHAR faces[48] = {0};
XP_U16 len = 0;
for ( ; ; ) {
do {
face = dict_getNextTileString( dict, tile, face );
if ( !face ) {
break;
}
const XP_UCHAR* fmt = len == 0? "%s" : ",%s";
len += XP_SNPRINTF( faces + len, sizeof(faces) - len, fmt, face );
}
} while ( allFaces );
value = dict_getTileValue( dict, tile );
XP_SNPRINTF( buf, sizeof(buf), (XP_UCHAR*)"%s: %d/%d",

View file

@ -122,7 +122,7 @@ void server_sendChat( ServerCtxt* server, const XP_UCHAR* msg, XP_S16 from );
#endif
void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
XP_U16 nCols );
XP_U16 nCols, XP_Bool allFaces );
void server_formatRemainingTiles( ServerCtxt* server, XWStreamCtxt* stream,
XP_S16 player );

View file

@ -1474,7 +1474,7 @@ handleShowVals( void* closure, int XP_UNUSED(key) )
XWStreamCtxt* stream = mem_stream_make_raw( MPPARM(cGlobals->util->mpool)
cGlobals->params->vtMgr );
server_formatDictCounts( bGlobals->cGlobals.game.server, stream, 5 );
server_formatDictCounts( bGlobals->cGlobals.game.server, stream, 5, XP_FALSE );
const XP_U8* data = stream_getPtr( stream );
XP_U16 len = stream_getSize( stream );
XP_UCHAR buf[len + 1];

View file

@ -734,7 +734,7 @@ makeAddSubmenu( GtkWidget* menubar, gchar* label )
} /* makeAddSubmenu */
static void
tile_values( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
tile_values_impl( GtkGameGlobals* globals, bool full )
{
CommonGlobals* cGlobals = &globals->cGlobals;
if ( !!cGlobals->game.server ) {
@ -744,13 +744,25 @@ tile_values( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
globals,
CHANNEL_NONE,
catOnClose );
server_formatDictCounts( cGlobals->game.server, stream, 5 );
server_formatDictCounts( cGlobals->game.server, stream, 5, full );
stream_putU8( stream, '\n' );
stream_destroy( stream );
}
} /* tile_values */
static void
tile_values( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
{
tile_values_impl( globals, false );
}
static void
tile_values_full( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
{
tile_values_impl( globals, true );
}
static void
game_history( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
{
@ -1037,6 +1049,8 @@ makeMenus( GtkGameGlobals* globals )
fileMenu = makeAddSubmenu( menubar, "File" );
(void)createAddItem( fileMenu, "Tile values",
(GCallback)tile_values, globals );
(void)createAddItem( fileMenu, "Tile values full",
(GCallback)tile_values_full, globals );
(void)createAddItem( fileMenu, "Game history",
(GCallback)game_history, globals );
#ifdef TEXT_MODEL