show pending name in scoreboard

when remote hasn't arrived, show same string in scoreboard as in games
list rather than the local player's default name -- duh.
This commit is contained in:
Eric House 2020-04-05 19:48:36 -07:00 committed by Eric House
parent f5808e0514
commit 67759c883a
5 changed files with 24 additions and 13 deletions

View file

@ -121,6 +121,7 @@ public class DUtilCtxt {
private static final int STR_DUP_MOVED = 27;
private static final int STRD_DUP_TRADED = 28;
private static final int STRSD_DUP_ONESCORE = 29;
private static final int STR_PENDING_PLAYER = 30;
public String getUserString( int stringCode )
{
@ -207,6 +208,10 @@ public class DUtilCtxt {
id = R.string.dup_onescore_fmt;
break;
case STR_PENDING_PLAYER:
id = R.string.missing_player;
break;
default:
Log.w( TAG, "no such stringCode: %d", stringCode );
}

View file

@ -33,6 +33,6 @@
# define STR_DUP_MOVED 27
# define STRD_DUP_TRADED 28
# define STRSD_DUP_ONESCORE 29
# define N_AND_USER_STRINGS 29
# define STR_PENDING_PLAYER 30
# define N_AND_USER_STRINGS 30
#endif

View file

@ -23,6 +23,7 @@
#include "game.h"
#include "strutils.h"
#include "dbgutil.h"
#include "LocalizedStrIncludes.h"
#ifdef CPLUS
extern "C" {
@ -244,8 +245,10 @@ drawScoreBoard( BoardCtxt* board )
/* figure spacing for each scoreboard entry */
XP_MEMSET( &datum, 0, sizeof(datum) );
totalDim = 0;
XP_U16 missingPlayers = server_getMissingPlayers( board->server );
for ( dp = datum, ii = 0; ii < nPlayers; ++ii, ++dp ) {
LocalPlayer* lp = &board->gi->players[ii];
XP_Bool isMissing = 0 != ((1 << ii) & missingPlayers);
/* This is a hack! */
dp->dsi.lsc = board_ScoreCallback;
@ -258,11 +261,16 @@ drawScoreBoard( BoardCtxt* board )
dp->dsi.playerNum = ii;
dp->dsi.totalScore = scores.arr[ii];
dp->dsi.isTurn = server_isPlayersTurn( board->server, ii );
dp->dsi.name = emptyStringIfNull(lp->name);
dp->dsi.selected = board->trayVisState != TRAY_HIDDEN
&& ii==selPlayer;
dp->dsi.isRobot = LP_IS_ROBOT(lp);
dp->dsi.isRemote = !lp->isLocal;
XP_ASSERT( !isMissing || dp->dsi.isRemote );
if ( dp->dsi.isRemote && isMissing ) {
dp->dsi.name = dutil_getUserString( board->dutil, STR_PENDING_PLAYER );
} else {
dp->dsi.name = emptyStringIfNull( lp->name );
}
dp->dsi.nTilesLeft = (nTilesInPool > 0)? -1:
model_getNumTilesTotal( model, ii );

View file

@ -30,8 +30,7 @@ enum {
STR_SUBMIT_CONFIRM,
STRD_TURN_SCORE,
STR_BONUS_ALL,
STR_NONLOCAL_NAME,
STR_LOCAL_NAME,
STR_PENDING_PLAYER,
STRD_TIME_PENALTY_SUB,
STRD_CUMULATIVE_SCORE,
@ -46,10 +45,6 @@ enum {
STR_ROBOT_MOVED,
STRS_REMOTE_MOVED,
STR_LOCALPLAYERS,
STR_TOTALPLAYERS,
STR_REMOTE,
STRS_VALUES_HEADER,
STRD_REMAINS_HEADER,
STRD_REMAINS_EXPL,
@ -64,6 +59,11 @@ enum {
STRD_DUP_TRADED,
STRSD_DUP_ONESCORE,
/* These three aren't in Android */
STR_LOCALPLAYERS,
STR_TOTALPLAYERS,
STR_REMOTE,
STR_LAST
};

View file

@ -146,10 +146,8 @@ linux_dutil_getUserString( XW_DUtilCtxt* XP_UNUSED(uc), XP_U16 code )
return (XP_UCHAR*)"Score for turn: %d\n";
case STR_BONUS_ALL:
return (XP_UCHAR*)"Bonus for using all tiles: 50\n";
case STR_LOCAL_NAME:
return (XP_UCHAR*)"%s";
case STR_NONLOCAL_NAME:
return (XP_UCHAR*)"%s (remote)";
case STR_PENDING_PLAYER:
return (XP_UCHAR*)"(remote)";
case STRD_TIME_PENALTY_SUB:
return (XP_UCHAR*)" - %d [time]";
/* added.... */