mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
add common prefs field sortNewTiles and way to set on linux cmdline
This commit is contained in:
parent
e0dd3701a0
commit
80aa22b2d1
5 changed files with 22 additions and 4 deletions
|
@ -130,6 +130,7 @@ typedef struct CommonPrefs {
|
|||
XP_Bool showRobotScores; /* applies to all games */
|
||||
XP_Bool hideTileValues;
|
||||
XP_Bool skipCommitConfirm; /* applies to all games */
|
||||
XP_Bool sortNewTiles; /* applies to all games */
|
||||
#ifdef XWFEATURE_SLOW_ROBOT
|
||||
XP_U16 robotThinkMin, robotThinkMax;
|
||||
#endif
|
||||
|
|
|
@ -91,6 +91,7 @@ typedef struct ServerNonvolatiles {
|
|||
XP_S8 currentTurn; /* invalid when game is over */
|
||||
XP_U8 pendingRegistrations;
|
||||
XP_Bool showRobotScores;
|
||||
XP_Bool sortNewTiles;
|
||||
|
||||
#ifdef XWFEATURE_SLOW_ROBOT
|
||||
XP_U16 robotThinkMin, robotThinkMax; /* not saved (yet) */
|
||||
|
@ -438,6 +439,7 @@ void
|
|||
server_prefsChanged( ServerCtxt* server, CommonPrefs* cp )
|
||||
{
|
||||
server->nv.showRobotScores = cp->showRobotScores;
|
||||
server->nv.sortNewTiles = cp->sortNewTiles;
|
||||
#ifdef XWFEATURE_SLOW_ROBOT
|
||||
server->nv.robotThinkMin = cp->robotThinkMin;
|
||||
server->nv.robotThinkMax = cp->robotThinkMax;
|
||||
|
@ -1019,6 +1021,15 @@ clearLocalRobots( ServerCtxt* server )
|
|||
} /* clearLocalRobots */
|
||||
#endif
|
||||
|
||||
static void
|
||||
sortTilesIf( ServerCtxt* server, XP_S16 turn )
|
||||
{
|
||||
ModelCtxt* model = server->vol.model;
|
||||
if ( server->nv.sortNewTiles ) {
|
||||
model_sortTiles( model, turn );
|
||||
}
|
||||
}
|
||||
|
||||
/* Called in response to message from server listing all the names of
|
||||
* players in the game (in server-assigned order) and their initial
|
||||
* tray contents.
|
||||
|
@ -1117,7 +1128,7 @@ client_readInitialMessage( ServerCtxt* server, XWStreamCtxt* stream )
|
|||
later. */
|
||||
pool_removeTiles( pool, &tiles );
|
||||
|
||||
model_sortTiles( model, i );
|
||||
sortTilesIf( server, i );
|
||||
}
|
||||
|
||||
SETSTATE( server, XWSTATE_INTURN );
|
||||
|
@ -1582,7 +1593,7 @@ assignTilesToAll( ServerCtxt* server )
|
|||
TrayTileSet newTiles;
|
||||
fetchTiles( server, i, numAssigned, NULL, &newTiles );
|
||||
model_assignPlayerTiles( model, i, &newTiles );
|
||||
model_sortTiles( model, i );
|
||||
sortTilesIf( server, i );
|
||||
}
|
||||
|
||||
} /* assignTilesToAll */
|
||||
|
@ -2031,7 +2042,7 @@ server_commitMove( ServerCtxt* server )
|
|||
#endif
|
||||
|
||||
model_commitTurn( model, turn, &newTiles );
|
||||
model_sortTiles( model, turn );
|
||||
sortTilesIf( server, turn );
|
||||
|
||||
if ( !isLegalMove && !isClient ) {
|
||||
badWordMoveUndoAndTellUser( server, &server->illegalWordInfo );
|
||||
|
|
|
@ -2053,6 +2053,7 @@ gtkmain( LaunchParams* params, int argc, char *argv[] )
|
|||
globals.cp.showBoardArrow = XP_TRUE;
|
||||
globals.cp.hideTileValues = params->hideValues;
|
||||
globals.cp.skipCommitConfirm = params->skipCommitConfirm;
|
||||
globals.cp.sortNewTiles = params->sortNewTiles;
|
||||
globals.cp.showColors = params->showColors;
|
||||
globals.cp.showRobotScores = params->showRobotScores;
|
||||
#ifdef XWFEATURE_SLOW_ROBOT
|
||||
|
|
|
@ -209,6 +209,7 @@ usage( char* appName, char* msg )
|
|||
"\t [-S] # slow robot down \n"
|
||||
"\t [-i] # print game history when game over\n"
|
||||
"\t [-U] # call 'Undo' after game ends\n"
|
||||
"\t [-O] # sort the tray each time tiles are added\n"
|
||||
#ifdef XWFEATURE_RELAY
|
||||
"\t [-H] # Don't send heartbeats to relay\n"
|
||||
#endif
|
||||
|
@ -809,7 +810,7 @@ main( int argc, char** argv )
|
|||
#if defined PLATFORM_GTK
|
||||
"h:I"
|
||||
#endif
|
||||
"0b:cod:e:Ff:iKkLlmNn:Pr:Ssq:t:Uw:v"
|
||||
"0b:cod:e:Ff:iKkLlmNn:OPr:Ssq:t:Uw:v"
|
||||
#ifdef XWFEATURE_SLOW_ROBOT
|
||||
"z:"
|
||||
#endif
|
||||
|
@ -923,6 +924,9 @@ main( int argc, char** argv )
|
|||
mainParams.gi.players[index].name =
|
||||
copyString( mainParams.util->mpool, (XP_UCHAR*)optarg);
|
||||
break;
|
||||
case 'O':
|
||||
mainParams.sortNewTiles = XP_TRUE;
|
||||
break;
|
||||
case 's':
|
||||
isServer = XP_TRUE;
|
||||
break;
|
||||
|
|
|
@ -59,6 +59,7 @@ typedef struct LaunchParams {
|
|||
XP_Bool verticalScore;
|
||||
XP_Bool hideValues;
|
||||
XP_Bool showColors;
|
||||
XP_Bool sortNewTiles;
|
||||
XP_Bool skipCommitConfirm;
|
||||
XP_Bool needsNewGame;
|
||||
// XP_Bool mainParams;
|
||||
|
|
Loading…
Reference in a new issue