clear name on delete; remove logging

This commit is contained in:
Eric House 2021-03-08 07:54:05 -08:00
parent 21b8cc0d95
commit b0cc6dd744
3 changed files with 22 additions and 19 deletions

View file

@ -541,7 +541,7 @@ stack_getNextTurn( StackCtxt* stack )
stack_freeEntry( stack, &dummy ); stack_freeEntry( stack, &dummy );
} }
LOG_RETURNF( "%d", result ); // LOG_RETURNF( "%d", result );
return result; return result;
} }

View file

@ -3685,7 +3685,6 @@ server_commitMove( ServerCtxt* server, XWEnv xwe, XP_U16 player, TrayTileSet* ne
static void static void
finishMove( ServerCtxt* server, XWEnv xwe, TrayTileSet* newTiles, XP_U16 turn ) finishMove( ServerCtxt* server, XWEnv xwe, TrayTileSet* newTiles, XP_U16 turn )
{ {
LOG_FUNC();
ModelCtxt* model = server->vol.model; ModelCtxt* model = server->vol.model;
CurGameInfo* gi = server->vol.gi; CurGameInfo* gi = server->vol.gi;
@ -3732,8 +3731,8 @@ finishMove( ServerCtxt* server, XWEnv xwe, TrayTileSet* newTiles, XP_U16 turn )
} else { } else {
nextTurn( server, xwe, PICK_NEXT ); nextTurn( server, xwe, PICK_NEXT );
} }
XP_LOGFF( "player %d now has %d tiles", turn, /* XP_LOGFF( "player %d now has %d tiles", turn, */
model_getNumTilesInTray( model, turn ) ); /* model_getNumTilesInTray( model, turn ) ); */
} /* finishMove */ } /* finishMove */
XP_Bool XP_Bool

View file

@ -132,7 +132,7 @@ EM_JS(void, call_get_dict, (const char* lc, GotDictProc proc,
}); });
EM_JS(void, show_name, (const char* name), { EM_JS(void, show_name, (const char* name), {
let jsname = UTF8ToString(name); let jsname = name ? UTF8ToString(name) : "";
document.getElementById('gamename').textContent = jsname; document.getElementById('gamename').textContent = jsname;
}); });
@ -493,20 +493,23 @@ updateGameButtons( Globals* globals )
static void static void
showName( GameState* gs ) showName( GameState* gs )
{ {
Globals* globals = gs->globals; const char* title = NULL;
const char* title = gs->gameName; if ( !!gs ) {
char buf[64]; Globals* globals = gs->globals;
if ( true || 1 < countDicts( globals ) ) { title = gs->gameName;
char langName[32]; char buf[64];
const char* lc = lcToLocale(gs->gi.dictLang); if ( true || 1 < countDicts( globals ) ) {
const XP_UCHAR* keys[] = {KEY_DICTS, lc, KEY_LANG_NAME, NULL }; char langName[32];
XP_U32 len = sizeof(langName); const char* lc = lcToLocale(gs->gi.dictLang);
dutil_loadPtr( globals->dutil, NULL, keys, langName, &len ); const XP_UCHAR* keys[] = {KEY_DICTS, lc, KEY_LANG_NAME, NULL };
if ( 0 != len ) { XP_U32 len = sizeof(langName);
lc = langName; dutil_loadPtr( globals->dutil, NULL, keys, langName, &len );
if ( 0 != len ) {
lc = langName;
}
sprintf( buf, "%s (%s)", title, lc );
title = buf;
} }
sprintf( buf, "%s (%s)", title, lc );
title = buf;
} }
show_name( title ); show_name( title );
} }
@ -633,6 +636,7 @@ deleteGame( GameState* gs )
formatGameID( gameIDStr, sizeof(gameIDStr), gameID ); formatGameID( gameIDStr, sizeof(gameIDStr), gameID );
const XP_UCHAR* keys[] = {KEY_GAMES, gameIDStr, NULL}; const XP_UCHAR* keys[] = {KEY_GAMES, gameIDStr, NULL};
dutil_remove( globals->dutil, keys ); dutil_remove( globals->dutil, keys );
showName( NULL );
} }
static void static void
@ -1006,7 +1010,7 @@ gameFromInvite( Globals* globals, const NetLaunchInfo* invite )
} else { } else {
char msg[128]; char msg[128];
sprintf( msg, "Invitation requires a wordlist %s for " sprintf( msg, "Invitation requires a wordlist %s for "
"language %s; download now?", invite->dict, lc ); "locale %s; download now?", invite->dict, lc );
DictDownState* dds = XP_MALLOC( globals->mpool, sizeof(*dds) ); DictDownState* dds = XP_MALLOC( globals->mpool, sizeof(*dds) );
dds->globals = globals; dds->globals = globals;