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; jstring result;
XWJNI_START_GLOBALS(); XWJNI_START_GLOBALS();
XWStreamCtxt* stream = and_empty_stream( MPPARM(mpool) 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 ); result = streamToJString( env, stream );
stream_destroy( stream ); stream_destroy( stream );
XWJNI_END(); XWJNI_END();

View file

@ -4177,7 +4177,7 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming )
void void
server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream, server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
XP_U16 nCols ) XP_U16 nCols, XP_Bool allFaces )
{ {
DictionaryCtxt* dict; DictionaryCtxt* dict;
Tile tile; Tile tile;
@ -4206,14 +4206,14 @@ server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
const XP_UCHAR* face = NULL; const XP_UCHAR* face = NULL;
XP_UCHAR faces[48] = {0}; XP_UCHAR faces[48] = {0};
XP_U16 len = 0; XP_U16 len = 0;
for ( ; ; ) { do {
face = dict_getNextTileString( dict, tile, face ); face = dict_getNextTileString( dict, tile, face );
if ( !face ) { if ( !face ) {
break; break;
} }
const XP_UCHAR* fmt = len == 0? "%s" : ",%s"; const XP_UCHAR* fmt = len == 0? "%s" : ",%s";
len += XP_SNPRINTF( faces + len, sizeof(faces) - len, fmt, face ); len += XP_SNPRINTF( faces + len, sizeof(faces) - len, fmt, face );
} } while ( allFaces );
value = dict_getTileValue( dict, tile ); value = dict_getTileValue( dict, tile );
XP_SNPRINTF( buf, sizeof(buf), (XP_UCHAR*)"%s: %d/%d", 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 #endif
void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream, void server_formatDictCounts( ServerCtxt* server, XWStreamCtxt* stream,
XP_U16 nCols ); XP_U16 nCols, XP_Bool allFaces );
void server_formatRemainingTiles( ServerCtxt* server, XWStreamCtxt* stream, void server_formatRemainingTiles( ServerCtxt* server, XWStreamCtxt* stream,
XP_S16 player ); 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) XWStreamCtxt* stream = mem_stream_make_raw( MPPARM(cGlobals->util->mpool)
cGlobals->params->vtMgr ); 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 ); const XP_U8* data = stream_getPtr( stream );
XP_U16 len = stream_getSize( stream ); XP_U16 len = stream_getSize( stream );
XP_UCHAR buf[len + 1]; XP_UCHAR buf[len + 1];

View file

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