start to remove obsolete XWFEATURE_STANDALONE_ONLY

This commit is contained in:
Eric House 2024-01-06 20:47:28 -08:00
parent c693df7408
commit 1ae714d834
18 changed files with 17 additions and 207 deletions

View file

@ -2701,10 +2701,8 @@ askRevealTray( BoardCtxt* board, XWEnv xwe )
revealed = XP_TRUE;
} else if ( server_getCurrentTurn( board->server, NULL ) < 0 ) {
revealed = XP_FALSE;
#ifndef XWFEATURE_STANDALONE_ONLY
} else if ( !lp->isLocal ) {
util_userError( board->util, xwe, ERR_NO_PEEK_REMOTE_TILES );
#endif
} else if ( LP_IS_ROBOT(lp) ) {
if ( reversed ) {
util_userError( board->util, xwe, ERR_NO_PEEK_ROBOT_TILES );

View file

@ -53,7 +53,6 @@
* sender's role; rest can be random to aid detection of duplicate packets. */
#define CHANNEL_MASK 0x0003
#ifndef XWFEATURE_STANDALONE_ONLY
#ifndef INITIAL_CLIENT_VERS
# define INITIAL_CLIENT_VERS 2
@ -4171,5 +4170,3 @@ putDevID( const CommsCtxt* comms, XWEnv xwe, XWStreamCtxt* stream )
#endif
EXTERN_C_END
#endif /* #ifndef XWFEATURE_STANDALONE_ONLY */

View file

@ -193,9 +193,7 @@ typedef XP_U16 XP_PlayerAddr;
typedef enum {
TIMER_PENDOWN = 1, /* ARM doesn't like ids of 0... */
TIMER_TIMERTICK,
#ifndef XWFEATURE_STANDALONE_ONLY
TIMER_COMMS,
#endif
#ifdef XWFEATURE_SLOW_ROBOT
TIMER_SLOWROBOT,
#endif
@ -460,10 +458,4 @@ typedef struct _TrayTileSet {
# define XP_UNUSED_KEYBOARD_NAV(x) UNUSED__ ## x __attribute__((unused))
#endif
#ifndef XWFEATURE_STANDALONE_ONLY
# define XP_UNUSED_STANDALONE(x) x
#else
# define XP_UNUSED_STANDALONE(x) UNUSED__ ## x __attribute__((unused))
#endif
#endif

View file

@ -23,8 +23,6 @@
#define CONN_TYPE_COUNT 0
#ifndef XWFEATURE_STANDALONE_ONLY
#ifdef XWFEATURE_RELAY
# define PREV_COUNT CONN_TYPE_COUNT
# undef CONN_TYPE_COUNT
@ -57,6 +55,4 @@
# define NEEDS_CHOOSE_CONNTYPE
#endif
#endif /* XWFEATURE_STANDALONE_ONLY */
#endif

View file

@ -741,7 +741,6 @@ dict_tilesAreSame( const DictionaryCtxt* dict1, const DictionaryCtxt* dict2 )
return result;
} /* dict_tilesAreSame */
#ifndef XWFEATURE_STANDALONE_ONLY
/* Summarize tile info in a way it can be presented to users */
void
dict_writeTilesInfo( const DictionaryCtxt* dict, XP_U16 boardSize, XWStreamCtxt* stream )
@ -816,7 +815,6 @@ dict_writeToStream( const DictionaryCtxt* XP_UNUSED(dict),
/* } */
/* } */
} /* dict_writeToStream */
#endif
static void
freeSpecials( DictionaryCtxt* dict )
@ -859,7 +857,6 @@ common_destructor( DictionaryCtxt* dict, XWEnv XP_UNUSED(xwe) )
XP_FREE( dict->mpool, dict );
} /* common_destructor */
#ifndef XWFEATURE_STANDALONE_ONLY
void
dict_loadFromStream( DictionaryCtxt* dict, XWEnv xwe, XWStreamCtxt* stream )
{
@ -920,7 +917,6 @@ dict_loadFromStream( DictionaryCtxt* dict, XWEnv xwe, XWStreamCtxt* stream )
}
setBlankTile( dict );
} /* dict_loadFromStream */
#endif
#ifdef TEXT_MODEL
/* Return the strlen of the longest face, e.g. 1 for English and Italian;

View file

@ -173,11 +173,9 @@ game_makeNewGame( MPFORMAL XWEnv xwe, XWGame* game, CurGameInfo* gi,
)
{
XP_ASSERT( gi == util->gameInfo ); /* if holds, remove gi param */
#ifndef XWFEATURE_STANDALONE_ONLY
XP_U16 nPlayersHere = 0;
XP_U16 nPlayersTotal = 0;
checkServerRole( gi, &nPlayersHere, &nPlayersTotal );
#endif
assertUtilOK( util );
if ( 0 == gi->gameID ) {
@ -199,7 +197,6 @@ game_makeNewGame( MPFORMAL XWEnv xwe, XWGame* game, CurGameInfo* gi,
model_setDictionary( game->model, xwe, dict );
model_setPlayerDicts( game->model, xwe, &playerDicts );
#ifndef XWFEATURE_STANDALONE_ONLY
if ( gi->serverRole != SERVER_STANDALONE ) {
game->comms = comms_make( MPPARM(mpool) xwe, util,
gi->serverRole != SERVER_ISCLIENT,
@ -215,13 +212,8 @@ game_makeNewGame( MPFORMAL XWEnv xwe, XWGame* game, CurGameInfo* gi,
}
#endif
game->server = server_make( MPPARM(mpool) xwe, game->model,
#ifndef XWFEATURE_STANDALONE_ONLY
game->comms,
#else
(CommsCtxt*)NULL,
#endif
util );
game->board = board_make( MPPARM(mpool) xwe, game->model, game->server,
NULL, util );
@ -307,9 +299,7 @@ game_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream,
{
XP_ASSERT( NULL == util || gi == util->gameInfo );
XP_Bool success = XP_FALSE;
#ifndef XWFEATURE_STANDALONE_ONLY
XP_Bool hasComms;
#endif
XP_U8 strVersion = stream_getU8( stream );
XP_LOGFF( "strVersion = 0x%x", (XP_U16)strVersion );
@ -458,9 +448,6 @@ game_saveToStream( const XWGame* game, const CurGameInfo* gi,
XP_U8 flags = NULL == game->comms ? 0 : FLAG_HASCOMMS;
stream_putU8( stream, flags );
#ifdef XWFEATURE_STANDALONE_ONLY
XP_ASSERT( !game->comms );
#endif
if ( NULL != game->comms ) {
comms_writeToStream( game->comms, stream, saveToken );
}
@ -590,7 +577,6 @@ game_dispose( XWGame* game, XWEnv xwe )
game->board = NULL;
}
#ifndef XWFEATURE_STANDALONE_ONLY
if ( !!game->comms ) {
comms_stop( game->comms
#ifdef XWFEATURE_RELAY
@ -600,7 +586,6 @@ game_dispose( XWGame* game, XWEnv xwe )
comms_destroy( game->comms, xwe );
game->comms = NULL;
}
#endif
if ( !!game->model ) {
model_destroy( game->model, xwe );
game->model = NULL;

View file

@ -72,9 +72,7 @@ typedef struct _XWGame {
BoardCtxt* board;
ModelCtxt* model;
ServerCtxt* server;
#ifndef XWFEATURE_STANDALONE_ONLY
CommsCtxt* comms;
#endif
XP_U32 created; /* dutil_getCurSeconds() of creation */
} XWGame;

View file

@ -50,9 +50,7 @@ struct NewGameCtx {
XP_Bool isNewGame;
XP_Bool changedNPlayers;
XP_TriEnable juggleEnabled;
#ifndef XWFEATURE_STANDALONE_ONLY
XP_TriEnable settingsEnabled;
#endif
XP_Bool duplicateEnabled;
MPSLOT
@ -67,12 +65,8 @@ static void considerEnable( NewGameCtx* ngc );
static void storePlayer( NewGameCtx* ngc, XP_U16 player, LocalPlayer* lp );
static void loadPlayer( NewGameCtx* ngc, XP_U16 player,
const LocalPlayer* lp );
#ifndef XWFEATURE_STANDALONE_ONLY
static XP_Bool changeRole( NewGameCtx* ngc, XWEnv xwe, DeviceRole role );
static XP_Bool checkConsistent( NewGameCtx* ngc, XWEnv xwe, XP_Bool warnUser );
#else
# define checkConsistent( ngc, xwe, warnUser ) XP_TRUE
#endif
NewGameCtx*
newg_make( MPFORMAL XP_Bool isNewGame,
@ -125,22 +119,18 @@ newg_load( NewGameCtx* ngc, XWEnv xwe, const CurGameInfo* gi )
ngc->role = role = gi->serverRole;
localOnly = (role == SERVER_ISCLIENT) && ngc->isNewGame;
#ifndef XWFEATURE_STANDALONE_ONLY
value.ng_role = role;
(*ngc->setAttrProc)( closure, NG_ATTR_ROLE, value );
(*ngc->enableAttrProc)( closure, NG_ATTR_ROLE, ngc->isNewGame?
TRI_ENAB_ENABLED : TRI_ENAB_DISABLED );
#endif
nPlayers = gi->nPlayers;
ngc->nPlayersTotal = nPlayers;
#ifndef XWFEATURE_STANDALONE_ONLY
for ( ii = nPlayers - 1; ii >= 0; --ii ) {
if ( gi->players[ii].isLocal ) {
++ngc->nLocalPlayers;
}
}
#endif
if ( localOnly ) {
nPlayers = ngc->nLocalPlayers;
}
@ -202,11 +192,9 @@ cpToLP( NGValue value, const void* cbClosure )
XP_UCHAR** strAddr = NULL;
switch ( cpcl->col ) {
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_COL_REMOTE:
lp->isLocal = !value.ng_bool;
break;
#endif
case NG_COL_NAME:
strAddr = &lp->name;
break;
@ -227,18 +215,15 @@ cpToLP( NGValue value, const void* cbClosure )
} /* cpToLP */
XP_Bool
newg_store( NewGameCtx* ngc, XWEnv xwe, CurGameInfo* gi,
XP_Bool XP_UNUSED_STANDALONE(warn) )
newg_store( NewGameCtx* ngc, XWEnv xwe, CurGameInfo* gi, XP_Bool warn )
{
XP_Bool consistent = checkConsistent( ngc, xwe, warn );
if ( consistent ) {
XP_Bool makeLocal = XP_FALSE;
gi->nPlayers = ngc->nPlayersShown;
#ifndef XWFEATURE_STANDALONE_ONLY
gi->serverRole = ngc->role;
makeLocal = ngc->role != SERVER_ISHOST;
#endif
gi->gameSeconds = ngc->timerSeconds;
gi->timerEnabled = gi->gameSeconds > 0;
@ -280,11 +265,9 @@ newg_attrChanged( NewGameCtx* ngc, XWEnv xwe,
changed = XP_TRUE;
}
break;
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_ATTR_ROLE:
changed = changeRole( ngc, xwe, value.ng_role );
break;
#endif
case NG_ATTR_TIMER:
ngc->timerSeconds = value.ng_u16;
break;
@ -313,9 +296,7 @@ deepCopy( NGValue value, const void* closure )
DeepValue* dvp = (DeepValue*)closure;
switch ( dvp->col ) {
case NG_COL_ROBOT:
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_COL_REMOTE:
#endif
dvp->value.ng_bool = value.ng_bool;
break;
case NG_COL_NAME:
@ -372,7 +353,6 @@ newg_juggle( NewGameCtx* ngc )
return changed;
} /* newg_juggle */
#ifndef XWFEATURE_STANDALONE_ONLY
static XP_Bool
checkConsistent( NewGameCtx* ngc, XWEnv xwe, XP_Bool warnUser )
{
@ -398,7 +378,6 @@ checkConsistent( NewGameCtx* ngc, XWEnv xwe, XP_Bool warnUser )
return consistent;
} /* checkConsistent */
#endif
static void
enableOne( NewGameCtx* ngc, XP_U16 player, NewGameColumn col,
@ -438,7 +417,6 @@ adjustOneRow( NewGameCtx* ngc, XP_U16 player, XP_Bool force )
if ( player >= ngc->nPlayersShown ) {
/* do nothing: all are hidden above */
} else {
#ifndef XWFEATURE_STANDALONE_ONLY
/* If standalone or client, remote is hidden. If server but not
new game, it's disabled */
if ( (role == SERVER_ISHOST )
@ -453,7 +431,6 @@ adjustOneRow( NewGameCtx* ngc, XP_U16 player, XP_Bool force )
deepCopy, &dValue );
isLocal = !dValue.value.ng_bool;
}
#endif
/* If remote is enabled and set, then if it's a new game all else is
hidden. But if it's not a new game, they're disabled. Password is
@ -510,7 +487,6 @@ adjustOneRow( NewGameCtx* ngc, XP_U16 player, XP_Bool force )
* the most common case, which is playing again with the same players. In
* that case changing role then back again should not lose/change data.
*/
#ifndef XWFEATURE_STANDALONE_ONLY
static XP_Bool
changeRole( NewGameCtx* ngc, XWEnv xwe, DeviceRole newRole )
{
@ -534,7 +510,6 @@ changeRole( NewGameCtx* ngc, XWEnv xwe, DeviceRole newRole )
}
return changing;
}
#endif
static void
setRoleStrings( NewGameCtx* ngc, XWEnv xwe )
@ -545,19 +520,14 @@ setRoleStrings( NewGameCtx* ngc, XWEnv xwe )
/* Tell client to set/change players label text, and also to add remote
checkbox column header if required. */
#ifndef XWFEATURE_STANDALONE_ONLY
(*ngc->enableAttrProc)( closure, NG_ATTR_REMHEADER,
( (ngc->role == SERVER_ISHOST)
|| (!ngc->isNewGame
&& (ngc->role != SERVER_STANDALONE)) )?
TRI_ENAB_ENABLED : TRI_ENAB_HIDDEN );
#endif
if ( 0 ) {
#ifndef XWFEATURE_STANDALONE_ONLY
} else if ( ngc->role == SERVER_ISCLIENT && ngc->isNewGame ) {
if ( ngc->role == SERVER_ISCLIENT && ngc->isNewGame ) {
strID = STR_LOCALPLAYERS;
#endif
} else {
strID = STR_TOTALPLAYERS;
}
@ -579,7 +549,6 @@ considerEnable( NewGameCtx* ngc )
ngc->juggleEnabled = newEnable;
}
#ifndef XWFEATURE_STANDALONE_ONLY
newEnable = (ngc->role == SERVER_STANDALONE)?
TRI_ENAB_HIDDEN : TRI_ENAB_ENABLED;
@ -587,7 +556,6 @@ considerEnable( NewGameCtx* ngc )
ngc->settingsEnabled = newEnable;
(*ngc->enableAttrProc)( ngc->closure, NG_ATTR_CANCONFIG, newEnable );
}
#endif
} /* considerEnable */
static void
@ -611,10 +579,8 @@ loadPlayer( NewGameCtx* ngc, XP_U16 player, const LocalPlayer* lp )
NGValue value;
void* closure = ngc->closure;
#ifndef XWFEATURE_STANDALONE_ONLY
value.ng_bool = !lp->isLocal;
(*ngc->setColProc)(closure, player, NG_COL_REMOTE, value );
#endif
value.ng_cp = lp->name;
(*ngc->setColProc)(closure, player, NG_COL_NAME, value );

View file

@ -43,25 +43,21 @@ typedef struct NewGameCtx NewGameCtx;
typedef enum {
#ifndef XWFEATURE_STANDALONE_ONLY
NG_COL_REMOTE,
#endif
NG_COL_NAME
,NG_COL_ROBOT
,NG_COL_PASSWD
} NewGameColumn;
typedef enum {
#ifndef XWFEATURE_STANDALONE_ONLY
NG_ATTR_ROLE,
NG_ATTR_CANCONFIG,
NG_ATTR_REMHEADER,
#endif
NG_ATTR_NPLAYERS
,NG_ATTR_NPLAYHEADER
,NG_ATTR_CANJUGGLE
,NG_ATTR_TIMER
,NG_ATTR_DUPLICATE
NG_ATTR_NPLAYERS,
NG_ATTR_NPLAYHEADER,
NG_ATTR_CANJUGGLE,
NG_ATTR_TIMER,
NG_ATTR_DUPLICATE,
} NewGameAttr;
typedef union NGValue {

View file

@ -259,7 +259,6 @@ static void dupe_resetTimer( ServerCtxt* server, XWEnv xwe );
static XP_Bool setDupCheckTimer( ServerCtxt* server, XWEnv xwe );
static void sortTilesIf( ServerCtxt* server, XP_S16 turn );
#ifndef XWFEATURE_STANDALONE_ONLY
static XWStreamCtxt* messageStreamWithHeader( ServerCtxt* server, XWEnv xwe,
XP_U16 devIndex, XW_Proto code );
static XP_Bool handleRegistrationMsg( ServerCtxt* server, XWEnv xwe,
@ -295,12 +294,11 @@ static void log_ri( const ServerCtxt* server, const RematchInfo* rip,
# define assertRI(r, s)
#endif
#endif
#define PICK_NEXT -1
#define PICK_CUR -2
#if defined DEBUG && ! defined XWFEATURE_STANDALONE_ONLY
#ifdef DEBUG
static char*
getStateStr( XW_State st )
{
@ -355,7 +353,6 @@ inDuplicateMode( const ServerCtxt* server )
/*****************************************************************************
*
****************************************************************************/
#ifndef XWFEATURE_STANDALONE_ONLY
static void
syncPlayers( ServerCtxt* server )
{
@ -369,9 +366,6 @@ syncPlayers( ServerCtxt* server )
player->deviceIndex = lp->isLocal? HOST_DEVICE : UNKNOWN_DEVICE;
}
}
#else
# define syncPlayers( server )
#endif
static XP_Bool
amHost( const ServerCtxt* server )
@ -392,10 +386,8 @@ initServer( ServerCtxt* server, XWEnv xwe )
setTurn( server, xwe, -1 ); /* game isn't under way yet */
if ( 0 ) {
#ifndef XWFEATURE_STANDALONE_ONLY
} else if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
SETSTATE( server, XWSTATE_NONE );
#endif
} else {
SETSTATE( server, XWSTATE_BEGIN );
}
@ -829,7 +821,6 @@ server_countTilesInPool( ServerCtxt* server )
*/
#define NAME_LEN_NBITS 6
#define MAX_NAME_LEN ((1<<(NAME_LEN_NBITS-1))-1)
#ifndef XWFEATURE_STANDALONE_ONLY
/* addMQTTDevID() and readMQTTDevID() exist to work around the case where
folks start games using agreed-upon relay room names rather than
@ -1061,7 +1052,6 @@ server_initClientConnection( ServerCtxt* server, XWEnv xwe )
SRVR_LOGFF( "=>%s", boolToStr(result) );
return result;
} /* server_initClientConnection */
#endif
#ifdef XWFEATURE_CHAT
static void
@ -1140,7 +1130,6 @@ callDupTimerListener( const ServerCtxt* server, XWEnv xwe, XP_S32 oldVal, XP_S32
}
}
#ifndef XWFEATURE_STANDALONE_ONLY
# ifdef STREAM_VERS_BIGBOARD
static void
setStreamVersion( ServerCtxt* server )
@ -1592,8 +1581,6 @@ dupe_handleServerTrade( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
return XP_TRUE;
}
#endif
/* Just for grins....trade in all the tiles that weren't used in the
* move the robot manage to make. This is not meant to be strategy, but
* rather to force me to make the trade-communication stuff work well.
@ -1965,14 +1952,11 @@ server_do( ServerCtxt* server, XWEnv xwe )
case XWSTATE_NEEDSEND_BADWORD_INFO:
XP_ASSERT( server->vol.gi->serverRole == SERVER_ISHOST );
badWordMoveUndoAndTellUser( server, xwe, &server->illegalWordInfo );
#ifndef XWFEATURE_STANDALONE_ONLY
sendBadWordMsgs( server, xwe );
#endif
nextTurn( server, xwe, PICK_NEXT );
//moreToDo = XP_TRUE; /* why? */
break;
#ifndef XWFEATURE_STANDALONE_ONLY
case XWSTATE_RECEIVED_ALL_REG:
sendInitialMessage( server, xwe );
/* PENDING isn't INTURN_OFFDEVICE possible too? Or just
@ -1988,8 +1972,6 @@ server_do( ServerCtxt* server, XWEnv xwe )
nextTurn( server, xwe, PICK_NEXT );
break;
#endif /* XWFEATURE_STANDALONE_ONLY */
case XWSTATE_NEEDSEND_ENDGAME:
endGameInternal( server, xwe, END_REASON_OUT_OF_TILES, -1 );
break;
@ -2030,8 +2012,6 @@ server_do( ServerCtxt* server, XWEnv xwe )
return result;
} /* server_do */
#ifndef XWFEATURE_STANDALONE_ONLY
static XP_S8
getIndexForStream( const ServerCtxt* server, const XWStreamCtxt* stream )
{
@ -2175,7 +2155,6 @@ registerRemotePlayer( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
}
return deviceIndex;
} /* registerRemotePlayer */
#endif
static void
sortTilesIf( ServerCtxt* server, XP_S16 turn )
@ -2185,7 +2164,6 @@ sortTilesIf( ServerCtxt* server, XP_S16 turn )
}
}
#ifndef XWFEATURE_STANDALONE_ONLY
/* 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.
@ -2332,7 +2310,6 @@ client_readInitialMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
}
return accepted;
} /* client_readInitialMessage */
#endif
/* For each remote device, send a message containing the dictionary and the
* names of all the players in the game (including those on the device itself,
@ -2439,7 +2416,6 @@ freeBWI( MPFORMAL BadWordInfo* bwi )
bwi->nWords = 0;
} /* freeBWI */
#ifndef XWFEATURE_STANDALONE_ONLY
static void
bwiToStream( XWStreamCtxt* stream, BadWordInfo* bwi )
{
@ -2559,7 +2535,6 @@ sendBadWordMsgs( ServerCtxt* server, XWEnv xwe )
}
SETSTATE( server, XWSTATE_INTURN );
} /* sendBadWordMsgs */
#endif
static void
badWordMoveUndoAndTellUser( ServerCtxt* server, XWEnv xwe, BadWordInfo* bwi )
@ -2937,7 +2912,6 @@ assignTilesToAll( ServerCtxt* server, XWEnv xwe )
return allDone;
} /* assignTilesToAll */
#ifndef XWFEATURE_STANDALONE_ONLY
static void
getPlayerTime( ServerCtxt* server, XWStreamCtxt* stream, XP_U16 turn )
{
@ -2949,7 +2923,6 @@ getPlayerTime( ServerCtxt* server, XWStreamCtxt* stream, XP_U16 turn )
gi->players[turn].secondsUsed = secondsUsed;
}
} /* getPlayerTime */
#endif
static void
nextTurn( ServerCtxt* server, XWEnv xwe, XP_S16 nxtTurn )
@ -3088,7 +3061,6 @@ checkMoveAllowed( ServerCtxt* server, XWEnv xwe, XP_U16 playerNum )
return server->illegalWordInfo.nWords == 0;
} /* checkMoveAllowed */
#ifndef XWFEATURE_STANDALONE_ONLY
static void
sendMoveTo( ServerCtxt* server, XWEnv xwe, XP_U16 devIndex, XP_U16 turn,
XP_Bool legal, TrayTileSet* newTiles,
@ -3404,7 +3376,6 @@ reflectMove( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
}
return moveOk;
} /* reflectMove */
#endif /* XWFEATURE_STANDALONE_ONLY */
static void
dupe_chooseMove( const ServerCtxt* server, XWEnv xwe, XP_U16 nPlayers,
@ -4005,7 +3976,6 @@ finishMove( ServerCtxt* server, XWEnv xwe, TrayTileSet* newTiles, XP_U16 turn )
XP_Bool isClient = gi->serverRole == SERVER_ISCLIENT;
XP_Bool isLegalMove = XP_TRUE;
#ifndef XWFEATURE_STANDALONE_ONLY
if ( isClient ) {
/* just send to host */
sendMoveTo( server, xwe, HOST_DEVICE, turn, XP_TRUE, newTiles,
@ -4015,9 +3985,6 @@ finishMove( ServerCtxt* server, XWEnv xwe, TrayTileSet* newTiles, XP_U16 turn )
sendMoveToClientsExcept( server, xwe, turn, isLegalMove, newTiles,
(TrayTileSet*)NULL, HOST_DEVICE );
}
#else
isLegalMove = checkMoveAllowed( server, xwe, turn );
#endif
model_commitTurn( model, xwe, turn, newTiles );
sortTilesIf( server, turn );
@ -4031,12 +3998,10 @@ finishMove( ServerCtxt* server, XWEnv xwe, TrayTileSet* newTiles, XP_U16 turn )
}
if ( 0 ) {
#ifndef XWFEATURE_STANDALONE_ONLY
} else if (isClient && (gi->phoniesAction == PHONIES_DISALLOW)
&& nTilesMoved > 0 ) {
SETSTATE( server, XWSTATE_MOVE_CONFIRM_WAIT );
setTurn( server, xwe, -1 );
#endif
} else {
nextTurn( server, xwe, PICK_NEXT );
}
@ -4056,7 +4021,6 @@ server_commitTrade( ServerCtxt* server, XWEnv xwe, const TrayTileSet* oldTiles,
fetchTiles( server, xwe, turn, oldTiles->nTiles, oldTiles, &newTiles, XP_FALSE );
#ifndef XWFEATURE_STANDALONE_ONLY
if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
/* just send to server */
sendMoveTo(server, xwe, HOST_DEVICE, turn, XP_TRUE, &newTiles, oldTiles);
@ -4064,7 +4028,6 @@ server_commitTrade( ServerCtxt* server, XWEnv xwe, const TrayTileSet* oldTiles,
sendMoveToClientsExcept( server, xwe, turn, XP_TRUE, &newTiles, oldTiles,
HOST_DEVICE );
}
#endif
pool_replaceTiles( server->pool, oldTiles );
XP_ASSERT( turn == server->nv.currentTurn );
@ -4748,7 +4711,6 @@ endGameInternal( ServerCtxt* server, XWEnv xwe, GameEndReason XP_UNUSED(why),
if ( server->vol.gi->serverRole != SERVER_ISCLIENT ) {
#ifndef XWFEATURE_STANDALONE_ONLY
XP_U16 devIndex;
for ( devIndex = 1; devIndex < server->nv.nDevices; ++devIndex ) {
XWStreamCtxt* stream;
@ -4757,10 +4719,8 @@ endGameInternal( ServerCtxt* server, XWEnv xwe, GameEndReason XP_UNUSED(why),
putQuitter( server, stream, quitter );
stream_destroy( stream );
}
#endif
doEndGame( server, xwe, quitter );
#ifndef XWFEATURE_STANDALONE_ONLY
} else {
XWStreamCtxt* stream;
stream = messageStreamWithHeader( server, xwe, HOST_DEVICE,
@ -4769,7 +4729,6 @@ endGameInternal( ServerCtxt* server, XWEnv xwe, GameEndReason XP_UNUSED(why),
stream_destroy( stream );
/* Do I want to change the state I'm in? I don't think so.... */
#endif
}
} /* endGameInternal */
@ -4832,7 +4791,6 @@ setTurn( ServerCtxt* server, XWEnv xwe, XP_S16 turn )
}
}
#ifndef XWFEATURE_STANDALONE_ONLY
static void
tellMoveWasLegal( ServerCtxt* server, XWEnv xwe )
{
@ -4953,7 +4911,6 @@ reflectUndos( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream, XW_Proto code
LOG_RETURNF( "%s", boolToStr(success) );
return success;
} /* reflectUndos */
#endif
XP_Bool
server_handleUndo( ServerCtxt* server, XWEnv xwe, XP_U16 limit )
@ -4993,7 +4950,6 @@ server_handleUndo( ServerCtxt* server, XWEnv xwe, XP_U16 limit )
result = nUndone > 0 ;
if ( result ) {
XP_U32 newHash = model_getHash( model );
#ifndef XWFEATURE_STANDALONE_ONLY
XP_ASSERT( lastUndone != 0xFFFF );
SRVR_LOGFF( "popped to hash %X", newHash );
if ( server->vol.gi->serverRole == SERVER_ISCLIENT ) {
@ -5002,7 +4958,6 @@ server_handleUndo( ServerCtxt* server, XWEnv xwe, XP_U16 limit )
sendUndoToClientsExcept( server, xwe, HOST_DEVICE, nUndone,
lastUndone, newHash );
}
#endif
sortTilesIf( server, lastTurnUndone );
nextTurn( server, xwe, lastTurnUndone );
} else {
@ -5015,7 +4970,6 @@ server_handleUndo( ServerCtxt* server, XWEnv xwe, XP_U16 limit )
return result;
} /* server_handleUndo */
#ifndef XWFEATURE_STANDALONE_ONLY
static void
writeProto( const ServerCtxt* server, XWStreamCtxt* stream, XW_Proto proto )
{
@ -5153,7 +5107,6 @@ server_receiveMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* incoming )
// XP_ASSERT( accepted ); /* do not commit!!! */
return accepted;
} /* server_receiveMessage */
#endif
void
server_formatDictCounts( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream,

View file

@ -122,9 +122,7 @@ XP_Bool server_receiveMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* inco
/* client-side messages. Client (platform code)owns the stream used to talk
* to the server, and passes it in. */
#ifndef XWFEATURE_STANDALONE_ONLY
XP_Bool server_initClientConnection( ServerCtxt* server, XWEnv xwe );
#endif
#ifdef XWFEATURE_CHAT
void server_sendChat( ServerCtxt* server, XWEnv xwe,

View file

@ -56,8 +56,6 @@ endif
DO_GTK = -DPLATFORM_GTK
DO_GTK += -DXWFEATURE_BOARDWORDS
# uncomment for standalone build
# STANDALONE = -DXWFEATURE_STANDALONE_ONLY
UNICODE ?= -DXWFEATURE_UNICODE
ifdef UNICODE

View file

@ -509,8 +509,7 @@ setTransportProcs( TransportProcs* procs, GtkGameGlobals* globals )
procs->countChanged = countChanged_gtk;
}
#ifndef XWFEATURE_STANDALONE_ONLY
# ifdef DEBUG
#ifdef DEBUG
static void
drop_msg_toggle( GtkWidget* toggle, void* data )
{
@ -569,10 +568,9 @@ addDropChecks( GtkGameGlobals* globals )
gtk_widget_show(globals->drop_checks_vbox);
}
}
# else
# define addDropChecks( globals )
# endif /* DEBUG */
#endif
#else
# define addDropChecks( globals )
#endif /* DEBUG */
static void
formatSizeKey( gchar* key, sqlite3_int64 rowid )
@ -610,8 +608,6 @@ saveSizeRowid( GtkGameGlobals* globals )
static void
createOrLoadObjects( GtkGameGlobals* globals )
{
#ifndef XWFEATURE_STANDALONE_ONLY
#endif
CommonGlobals* cGlobals = &globals->cGlobals;
LaunchParams* params = cGlobals->params;
@ -916,7 +912,6 @@ handle_trade_cancel( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
}
}
#ifndef XWFEATURE_STANDALONE_ONLY
static void
handle_resend( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
{
@ -954,7 +949,6 @@ handle_commstats( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
}
} /* handle_commstats */
#endif
#endif
#ifdef MEM_DEBUG
static void
@ -1060,7 +1054,6 @@ makeMenus( GtkGameGlobals* globals )
#endif
fileMenu = makeAddSubmenu( menubar, "Network" );
#ifndef XWFEATURE_STANDALONE_ONLY
(void)createAddItem( fileMenu, "Resend",
(GCallback)handle_resend, globals );
#ifdef XWFEATURE_COMMSACK
@ -1071,7 +1064,6 @@ makeMenus( GtkGameGlobals* globals )
(void)createAddItem( fileMenu, "Stats",
(GCallback)handle_commstats, globals );
# endif
#endif
#ifdef MEM_DEBUG
(void)createAddItem( fileMenu, "Mem stats",
(GCallback)handle_memstats, globals );
@ -2274,7 +2266,6 @@ setupGtkUtilCallbacks( GtkGameGlobals* globals, XW_UtilCtxt* util )
assertTableFull( util->vtable, sizeof(*util->vtable), "gtk util" );
} /* setupGtkUtilCallbacks */
#ifndef XWFEATURE_STANDALONE_ONLY
typedef struct _SockInfo {
GIOChannel* channel;
guint watch;
@ -2341,7 +2332,6 @@ gtk_socket_acceptor( int listener, Acceptor func, CommonGlobals* globals,
*storage = info;
}
} /* gtk_socket_acceptor */
#endif /* #ifndef XWFEATURE_STANDALONE_ONLY */
/* int */
/* board_main( LaunchParams* params ) */
@ -2381,16 +2371,14 @@ initGlobalsNoDraw( GtkGameGlobals* globals, LaunchParams* params,
cGlobals->params = params;
cGlobals->lastNTilesToUse = MAX_TRAY_TILES;
cGlobals->rowid = -1;
#ifndef XWFEATURE_STANDALONE_ONLY
# ifdef XWFEATURE_RELAY
#ifdef XWFEATURE_RELAY
cGlobals->relaySocket = -1;
# endif
#endif
cGlobals->socketAddedClosure = globals;
cGlobals->onSave = gtkOnGameSaved;
cGlobals->onSaveClosure = globals;
cGlobals->addAcceptor = gtk_socket_acceptor;
#endif
cGlobals->cp.showBoardArrow = XP_TRUE;
cGlobals->cp.hideTileValues = params->hideValues;
@ -2486,7 +2474,7 @@ initBoardGlobalsGtk( GtkGameGlobals* globals, LaunchParams* params,
menubar = makeMenus( globals );
gtk_box_pack_start( GTK_BOX(vbox), menubar, FALSE, TRUE, 0);
#if ! defined XWFEATURE_STANDALONE_ONLY && defined DEBUG
#ifdef DEBUG
globals->drop_checks_vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 );
gtk_box_pack_start( GTK_BOX(vbox), globals->drop_checks_vbox,
FALSE, TRUE, 0 );
@ -2625,12 +2613,10 @@ loadGameNoDraw( GtkGameGlobals* globals, LaunchParams* params,
&cGlobals->cp, &cGlobals->procs );
if ( loaded ) {
XP_LOGF( "%s: game loaded", __func__ );
#ifndef XWFEATURE_STANDALONE_ONLY
if ( !!globals->cGlobals.game.comms ) {
comms_resendAll( globals->cGlobals.game.comms, NULL_XWE, COMMS_CONN_NONE,
XP_FALSE );
}
#endif
} else {
game_dispose( &cGlobals->game, NULL_XWE );
}

View file

@ -102,7 +102,7 @@ typedef struct GtkGameGlobals {
GtkWidget* commit_button;
GtkWidget* invite_button;
GtkWidget* buttons_hbox;
#if ! defined XWFEATURE_STANDALONE_ONLY && defined DEBUG
#ifdef DEBUG
GtkWidget* drop_checks_vbox;
#endif
#ifdef XWFEATURE_CHAT
@ -117,10 +117,8 @@ typedef struct GtkGameGlobals {
GtkAdjustment* adjustment;
ClientStreamRec clientRecs[MAX_NUM_PLAYERS];
#ifndef XWFEATURE_STANDALONE_ONLY
XP_U16 netStatLeft, netStatTop;
XP_UCHAR stateChar;
#endif
DropTypeData dropData[COMMS_CONN_NTYPES];

View file

@ -52,11 +52,9 @@ typedef struct GtkNewGameState {
int bingoMin;
gchar* dict;
#ifndef XWFEATURE_STANDALONE_ONLY
GtkWidget* remoteChecks[MAX_NUM_PLAYERS];
GtkWidget* roleCombo;
GtkWidget* settingsButton;
#endif
GtkWidget* robotChecks[MAX_NUM_PLAYERS];
GtkWidget* nameLabels[MAX_NUM_PLAYERS];
GtkWidget* nameFields[MAX_NUM_PLAYERS];
@ -79,7 +77,6 @@ nplayers_menu_changed( GtkComboBox* combo, GtkNewGameState* state )
}
} /* nplayers_menu_changed */
#ifndef XWFEATURE_STANDALONE_ONLY
static void
role_combo_changed( GtkComboBox* combo, gpointer gp )
{
@ -98,12 +95,10 @@ role_combo_changed( GtkComboBox* combo, gpointer gp )
gtk_combo_box_set_active( GTK_COMBO_BOX(combo), state->role );
}
#ifndef XWFEATURE_STANDALONE_ONLY
if ( state->loaded && SERVER_STANDALONE != role ) {
gtkConnsDlg( state->globals, &state->addr, role,
!state->isNewGame );
}
#endif
}
}
@ -121,8 +116,6 @@ handle_settings( GtkWidget* XP_UNUSED(item), GtkNewGameState* state )
gtkConnsDlg( state->globals, &state->addr, state->role, !state->isNewGame );
}
#endif
static void
callChangedWithIndex( GtkNewGameState* state, GtkWidget* item,
GtkWidget** items )
@ -152,13 +145,11 @@ handle_juggle( GtkWidget* XP_UNUSED(item), GtkNewGameState* state )
}
}
#ifndef XWFEATURE_STANDALONE_ONLY
static void
handle_remote_toggled( GtkWidget* item, GtkNewGameState* state )
{
callChangedWithIndex( state, item, state->remoteChecks );
}
#endif
static void
size_combo_changed( GtkComboBox* combo, gpointer gp )
@ -407,17 +398,14 @@ makeNewGameDialog( GtkNewGameState* state )
GtkWidget* dialog;
GtkWidget* vbox;
GtkWidget* hbox;
#ifndef XWFEATURE_STANDALONE_ONLY
GtkWidget* roleCombo;
char* roles[] = { "Standalone", "Host" };
#endif
dialog = gtk_dialog_new();
gtk_window_set_modal( GTK_WINDOW( dialog ), TRUE );
vbox = gtk_box_new( GTK_ORIENTATION_VERTICAL, 0 );
#ifndef XWFEATURE_STANDALONE_ONLY
hbox = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
gtk_box_pack_start( GTK_BOX(hbox), gtk_label_new("Role:"),
FALSE, TRUE, 0 );
@ -438,7 +426,6 @@ makeNewGameDialog( GtkNewGameState* state )
gtk_box_pack_start( GTK_BOX(hbox), state->settingsButton, FALSE, TRUE, 0 );
gtk_box_pack_start( GTK_BOX(vbox), hbox, FALSE, TRUE, 0 );
#endif
/* NPlayers menu */
hbox = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
@ -469,28 +456,22 @@ makeNewGameDialog( GtkNewGameState* state )
for ( int ii = 0; ii < MAX_NUM_PLAYERS; ++ii ) {
GtkWidget* label = gtk_label_new("Name:");
#ifndef XWFEATURE_STANDALONE_ONLY
GtkWidget* remoteCheck = gtk_check_button_new_with_label( "Remote" );
#endif
GtkWidget* nameField = gtk_entry_new();
GtkWidget* passwdField = gtk_entry_new();
gtk_entry_set_max_length( GTK_ENTRY(passwdField), 6 );
GtkWidget* robotCheck = gtk_check_button_new_with_label( "Robot" );
#ifndef XWFEATURE_STANDALONE_ONLY
g_signal_connect( remoteCheck, "toggled",
(GCallback)handle_remote_toggled, state );
#endif
g_signal_connect( robotCheck, "toggled",
(GCallback)handle_robot_toggled, state );
hbox = gtk_box_new( GTK_ORIENTATION_HORIZONTAL, 0 );
#ifndef XWFEATURE_STANDALONE_ONLY
gtk_box_pack_start( GTK_BOX(hbox), remoteCheck, FALSE, TRUE, 0 );
gtk_widget_show( remoteCheck );
state->remoteChecks[ii] = remoteCheck;
#endif
gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, TRUE, 0 );
gtk_widget_show( label );
@ -565,10 +546,8 @@ widgetForCol( const GtkNewGameState* state, XP_U16 player, NewGameColumn col )
widget = state->nameFields[player];
} else if ( col == NG_COL_PASSWD ) {
widget = state->passwdFields[player];
#ifndef XWFEATURE_STANDALONE_ONLY
} else if ( col == NG_COL_REMOTE ) {
widget = state->remoteChecks[player];
#endif
} else if ( col == NG_COL_ROBOT ) {
widget = state->robotChecks[player];
}
@ -611,13 +590,11 @@ gtk_newgame_attr_enable( void* closure, NewGameAttr attr, XP_TriEnable enable )
GtkWidget* widget = NULL;
if ( attr == NG_ATTR_NPLAYERS ) {
widget = state->nPlayersCombo;
#ifndef XWFEATURE_STANDALONE_ONLY
} else if ( attr == NG_ATTR_CANCONFIG ) {
widget = state->settingsButton;
} else if ( attr == NG_ATTR_ROLE ) {
/* NG_ATTR_ROLE always enabled */
/* widget = state->roleCombo; */
#endif
} else if ( attr == NG_ATTR_CANJUGGLE ) {
widget = state->juggleButton;
}
@ -652,9 +629,7 @@ gtk_newgame_col_set( void* closure, XP_U16 player, NewGameColumn col,
gtk_entry_set_text( GTK_ENTRY(widget), cp );
break;
}
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_COL_REMOTE:
#endif
case NG_COL_ROBOT:
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(widget),
value.ng_bool );
@ -671,9 +646,7 @@ gtk_newgame_col_get( void* closure, XP_U16 player, NewGameColumn col,
GtkWidget* widget = widgetForCol( state, player, col );
switch ( col ) {
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_COL_REMOTE:
#endif
case NG_COL_ROBOT:
value.ng_bool =
gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget));
@ -698,7 +671,6 @@ gtk_newgame_attr_set( void* closure, NewGameAttr attr, NGValue value )
gtk_combo_box_set_active( GTK_COMBO_BOX(state->nPlayersCombo), ii-1 );
}
break;
#ifndef XWFEATURE_STANDALONE_ONLY
case NG_ATTR_ROLE:
gtk_combo_box_set_active( GTK_COMBO_BOX(state->roleCombo),
value.ng_role );
@ -706,7 +678,6 @@ gtk_newgame_attr_set( void* closure, NewGameAttr attr, NGValue value )
case NG_ATTR_REMHEADER:
/* ignored on GTK: no headers at all */
break;
#endif
case NG_ATTR_NPLAYHEADER:
gtk_label_set_text( GTK_LABEL(state->nPlayersLabel), value.ng_cp );
break;

View file

@ -342,12 +342,10 @@ linux_dutil_getUserString( XW_DUtilCtxt* XP_UNUSED(uc),
return (XP_UCHAR*)"The robot \"%s\" moved:\n";
case STRS_REMOTE_MOVED:
return (XP_UCHAR*)"Remote player \"%s\" moved:\n";
#ifndef XWFEATURE_STANDALONE_ONLY
case STR_LOCALPLAYERS:
return (XP_UCHAR*)"Local players";
case STR_REMOTE:
return (XP_UCHAR*)"Remote";
#endif
case STR_TOTALPLAYERS:
return (XP_UCHAR*)"Total players";

View file

@ -223,19 +223,15 @@ linuxOpenGame( CommonGlobals* cGlobals )
}
if ( opened ) {
#ifndef XWFEATURE_STANDALONE_ONLY
DeviceRole serverRole = cGlobals->gi->serverRole;
XP_LOGF( "%s(): server role: %d", __func__, serverRole );
if ( /*!!returnAddrP && */serverRole == SERVER_ISCLIENT ) {
tryConnectToServer( cGlobals );
}
#endif
#ifndef XWFEATURE_STANDALONE_ONLY
if ( !!cGlobals->game.comms ) {
comms_start( cGlobals->game.comms, NULL_XWE );
}
#endif
server_do( cGlobals->game.server, NULL_XWE );
linuxSaveGame( cGlobals ); /* again, to include address etc. */
@ -2222,7 +2218,6 @@ score_timer_func( gpointer data )
return XP_FALSE;
} /* score_timer_func */
#ifndef XWFEATURE_STANDALONE_ONLY
static gint
comms_timer_func( gpointer data )
{
@ -2234,7 +2229,6 @@ comms_timer_func( gpointer data )
return (gint)0;
}
#endif
static gint
pen_timer_func( gpointer data )
@ -2264,8 +2258,7 @@ slowrob_timer_func( gpointer data )
static void
linux_util_setTimer( XW_UtilCtxt* uc, XWEnv XP_UNUSED(xwe), XWTimerReason why,
XP_U16 XP_UNUSED_STANDALONE(when),
XWTimerProc proc, void* closure )
XP_U16 when, XWTimerProc proc, void* closure )
{
CommonGlobals* cGlobals = (CommonGlobals*)uc->closure;
guint newSrc;
@ -2292,11 +2285,9 @@ linux_util_setTimer( XW_UtilCtxt* uc, XWEnv XP_UNUSED(xwe), XWTimerReason why,
newSrc = g_timeout_add( 1000 * when, dup_timer_func, cGlobals );
break;
#ifndef XWFEATURE_STANDALONE_ONLY
case TIMER_COMMS:
newSrc = g_timeout_add( 1000 * when, comms_timer_func, cGlobals );
break;
#endif
#ifdef XWFEATURE_SLOW_ROBOT
case TIMER_SLOWROBOT:
newSrc = g_timeout_add( 1000 * when, slowrob_timer_func, cGlobals );
@ -2419,11 +2410,6 @@ initParams( LaunchParams* params )
params->dictMgr = dmgr_make( MPPARM_NOCOMMA(params->mpool) );
// linux_util_vt_init( MPPARM(params->mpool) params->util );
#ifndef XWFEATURE_STANDALONE_ONLY
/* params->util->vtable->m_util_informMissing = linux_util_informMissing; */
/* params->util->vtable->m_util_addrChange = linux_util_addrChange; */
/* params->util->vtable->m_util_setIsServer = linux_util_setIsServer; */
#endif
params->dutil = linux_dutils_init( MPPARM(params->mpool) params->vtMgr, params );
}

View file

@ -206,7 +206,6 @@ linux_getErrString( UtilErrID id, XP_Bool* silent )
message = "No peeking at the robot's tiles!";
break;
#ifndef XWFEATURE_STANDALONE_ONLY
case ERR_NO_PEEK_REMOTE_TILES:
message = "No peeking at remote players' tiles!";
break;
@ -221,7 +220,6 @@ linux_getErrString( UtilErrID id, XP_Bool* silent )
message = "At least one player must be marked remote for a game "
"started as Host.";
break;
#endif
case ERR_NO_EMPTY_TRADE:
message = "No tiles selected; trade cancelled.";