Add vars to support turning on/off picking tiles

This commit is contained in:
ehouse 2003-11-19 04:06:32 +00:00
parent 767d7fa2f4
commit 6a30f1c7c1
3 changed files with 27 additions and 7 deletions

View file

@ -232,6 +232,11 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, XP_UCHAR* nameTemplate )
gi->robotSmartness = SMART_ROBOT;
gi->timerEnabled = XP_FALSE;
gi->gameSeconds = 25 * 60; /* 25 minute game is common? */
#ifdef FEATURE_TRAY_EDIT
gi->allowPickTiles = XP_FALSE;
gi->allowPickTilesRobot = XP_FALSE;
gi->allowPickWasUsed = XP_FALSE;
#endif
for ( i = 0; i < MAX_NUM_PLAYERS; ++i ) {
XP_UCHAR buf[20];
@ -299,6 +304,11 @@ gi_copy( MPFORMAL CurGameInfo* destGI, CurGameInfo* srcGI )
destGI->timerEnabled = srcGI->timerEnabled;
destGI->robotSmartness = (XP_U8)srcGI->robotSmartness;
destGI->phoniesAction = srcGI->phoniesAction;
#ifdef FEATURE_TRAY_EDIT
destGI->allowPickTiles = srcGI->allowPickTiles;
destGI->allowPickTilesRobot = srcGI->allowPickTilesRobot;
destGI->allowPickWasUsed = srcGI->allowPickWasUsed;
#endif
for ( srcPl = srcGI->players, destPl = destGI->players, i = 0;
i < nPlayers; ++srcPl, ++destPl, ++i ) {
@ -332,6 +342,12 @@ gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi )
gi->robotSmartness = (XP_U8)stream_getBits( stream, 2 );
gi->phoniesAction = (XWPhoniesChoice)stream_getBits( stream, 2 );
gi->timerEnabled = stream_getBits( stream, 1 );
#ifdef FEATURE_TRAY_EDIT
gi->allowPickTiles = stream_getBits( stream, 1 );
gi->allowPickTilesRobot = stream_getBits( stream, 1 );
gi->allowPickWasUsed = stream_getBits( stream, 1 );
#endif
gi->gameID = stream_getU16( stream );
if ( gi->timerEnabled ) {
@ -372,6 +388,11 @@ gi_writeToStream( XWStreamCtxt* stream, CurGameInfo* gi )
stream_putBits( stream, 2, gi->robotSmartness );
stream_putBits( stream, 2, gi->phoniesAction );
stream_putBits( stream, 1, gi->timerEnabled );
#ifdef FEATURE_TRAY_EDIT
stream_putBits( stream, 1, gi->allowPickTiles );
stream_putBits( stream, 1, gi->allowPickTilesRobot );
stream_putBits( stream, 1, gi->allowPickWasUsed );
#endif
stream_putU16( stream, gi->gameID );
if ( gi->timerEnabled) {

View file

@ -54,6 +54,11 @@ typedef struct CurGameInfo {
XP_Bool hintsNotAllowed;
XP_Bool timerEnabled;
#ifdef FEATURE_TRAY_EDIT
XP_Bool allowPickTiles;
XP_Bool allowPickTilesRobot;
XP_Bool allowPickWasUsed;
#endif
XP_U8 robotSmartness;
XWPhoniesChoice phoniesAction;

View file

@ -94,9 +94,6 @@ typedef struct ServerNonvolatiles {
XP_S8 currentTurn; /* invalid when game is over */
XP_U8 pendingRegistrations;
XP_Bool showRobotScores;
#ifdef FEATURE_TRAY_EDIT
XP_Bool allowPickTiles;
#endif
RemoteAddress addresses[MAX_NUM_PLAYERS];
@ -175,9 +172,6 @@ initServer( ServerCtxt* server )
server->nv.nDevices = 1; /* local device (0) is always there */
#ifdef FEATURE_TRAY_EDIT
server->nv.allowPickTiles = XP_TRUE;
#endif
} /* initServer */
ServerCtxt*
@ -1289,7 +1283,7 @@ fetchTiles( ServerCtxt* server, XP_U16 playerNum, XP_U16 nToFetch,
XP_ASSERT( !!pool );
#ifdef FEATURE_TRAY_EDIT
ask = !server->vol.gi->players[playerNum].isRobot
&& server->nv.allowPickTiles;
&& server->vol.gi->allowPickTiles;
#else
ask = XP_FALSE;
#endif