mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
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:
parent
f5808e0514
commit
67759c883a
5 changed files with 24 additions and 13 deletions
|
@ -121,6 +121,7 @@ public class DUtilCtxt {
|
||||||
private static final int STR_DUP_MOVED = 27;
|
private static final int STR_DUP_MOVED = 27;
|
||||||
private static final int STRD_DUP_TRADED = 28;
|
private static final int STRD_DUP_TRADED = 28;
|
||||||
private static final int STRSD_DUP_ONESCORE = 29;
|
private static final int STRSD_DUP_ONESCORE = 29;
|
||||||
|
private static final int STR_PENDING_PLAYER = 30;
|
||||||
|
|
||||||
public String getUserString( int stringCode )
|
public String getUserString( int stringCode )
|
||||||
{
|
{
|
||||||
|
@ -207,6 +208,10 @@ public class DUtilCtxt {
|
||||||
id = R.string.dup_onescore_fmt;
|
id = R.string.dup_onescore_fmt;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case STR_PENDING_PLAYER:
|
||||||
|
id = R.string.missing_player;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Log.w( TAG, "no such stringCode: %d", stringCode );
|
Log.w( TAG, "no such stringCode: %d", stringCode );
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@
|
||||||
# define STR_DUP_MOVED 27
|
# define STR_DUP_MOVED 27
|
||||||
# define STRD_DUP_TRADED 28
|
# define STRD_DUP_TRADED 28
|
||||||
# define STRSD_DUP_ONESCORE 29
|
# define STRSD_DUP_ONESCORE 29
|
||||||
|
# define STR_PENDING_PLAYER 30
|
||||||
# define N_AND_USER_STRINGS 29
|
# define N_AND_USER_STRINGS 30
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "game.h"
|
#include "game.h"
|
||||||
#include "strutils.h"
|
#include "strutils.h"
|
||||||
#include "dbgutil.h"
|
#include "dbgutil.h"
|
||||||
|
#include "LocalizedStrIncludes.h"
|
||||||
|
|
||||||
#ifdef CPLUS
|
#ifdef CPLUS
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -244,8 +245,10 @@ drawScoreBoard( BoardCtxt* board )
|
||||||
/* figure spacing for each scoreboard entry */
|
/* figure spacing for each scoreboard entry */
|
||||||
XP_MEMSET( &datum, 0, sizeof(datum) );
|
XP_MEMSET( &datum, 0, sizeof(datum) );
|
||||||
totalDim = 0;
|
totalDim = 0;
|
||||||
|
XP_U16 missingPlayers = server_getMissingPlayers( board->server );
|
||||||
for ( dp = datum, ii = 0; ii < nPlayers; ++ii, ++dp ) {
|
for ( dp = datum, ii = 0; ii < nPlayers; ++ii, ++dp ) {
|
||||||
LocalPlayer* lp = &board->gi->players[ii];
|
LocalPlayer* lp = &board->gi->players[ii];
|
||||||
|
XP_Bool isMissing = 0 != ((1 << ii) & missingPlayers);
|
||||||
|
|
||||||
/* This is a hack! */
|
/* This is a hack! */
|
||||||
dp->dsi.lsc = board_ScoreCallback;
|
dp->dsi.lsc = board_ScoreCallback;
|
||||||
|
@ -258,11 +261,16 @@ drawScoreBoard( BoardCtxt* board )
|
||||||
dp->dsi.playerNum = ii;
|
dp->dsi.playerNum = ii;
|
||||||
dp->dsi.totalScore = scores.arr[ii];
|
dp->dsi.totalScore = scores.arr[ii];
|
||||||
dp->dsi.isTurn = server_isPlayersTurn( board->server, ii );
|
dp->dsi.isTurn = server_isPlayersTurn( board->server, ii );
|
||||||
dp->dsi.name = emptyStringIfNull(lp->name);
|
|
||||||
dp->dsi.selected = board->trayVisState != TRAY_HIDDEN
|
dp->dsi.selected = board->trayVisState != TRAY_HIDDEN
|
||||||
&& ii==selPlayer;
|
&& ii==selPlayer;
|
||||||
dp->dsi.isRobot = LP_IS_ROBOT(lp);
|
dp->dsi.isRobot = LP_IS_ROBOT(lp);
|
||||||
dp->dsi.isRemote = !lp->isLocal;
|
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:
|
dp->dsi.nTilesLeft = (nTilesInPool > 0)? -1:
|
||||||
model_getNumTilesTotal( model, ii );
|
model_getNumTilesTotal( model, ii );
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,7 @@ enum {
|
||||||
STR_SUBMIT_CONFIRM,
|
STR_SUBMIT_CONFIRM,
|
||||||
STRD_TURN_SCORE,
|
STRD_TURN_SCORE,
|
||||||
STR_BONUS_ALL,
|
STR_BONUS_ALL,
|
||||||
STR_NONLOCAL_NAME,
|
STR_PENDING_PLAYER,
|
||||||
STR_LOCAL_NAME,
|
|
||||||
STRD_TIME_PENALTY_SUB,
|
STRD_TIME_PENALTY_SUB,
|
||||||
|
|
||||||
STRD_CUMULATIVE_SCORE,
|
STRD_CUMULATIVE_SCORE,
|
||||||
|
@ -46,10 +45,6 @@ enum {
|
||||||
STR_ROBOT_MOVED,
|
STR_ROBOT_MOVED,
|
||||||
STRS_REMOTE_MOVED,
|
STRS_REMOTE_MOVED,
|
||||||
|
|
||||||
STR_LOCALPLAYERS,
|
|
||||||
STR_TOTALPLAYERS,
|
|
||||||
STR_REMOTE,
|
|
||||||
|
|
||||||
STRS_VALUES_HEADER,
|
STRS_VALUES_HEADER,
|
||||||
STRD_REMAINS_HEADER,
|
STRD_REMAINS_HEADER,
|
||||||
STRD_REMAINS_EXPL,
|
STRD_REMAINS_EXPL,
|
||||||
|
@ -64,6 +59,11 @@ enum {
|
||||||
STRD_DUP_TRADED,
|
STRD_DUP_TRADED,
|
||||||
STRSD_DUP_ONESCORE,
|
STRSD_DUP_ONESCORE,
|
||||||
|
|
||||||
|
/* These three aren't in Android */
|
||||||
|
STR_LOCALPLAYERS,
|
||||||
|
STR_TOTALPLAYERS,
|
||||||
|
STR_REMOTE,
|
||||||
|
|
||||||
STR_LAST
|
STR_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -146,10 +146,8 @@ linux_dutil_getUserString( XW_DUtilCtxt* XP_UNUSED(uc), XP_U16 code )
|
||||||
return (XP_UCHAR*)"Score for turn: %d\n";
|
return (XP_UCHAR*)"Score for turn: %d\n";
|
||||||
case STR_BONUS_ALL:
|
case STR_BONUS_ALL:
|
||||||
return (XP_UCHAR*)"Bonus for using all tiles: 50\n";
|
return (XP_UCHAR*)"Bonus for using all tiles: 50\n";
|
||||||
case STR_LOCAL_NAME:
|
case STR_PENDING_PLAYER:
|
||||||
return (XP_UCHAR*)"%s";
|
return (XP_UCHAR*)"(remote)";
|
||||||
case STR_NONLOCAL_NAME:
|
|
||||||
return (XP_UCHAR*)"%s (remote)";
|
|
||||||
case STRD_TIME_PENALTY_SUB:
|
case STRD_TIME_PENALTY_SUB:
|
||||||
return (XP_UCHAR*)" - %d [time]";
|
return (XP_UCHAR*)" - %d [time]";
|
||||||
/* added.... */
|
/* added.... */
|
||||||
|
|
Loading…
Reference in a new issue