From e60d338488e09dde4849d0239ecde450a02c9849 Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 31 May 2008 03:26:16 +0000 Subject: [PATCH] Remove all tabs. No code changes. --- common/board.c | 54 ++++++++++++++++---------------- common/board.h | 2 +- common/boardp.h | 26 ++++++++-------- common/commmgr.h | 2 +- common/comms.c | 10 +++--- common/comtypes.h | 2 +- common/dawg.h | 4 +-- common/dictnry.c | 56 ++++++++++++++++----------------- common/dictnry.h | 8 ++--- common/draw.c | 2 +- common/draw.h | 2 +- common/engine.c | 32 +++++++++---------- common/engine.h | 2 +- common/game.c | 4 +-- common/game.h | 4 +-- common/mempool.c | 4 +-- common/model.c | 20 ++++++------ common/model.h | 18 +++++------ common/modelp.h | 8 ++--- common/movestak.c | 4 +-- common/movestak.h | 4 +-- common/mscore.c | 27 +++++++--------- common/pool.c | 6 ++-- common/pool.h | 2 +- common/scorebdp.c | 4 +-- common/server.c | 79 ++++++++++++++++++++++++----------------------- common/server.h | 4 +-- common/states.h | 8 ++--- common/strutils.h | 2 +- common/tray.c | 6 ++-- common/util.h | 6 ++-- common/virtuals.h | 2 +- common/vtabmgr.c | 8 ++--- common/xwproto.h | 26 ++++++++-------- common/xwstream.h | 2 +- 35 files changed, 221 insertions(+), 229 deletions(-) diff --git a/common/board.c b/common/board.c index 175e7e8df..921bc500e 100644 --- a/common/board.c +++ b/common/board.c @@ -51,12 +51,12 @@ #include "scorebdp.h" #include "game.h" #include "server.h" -#include "comms.h" /* for CHANNEL_NONE */ +#include "comms.h" /* for CHANNEL_NONE */ #include "dictnry.h" #include "draw.h" #include "engine.h" #include "util.h" -#include "mempool.h" /* debug only */ +#include "mempool.h" /* debug only */ #include "memstream.h" #include "strutils.h" #include "LocalizedStrIncludes.h" @@ -149,7 +149,7 @@ board_make( MPFORMAL ModelCtxt* model, ServerCtxt* server, DrawCtx* draw, XP_ASSERT( !!model ); if ( result != NULL ) { - + XP_MEMSET( result, 0, sizeof( *result ) ); MPASSIGN(result->mpool, mpool); @@ -359,8 +359,8 @@ board_setPos( BoardCtxt* board, XP_U16 left, XP_U16 top, void board_setTimerLoc( BoardCtxt* board, - XP_U16 timerLeft, XP_U16 timerTop, - XP_U16 timerWidth, XP_U16 timerHeight ) + XP_U16 timerLeft, XP_U16 timerTop, + XP_U16 timerWidth, XP_U16 timerHeight ) { board->timerBounds.left = timerLeft; board->timerBounds.top = timerTop; @@ -576,8 +576,8 @@ board_commitTurn( BoardCtxt* board ) } } else if ( checkRevealTray( board ) ) { if ( board->tradeInProgress[turn] ) { - result = XP_TRUE; /* there's at least the window to clean up - after */ + result = XP_TRUE; /* there's at least the window to clean up + after */ invalSelTradeWindow( board ); board->tradeInProgress[turn] = XP_FALSE; @@ -586,7 +586,7 @@ board_commitTurn( BoardCtxt* board ) (XWStreamCtxt*)NULL ) ) { result = server_commitTrade( board->server, board->traySelBits[turn] ); - /* XP_DEBUGF( "server_commitTrade returned %d\n", result ); */ + /* XP_DEBUGF( "server_commitTrade returned %d\n", result ); */ } board->traySelBits[turn] = 0x00; } else { @@ -699,7 +699,7 @@ selectPlayerImpl( BoardCtxt* board, XP_U16 newPlayer, XP_Bool reveal ) setTrayVisState( board, TRAY_REVERSED ); } - board->scoreBoardInvalid = XP_TRUE; /* if only one player, number of + board->scoreBoardInvalid = XP_TRUE; /* if only one player, number of tiles remaining may have changed*/ } /* selectPlayerImpl */ @@ -1244,8 +1244,8 @@ drawBoard( BoardCtxt* board ) BlankQueue bq; XP_Rect arrowRect; - scrollIfCan( board ); /* this must happen before we count blanks - since it invalidates squares */ + scrollIfCan( board ); /* this must happen before we count blanks + since it invalidates squares */ /* This is freaking expensive!!!! PENDING FIXME Can't we start from what's invalid rather than scanning the entire model every time @@ -1466,7 +1466,7 @@ chooseBestSelPlayer( BoardCtxt* board ) for ( i = 0; i < nPlayers; ++i ) { LocalPlayer* lp = &board->gi->players[curTurn]; - + if ( !lp->isRobot && lp->isLocal ) { return curTurn; } @@ -1670,7 +1670,7 @@ board_requestHint( BoardCtxt* board, XP_Bool searchComplete = XP_TRUE; XP_Bool redraw = XP_FALSE; - *workRemainsP = XP_FALSE; /* in case we exit without calling engine */ + *workRemainsP = XP_FALSE; /* in case we exit without calling engine */ selPlayer = board->selPlayer; engine = server_getEngineFor( board->server, selPlayer ); @@ -2219,12 +2219,12 @@ askRevealTray( BoardCtxt* board ) justReverse = XP_TRUE; } } else { - revealed = !player_hasPasswd( lp ); + revealed = !player_hasPasswd( lp ); - if ( !revealed ) { - const XP_UCHAR* name = emptyStringIfNull(lp->name); + if ( !revealed ) { + const XP_UCHAR* name = emptyStringIfNull(lp->name); - /* repeat until player gets passwd right or hits cancel */ + /* repeat until player gets passwd right or hits cancel */ for ( ; ; ) { XP_UCHAR buf[16]; XP_U16 buflen = sizeof(buf); @@ -2236,10 +2236,10 @@ askRevealTray( BoardCtxt* board ) revealed = XP_TRUE; break; } - } - } - } - } + } + } + } + } if ( revealed ) { setTrayVisState( board, TRAY_REVEALED ); @@ -2320,7 +2320,7 @@ board_handlePenDown( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool* handled ) } *handled = penDidSomething; - return result; /* no redraw needed */ + return result; /* no redraw needed */ } /* board_handlePenDown */ #endif @@ -2393,7 +2393,7 @@ tryMoveArrow( BoardCtxt* board, XP_U16 col, XP_U16 row ) board->trayVisState == TRAY_REVEALED ) ) { BoardArrow* arrow = &board->boardArrow[board->selPlayer]; - + if ( arrow->visible && arrow->col == col && arrow->row == row ) { /* change it; if vertical, hide; else if horizontal make vertical */ @@ -2886,7 +2886,7 @@ advanceArrow( BoardCtxt* board ) { XP_Key key = board->boardArrow[board->selPlayer].vert ? XP_CURSOR_KEY_DOWN : XP_CURSOR_KEY_RIGHT; - + XP_ASSERT( board->trayVisState == TRAY_REVEALED ); return board_moveArrow( board, key ); @@ -2913,7 +2913,7 @@ figureNextLoc( BoardCtxt* board, XP_Key cursorKey, numCols = model_numCols( board->model ); switch ( cursorKey ) { - + case XP_CURSOR_KEY_DOWN: incr = 1; useWhat = (XP_S16*)rowP; @@ -3139,7 +3139,7 @@ keyToIndex( BoardCtxt* board, XP_Key key, Tile* blankFace ) if ( tileIndex < 0 ) { Tile blankTile = dict_getBlankTile( dict ); tileIndex = model_trayContains( model, turn, blankTile ); - if ( tileIndex >= 0 && !!blankFace ) { /* there's a blank for it */ + if ( tileIndex >= 0 && !!blankFace ) { /* there's a blank for it */ *blankFace = tile; } } @@ -3322,7 +3322,7 @@ static void boardGameOver( void* closure ) { BoardCtxt* board = (BoardCtxt*)closure; - board->scoreBoardInvalid = XP_TRUE; /* not sure if this will do it. */ + board->scoreBoardInvalid = XP_TRUE; /* not sure if this will do it. */ board->gameOver = XP_TRUE; util_notifyGameOver( board->util ); } /* boardGameOver */ diff --git a/common/board.h b/common/board.h index 901b6e34d..8b5832eec 100644 --- a/common/board.h +++ b/common/board.h @@ -53,7 +53,7 @@ typedef enum { XP_KEY_LAST } XP_Key; -#define BONUS_HINT_INTERVAL 15 /* stolen from xwords.c */ +#define BONUS_HINT_INTERVAL 15 /* stolen from xwords.c */ /* typedef struct BoardCtxt BoardCtxt; */ diff --git a/common/boardp.h b/common/boardp.h index 2537aa745..71da1b181 100644 --- a/common/boardp.h +++ b/common/boardp.h @@ -24,7 +24,7 @@ #include "model.h" #include "board.h" #include "engine.h" -#include "mempool.h" /* debug only */ +#include "mempool.h" /* debug only */ #ifdef CPLUS extern "C" { @@ -66,10 +66,10 @@ typedef struct DragState { } DragState; typedef struct BoardArrow { /* gets flipped along with board */ - XP_U8 col; - XP_U8 row; - XP_Bool vert; - XP_Bool visible; + XP_U8 col; + XP_U8 row; + XP_Bool vert; + XP_Bool visible; } BoardArrow; #ifdef KEYBOARD_NAV @@ -90,7 +90,7 @@ typedef struct MiniWindowStuff { } MiniWindowStuff; enum { MINIWINDOW_VALHINT, MINIWINDOW_TRADING }; -typedef XP_U16 MiniWindowType; /* one of the two above */ +typedef XP_U16 MiniWindowType; /* one of the two above */ struct BoardCtxt { /* BoardVTable* vtable; */ @@ -106,8 +106,8 @@ struct BoardCtxt { XP_U16 yOffset; XP_U16 lastVisibleRow; XP_U16 preHideYOffset; - XP_U16 prevYScrollOffset; /* represents where the last draw took place; - used to see if bit scrolling can be used */ + XP_U16 prevYScrollOffset; /* represents where the last draw took place; + used to see if bit scrolling can be used */ XP_U16 penDownX; XP_U16 penDownY; @@ -137,7 +137,7 @@ struct BoardCtxt { XP_Bool eraseTray; XP_Bool boardObscuresTray; XP_Bool boardHidesTray; - XP_Bool scoreSplitHor; /* how to divide the scoreboard? */ + XP_Bool scoreSplitHor;/* how to divide the scoreboard? */ XP_U16 star_row; @@ -150,21 +150,21 @@ struct BoardCtxt { BdCursorLoc bdCursor[MAX_NUM_PLAYERS]; XP_Bool focusHasDived; #endif - XP_U8 dividerLoc[MAX_NUM_PLAYERS]; /* 0 means left of 0th tile, etc. */ + XP_U8 dividerLoc[MAX_NUM_PLAYERS]; /* 0 means left of 0th tile, etc. */ XP_U16 scoreDims[MAX_NUM_PLAYERS]; /* scoreboard state */ XP_Rect scoreBdBounds; XP_Rect timerBounds; - XP_U8 selPlayer; /* which player is selected (!= turn) */ + XP_U8 selPlayer; /* which player is selected (!= turn) */ /* tray state */ XP_U8 trayScaleH; XP_U8 trayScaleV; XP_Rect trayBounds; - XP_U16 remDim; /* width (or ht) of the "rem:" string in scoreboard */ - XP_U8 dividerWidth; /* 0 would mean invisible */ + XP_U16 remDim; /* width (or ht) of the "rem:" string in scoreboard */ + XP_U8 dividerWidth; /* 0 would mean invisible */ XP_Bool dividerInvalid; XP_Bool scoreBoardInvalid; diff --git a/common/commmgr.h b/common/commmgr.h index ffe0587e8..7e858aca0 100644 --- a/common/commmgr.h +++ b/common/commmgr.h @@ -38,7 +38,7 @@ #ifndef _COMMMGR_H_ #define _COMMMGR_H_ -#include "comtypes.h" /* that's *common* types */ +#include "comtypes.h" /* that's *common* types */ #include "xwstream.h" #include "server.h" diff --git a/common/comms.c b/common/comms.c index 65dd31efe..eb5a9fb25 100644 --- a/common/comms.c +++ b/common/comms.c @@ -66,8 +66,8 @@ typedef struct AddressRecord { XP_U16 lastACK; XP_U16 nUniqueBytes; #endif - MsgID nextMsgID; /* on a per-channel basis */ - MsgID lastMsgRcd; /* on a per-channel basis */ + MsgID nextMsgID; /* on a per-channel basis */ + MsgID lastMsgRcd; /* on a per-channel basis */ /* only used if COMMS_HEARTBEAT set except for serialization (to_stream) */ XP_PlayerAddr channelNo; struct { @@ -90,7 +90,7 @@ typedef enum { struct CommsCtxt { XW_UtilCtxt* util; - XP_U32 connID; /* 0 means ignore; otherwise must match */ + XP_U32 connID; /* 0 means ignore; otherwise must match */ XP_PlayerAddr nextChannelNo; AddressRecord* recs; /* return addresses */ @@ -591,7 +591,7 @@ comms_setAddr( CommsCtxt* comms, const CommsAddrRec* addr ) void comms_getInitialAddr( CommsAddrRec* addr ) -{ +{ #if defined XWFEATURE_RELAY addr->conType = COMMS_CONN_RELAY; /* for temporary ease in debugging */ addr->u.ip_relay.ipAddr = 0L; /* force 'em to set it */ @@ -662,7 +662,7 @@ makeElemWithID( CommsCtxt* comms, MsgID msgID, AddressRecord* rec, #endif newMsgElem = (MsgQueueElem*)XP_MALLOC( comms->mpool, - sizeof( *newMsgElem ) ); + sizeof( *newMsgElem ) ); newMsgElem->channelNo = channelNo; newMsgElem->msgID = msgID; #ifdef COMMS_HEARTBEAT diff --git a/common/comtypes.h b/common/comtypes.h index 79be0b638..1a2854727 100644 --- a/common/comtypes.h +++ b/common/comtypes.h @@ -70,7 +70,7 @@ typedef enum { } DrawFocusState; typedef enum { - TRAY_HIDDEN, /* doesn't happen unless tray overlaps board */ + TRAY_HIDDEN, /* doesn't happen unless tray overlaps board */ TRAY_REVERSED, TRAY_REVEALED } XW_TrayVisState; diff --git a/common/dawg.h b/common/dawg.h index 36a4a7ed4..a29187d2d 100644 --- a/common/dawg.h +++ b/common/dawg.h @@ -74,9 +74,9 @@ typedef struct dawg_header { /* Part of xwords3 dictionaries on PalmOS */ typedef struct Xloc_header { unsigned char langCodeFlags; /* can't do bitfields; gcc for pilot and x86 - seem to generate different code */ + seem to generate different code */ unsigned char padding; /* ptrs to the shorts in Xloc_specialEntry - will otherwise be odd */ + will otherwise be odd */ } Xloc_header; typedef struct Xloc_specialEntry { diff --git a/common/dictnry.c b/common/dictnry.c index 4ff24522c..a7f3a2023 100644 --- a/common/dictnry.c +++ b/common/dictnry.c @@ -39,7 +39,7 @@ setBlankTile( DictionaryCtxt* dctx ) { XP_U16 i; - dctx->blankTile = -1; /* no known blank */ + dctx->blankTile = -1; /* no known blank */ for ( i = 0; i < dctx->nFaces; ++i ) { if ( dctx->faces16[i] == 0 ) { @@ -395,33 +395,33 @@ dict_getLangCode( const DictionaryCtxt* dict ) static XP_U8 stub_english_data[] = { /* count value face */ - 9, 1, 'A', - 2, 3, 'B', - 2, 3, 'C', - 4, 2, 'D', - 12, 1, 'E', - 2, 4, 'F', - 3, 2, 'G', - 2, 4, 'H', - 9, 1, 'I', - 1, 8, 'J', - 1, 5, 'K', - 4, 1, 'L', - 2, 3, 'M', - 6, 1, 'N', - 8, 1, 'O', - 2, 3, 'P', - 1, 10, 'Q', - 6, 1, 'R', - 4, 1, 'S', - 6, 1, 'T', - 4, 1, 'U', - 2, 4, 'V', - 2, 4, 'W', - 1, 8, 'X', - 2, 4, 'Y', - 1, 10, 'Z', - 2, 0, BLANK_FACE, /* BLANK1 */ + 9, 1, 'A', + 2, 3, 'B', + 2, 3, 'C', + 4, 2, 'D', + 12, 1, 'E', + 2, 4, 'F', + 3, 2, 'G', + 2, 4, 'H', + 9, 1, 'I', + 1, 8, 'J', + 1, 5, 'K', + 4, 1, 'L', + 2, 3, 'M', + 6, 1, 'N', + 8, 1, 'O', + 2, 3, 'P', + 1, 10, 'Q', + 6, 1, 'R', + 4, 1, 'S', + 6, 1, 'T', + 4, 1, 'U', + 2, 4, 'V', + 2, 4, 'W', + 1, 8, 'X', + 2, 4, 'Y', + 1, 10, 'Z', + 2, 0, BLANK_FACE, /* BLANK1 */ }; void diff --git a/common/dictnry.h b/common/dictnry.h index 95a49cf6d..82b717670 100644 --- a/common/dictnry.h +++ b/common/dictnry.h @@ -65,8 +65,8 @@ struct DictionaryCtxt { const XP_UCHAR* (*func_dict_getShortName)( const DictionaryCtxt* dict ); array_edge* topEdge; - array_edge* base; /* the physical beginning of the dictionary; not - necessarily the entry point for search!! */ + array_edge* base; /* the physical beginning of the dictionary; not + necessarily the entry point for search!! */ XP_UCHAR* name; XP_CHAR16* faces16; /* 16 for unicode */ XP_U8* countsAndValues; @@ -84,7 +84,7 @@ struct DictionaryCtxt { XP_Bool is_4_byte; #endif - XP_S8 blankTile; /* negative means there's no known blank */ + XP_S8 blankTile; /* negative means there's no known blank */ #ifdef DEBUG XP_U32 numEdges; #endif @@ -97,7 +97,7 @@ struct DictionaryCtxt { /* typedef struct DictionaryVtable { */ /* XP_U16 (*m_getTileValue)( DictionaryCtxt* ctxt, CellTile tile ); */ /* unsigned char (*m_getTileChar)( DictionaryCtxt* ctxt, CellTile tile, */ -/* XP_FontCode* fontCode ); */ +/* XP_FontCode* fontCode ); */ /* XP_U16 (*m_numTiles)( DictionaryCtxt* ctxt, Tile tile ); */ /* XP_U16 (*m_numTileFaces)( DictionaryCtxt* ctxt ); */ /* } DictionaryVtable; */ diff --git a/common/draw.c b/common/draw.c index c195baaeb..d7e339fcb 100644 --- a/common/draw.c +++ b/common/draw.c @@ -305,7 +305,7 @@ default_draw_getMiniWText( DrawCtx* dctx, XWMiniTextType textHint ) str = "Triple letter"; break; case BONUS_TRIPLE_WORD: str = "Triple word"; break; - case INTRADE_MW_TEXT: + case INTRADE_MW_TEXT: str = "Trading tiles;\nclick D when done"; break; default: XP_ASSERT( XP_FALSE ); diff --git a/common/draw.h b/common/draw.h index 24a636bca..965a7990f 100644 --- a/common/draw.h +++ b/common/draw.h @@ -48,7 +48,7 @@ typedef struct DrawScoreInfo { XP_UCHAR* name; XP_U16 playerNum; XP_S16 totalScore; - XP_S16 nTilesLeft; /* < 0 means don't use */ + XP_S16 nTilesLeft; /* < 0 means don't use */ CellFlags flags; XP_Bool isTurn; XP_Bool selected; diff --git a/common/engine.c b/common/engine.c index d24accdea..83ee68ab4 100644 --- a/common/engine.c +++ b/common/engine.c @@ -39,11 +39,11 @@ typedef struct BlankTuple { } BlankTuple; typedef struct PossibleMove { - XP_U16 score; /* Because I'm doing a memcmp to sort these things, - the comparison must be done differently on + XP_U16 score; /* Because I'm doing a memcmp to sort these things, + the comparison must be done differently on little-endian platforms. */ MoveInfo moveInfo; - //XP_U16 whichBlanks; /* flags */ + //XP_U16 whichBlanks; /* flags */ Tile blankVals[MAX_COLS]; /* the faces for which we've substituted blanks */ } PossibleMove; @@ -357,7 +357,7 @@ chooseMove( EngineCtxt* engine, PossibleMove** move ) chosen = &engine->miData.savedMoves[--engine->miData.leftInMoveCache]; } - *move = chosen; /* set either way */ + *move = chosen; /* set either way */ if ( chosen->score > 0 ) { @@ -565,9 +565,6 @@ findMovesOneRow( EngineCtxt* engine ) &engine->scoreCache[col], &engine->rowChecks[col]); } - - /* XP_DEBUGF( "row %d: set scoreCache[%d] to %d\n", row, col, */ - /* engine->scoreCache[col] ); */ } prevAnchor = firstSearchCol - 1; @@ -1056,7 +1053,8 @@ considerMove( EngineCtxt* engine, Tile* tiles, XP_S16 tileLength, == EMPTY_TILE ) { posmove.moveInfo.tiles[posmove.moveInfo.nTiles].tile = tiles[posmove.moveInfo.nTiles]; - posmove.moveInfo.tiles[posmove.moveInfo.nTiles].varCoord = (XP_U8)col; + posmove.moveInfo.tiles[posmove.moveInfo.nTiles].varCoord + = (XP_U8)col; ++posmove.moveInfo.nTiles; } } @@ -1094,11 +1092,9 @@ considerScoreWordHasBlanks( EngineCtxt* engine, XP_U16 blanksLeft, for ( i = 0; i < usedBlanksCount; ++i ) { short col = usedBlanks[i].col; posmove->blankVals[col] = usedBlanks[i].tile; - /* posmove->whichBlanks |= (1 << col); */ } XP_ASSERT( posmove->moveInfo.isHorizontal== engine->searchHorizontal ); - /* posmove->moveInfo.isHorizontal = engine->searchHorizontal; */ posmove->moveInfo.commonCoord = (XP_U8)lastRow; saveMoveIfQualifies( engine, posmove ); } @@ -1134,7 +1130,7 @@ saveMoveIfQualifies( EngineCtxt* engine, PossibleMove* posmove ) { XP_S16 lowest = 0; - if ( !engine->isRobot ) { /* robot doesn't ask for next hint.... */ + if ( !engine->isRobot ) { /* robot doesn't ask for next hint.... */ /* we're not interested if we've seen this */ if ( CMPMOVES( posmove, &engine->miData.lastSeenMove ) >= 0 ) { @@ -1154,9 +1150,9 @@ saveMoveIfQualifies( EngineCtxt* engine, PossibleMove* posmove ) /* 1/20/2001 I don't see that this assertion is valid. I simply don't understand why it isn't tripped all the time in the old crosswords. */ - /* XP_ASSERT( (engine->miData.lastSeenMove.score == 0x7fff) */ - /* || (engine->miData.savedMoves[i].score */ - /* <= posmove->score) ); */ + /* XP_ASSERT( (engine->miData.lastSeenMove.score == 0x7fff) */ + /* || (engine->miData.savedMoves[i].score */ + /* <= posmove->score) ); */ if ( CMPMOVES( &engine->miData.savedMoves[lowest], &engine->miData.savedMoves[i] ) > 0 ) { @@ -1170,13 +1166,13 @@ saveMoveIfQualifies( EngineCtxt* engine, PossibleMove* posmove ) lower than this for the rest of this round. */ engine->miData.lowestSavedScore = engine->miData.savedMoves[lowest].score; - /* XP_DEBUGF( "lowestSavedScore now %d\n", */ - /* engine->miData.lowestSavedScore ); */ + /* XP_DEBUGF( "lowestSavedScore now %d\n", */ + /* engine->miData.lowestSavedScore ); */ if ( CMPMOVES( posmove, &engine->miData.savedMoves[lowest]) > 0 ) { XP_MEMCPY( &engine->miData.savedMoves[lowest], posmove, sizeof(engine->miData.savedMoves[lowest]) ); - /* XP_DEBUGF( "just saved move with score %d\n", */ - /* engine->miData.savedMoves[lowest].score ); */ + /* XP_DEBUGF( "just saved move with score %d\n", */ + /* engine->miData.savedMoves[lowest].score ); */ } } } /* saveMoveIfQualifies */ diff --git a/common/engine.h b/common/engine.h index 536dc21c2..652d2b082 100644 --- a/common/engine.h +++ b/common/engine.h @@ -48,7 +48,7 @@ void engine_init( EngineCtxt* ctxt ); void engine_reset( EngineCtxt* ctxt ); void engine_destroy( EngineCtxt* ctxt ); -#define NO_SCORE_LIMIT 10000 /* for targetScore */ +#define NO_SCORE_LIMIT 10000 /* for targetScore */ XP_Bool engine_findMove( EngineCtxt* ctxt, const ModelCtxt* model, const DictionaryCtxt* dict, const Tile* tiles, XP_U16 nTiles, diff --git a/common/game.c b/common/game.c index 52d5ea4db..9c1c35b07 100644 --- a/common/game.c +++ b/common/game.c @@ -270,7 +270,7 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate ) gi->nPlayers = 2; gi->boardSize = 15; gi->robotSmartness = SMART_ROBOT; - gi->gameSeconds = 25 * 60; /* 25 minute game is common? */ + gi->gameSeconds = 25 * 60; /* 25 minute game is common? */ gi->confirmBTConnect = XP_TRUE; @@ -284,7 +284,7 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate ) fp->name = copyString( mpool, buf ); } - fp->isRobot = (i == 0); /* one robot */ + fp->isRobot = (i == 0); /* one robot */ fp->isLocal = XP_TRUE; fp->secondsUsed = 0; } diff --git a/common/game.h b/common/game.h index 8e578932c..702abf92a 100644 --- a/common/game.h +++ b/common/game.h @@ -52,8 +52,8 @@ typedef struct LocalPlayer { typedef struct CurGameInfo { XP_UCHAR* dictName; LocalPlayer players[MAX_NUM_PLAYERS]; - XP_U16 gameID; /* uniquely identifies game */ - XP_U16 gameSeconds; /* for timer */ + XP_U16 gameID; /* uniquely identifies game */ + XP_U16 gameSeconds; /* for timer */ XP_U8 nPlayers; XP_U8 boardSize; DeviceRole serverRole; diff --git a/common/mempool.c b/common/mempool.c index f8f5f86f0..80939ce01 100644 --- a/common/mempool.c +++ b/common/mempool.c @@ -95,10 +95,10 @@ mpool_destroy( MemPoolCtx* mpool ) if ( !!mpool->usedList ) { MemPoolEntry* entry; for ( entry = mpool->usedList; !!entry; entry = entry->next ) { -#ifndef FOR_GREMLINS /* I don't want to hear about this right now */ +#ifndef FOR_GREMLINS /* I don't want to hear about this right now */ XP_WARNF( "0x" XP_P " from ln %ld of %s\n", entry->ptr, entry->lineNo, entry->fileName ); -#ifdef DEBUG +#ifdef DEBUG { char* tryTxt; tryTxt = checkIsText( entry ); diff --git a/common/model.c b/common/model.c index 4c4951406..be6c418f2 100644 --- a/common/model.c +++ b/common/model.c @@ -35,7 +35,7 @@ extern "C" { #define mEND 0x6d454e44 -#define MAX_PASSES 2 /* how many times can all players pass? */ +#define MAX_PASSES 2 /* how many times can all players pass? */ /****************************** prototypes ******************************/ typedef void (*MovePrintFuncPre)(ModelCtxt*, XP_U16, StackEntry*, void*); @@ -212,7 +212,7 @@ buildModelFromStack( ModelCtxt* model, StackCtxt* stack, { StackEntry entry; XP_U16 i; - XP_S16 moveScore = 0; /* keep compiler happy */ + XP_S16 moveScore = 0; /* keep compiler happy */ for ( i = 0; stack_getNthEntry( stack, i, &entry ); ++i ) { @@ -222,7 +222,7 @@ buildModelFromStack( ModelCtxt* model, StackCtxt* stack, switch ( entry.moveType ) { case MOVE_TYPE: - + model_makeTurnFromMoveInfo( model, entry.playerNum, &entry.u.move.moveInfo); moveScore = commitTurn( model, entry.playerNum, @@ -236,7 +236,7 @@ buildModelFromStack( ModelCtxt* model, StackCtxt* stack, assignPlayerTiles( model, entry.playerNum, &entry.u.assign.tiles ); break; - case PHONY_TYPE: /* nothing to add */ + case PHONY_TYPE: /* nothing to add */ model_makeTurnFromMoveInfo( model, entry.playerNum, &entry.u.phony.moveInfo); /* do something here to cause it to print */ @@ -580,7 +580,7 @@ model_undoLatestMoves( ModelCtxt* model, PoolContext* pool, /* get the tiles out of player's tray and back into the pool */ replaceNewTiles( model, pool, turn, &entry.u.move.newTiles); - + undoFromMoveInfo( model, turn, blankTile, &entry.u.move.moveInfo ); } else if ( entry.moveType == TRADE_TYPE ) { @@ -1214,7 +1214,7 @@ commitTurn( ModelCtxt* model, XP_S16 turn, TrayTileSet* newTiles, XP_ASSERT( (tile & TILE_PENDING_BIT) != 0 ); val = tile & TILE_VALUE_MASK; - if ( val > 1 ) { /* somebody else is using this square too! */ + if ( val > 1 ) { /* somebody else is using this square too! */ putBackOtherPlayersTiles( model, turn, col, row ); } @@ -1563,7 +1563,7 @@ printMovePost( ModelCtxt* model, XP_U16 XP_UNUSED(moveN), StackEntry* entry, case PHONY_TYPE: format = util_getUserString( model->vol.util, STR_PHONY_REJECTED ); - printString( stream, format ); + printString( stream, format ); case MOVE_TYPE: format = util_getUserString( model->vol.util, STRD_CUMULATIVE_SCORE ); XP_SNPRINTF( buf, sizeof(buf), format, totalScore ); @@ -1578,7 +1578,7 @@ printMovePost( ModelCtxt* model, XP_U16 XP_UNUSED(moveN), StackEntry* entry, if ( nTiles > 0 ) { if ( entry->moveType == PHONY_TYPE ) { - /* printString( stream, (XP_UCHAR*)"phony rejected " ); */ + /* printString( stream, (XP_UCHAR*)"phony rejected " ); */ } else if ( !closure->keepHidden ) { format = util_getUserString(model->vol.util, STRS_NEW_TILES); XP_SNPRINTF( buf, sizeof(buf), format, @@ -1588,7 +1588,7 @@ printMovePost( ModelCtxt* model, XP_U16 XP_UNUSED(moveN), StackEntry* entry, printString( stream, buf ); } } - + break; } @@ -1743,7 +1743,7 @@ model_getPlayersLastScore( ModelCtxt* model, XP_S16 player, } } - if ( found ) { /* success? */ + if ( found ) { /* success? */ const XP_UCHAR* format; XP_U16 nTiles; switch ( entry.moveType ) { diff --git a/common/model.h b/common/model.h index e20f82559..3ac57f120 100644 --- a/common/model.h +++ b/common/model.h @@ -53,19 +53,19 @@ extern "C" { #define CELL_OWNER_OFFSET 10 #define CELL_OWNER(t) (((t)&CELL_OWNER_MASK) >> CELL_OWNER_OFFSET) -#define MAX_UNIQUE_TILES 64 /* max tile non-blank faces */ +#define MAX_UNIQUE_TILES 64 /* max tile non-blank faces */ #define MAX_NUM_BLANKS 4 /* Used by scoring code and engine as fast representation of moves. */ typedef struct MoveInfoTile { - XP_U8 varCoord; /* 5 bits ok (0-16 for 17x17 board) */ - Tile tile; /* 6 bits will do */ + XP_U8 varCoord; /* 5 bits ok (0-16 for 17x17 board) */ + Tile tile; /* 6 bits will do */ } MoveInfoTile; typedef struct MoveInfo { - XP_U8 nTiles; /* 4 bits: 0-7 */ - XP_U8 commonCoord; /* 5 bits: 0-16 if 17x17 possible */ - XP_Bool isHorizontal; /* 1 bit */ + XP_U8 nTiles; /* 4 bits: 0-7 */ + XP_U8 commonCoord; /* 5 bits: 0-16 if 17x17 possible */ + XP_Bool isHorizontal; /* 1 bit */ /* If this is to go on an undo stack, we need player num here, or the code has to keep track of it *and* there must be exactly one entry per player per turn. */ @@ -84,7 +84,7 @@ typedef struct BlankQueue { XP_U8 row[MAX_NUM_BLANKS]; } BlankQueue; -typedef XP_U8 TileBit; /* bits indicating selection of tiles in tray */ +typedef XP_U8 TileBit; /* bits indicating selection of tiles in tray */ #define ALLTILES ((TileBit)~(0xFF<<(MAX_TRAY_TILES))) #define ILLEGAL_MOVE_SCORE (-1) @@ -92,7 +92,7 @@ typedef XP_U8 TileBit; /* bits indicating selection of tiles in tray */ #define EMPTY_TILE TILE_EMPTY_BIT #define TILE_IS_EMPTY(t) (((t)&TILE_EMPTY_BIT)!=0) #define REVERSED_TILE TILE_PENDING_BIT /* reuse that bit for tile drawing - only */ + only */ ModelCtxt* model_make( MPFORMAL DictionaryCtxt* dict, XW_UtilCtxt* util, @@ -146,8 +146,6 @@ void model_moveTileOnBoard( ModelCtxt* model, XP_S16 turn, XP_U16 colCur, XP_S16 model_trayContains( ModelCtxt* model, XP_S16 turn, Tile tile ); -/* void model_setTile( ModelCtxt* model, XP_U16 col, XP_U16 row, */ -/* Tile tile, XP_Bool isBlank ); */ XP_U16 model_numRows( const ModelCtxt* model ); XP_U16 model_numCols( const ModelCtxt* model ); diff --git a/common/modelp.h b/common/modelp.h index bae3bda0e..3e1459ff5 100644 --- a/common/modelp.h +++ b/common/modelp.h @@ -30,15 +30,15 @@ extern "C" { typedef struct PendingTile { XP_U8 col; XP_U8 row; - Tile tile; /* includes face and blank bit */ + Tile tile; /* includes face and blank bit */ } PendingTile; typedef struct PlayerCtxt { XP_S16 score; - XP_S16 curMoveScore; /* negative means illegal */ + XP_S16 curMoveScore; /* negative means illegal */ XP_Bool curMoveValid; TrayTileSet trayTiles; - XP_U8 nPending; /* still in tray but "on board" */ + XP_U8 nPending; /* still in tray but "on board" */ PendingTile pendingTiles[MAX_TRAY_TILES]; } PlayerCtxt; @@ -69,7 +69,7 @@ struct ModelCtxt { void invalidateScore( ModelCtxt* model, XP_S16 player ); XP_Bool tilesInLine( ModelCtxt* model, XP_S16 turn, XP_Bool* isHorizontal ); void normalizeMoves( ModelCtxt* model, XP_S16 turn, - XP_Bool isHorizontal, MoveInfo* moveInfo ); + XP_Bool isHorizontal, MoveInfo* moveInfo ); void adjustScoreForUndone( ModelCtxt* model, MoveInfo* mi, XP_U16 turn ); #ifdef CPLUS } diff --git a/common/movestak.c b/common/movestak.c index da77b0fed..7976a516f 100644 --- a/common/movestak.c +++ b/common/movestak.c @@ -272,14 +272,14 @@ stack_addPhony( StackCtxt* stack, XP_U16 turn, MoveInfo* moveInfo ) move.moveType = PHONY_TYPE; XP_MEMCPY( &move.u.phony.moveInfo, moveInfo, - sizeof(move.u.phony.moveInfo)); + sizeof(move.u.phony.moveInfo)); pushEntry( stack, &move ); } /* stack_addPhony */ void stack_addTrade( StackCtxt* stack, XP_U16 turn, - TrayTileSet* oldTiles, TrayTileSet* newTiles ) + TrayTileSet* oldTiles, TrayTileSet* newTiles ) { StackEntry move; diff --git a/common/movestak.h b/common/movestak.h index 9e139123d..1bc0a3aad 100644 --- a/common/movestak.h +++ b/common/movestak.h @@ -75,10 +75,10 @@ void stack_loadFromStream( StackCtxt* stack, XWStreamCtxt* stream ); void stack_writeToStream( StackCtxt* stack, XWStreamCtxt* stream ); void stack_addMove( StackCtxt* stack, XP_U16 turn, MoveInfo* moveInfo, - TrayTileSet* newTiles ); + TrayTileSet* newTiles ); void stack_addPhony( StackCtxt* stack, XP_U16 turn, MoveInfo* moveInfo ); void stack_addTrade( StackCtxt* stack, XP_U16 turn, - TrayTileSet* oldTiles, TrayTileSet* newTiles ); + TrayTileSet* oldTiles, TrayTileSet* newTiles ); void stack_addAssign( StackCtxt* stack, XP_U16 turn, TrayTileSet* tiles ); XP_U16 stack_getNEntries( StackCtxt* stack ); diff --git a/common/mscore.c b/common/mscore.c index 0a2c01856..03e254d97 100644 --- a/common/mscore.c +++ b/common/mscore.c @@ -40,10 +40,6 @@ static XP_U16 find_start( const ModelCtxt* model, XP_U16 col, XP_U16 row, static XP_S16 checkScoreMove( ModelCtxt* model, XP_S16 turn, EngineCtxt* engine, XWStreamCtxt* stream, XP_Bool silent, WordNotifierInfo* notifyInfo ); -/* static XP_U16 figureWordScore( ModelCtxt* model, MoveInfo* moveInfo, */ -/* EngineCtxt* engine, */ -/* XP_Bool silent, short moveMultiplier, */ -/* WordNotifierInfo* notifyInfo ); */ static XP_U16 scoreWord( const ModelCtxt* model, MoveInfo* movei, EngineCtxt* engine, XWStreamCtxt* stream, WordNotifierInfo* notifyInfo, XP_UCHAR* mainWord ); @@ -243,7 +239,7 @@ checkScoreMove( ModelCtxt* model, XP_S16 turn, EngineCtxt* engine, score = figureMoveScore( model, &moveInfo, engine, stream, notifyInfo, NULL ); } - } else if ( !silent ) { /* tiles out of line */ + } else if ( !silent ) { /* tiles out of line */ util_userError( model->vol.util, ERR_TILES_NOT_IN_LINE ); } return score; @@ -401,13 +397,13 @@ isLegalMove( ModelCtxt* model, MoveInfo* mInfo, XP_Bool silent ) } /* now the neighbors above... */ if ( commonCoord != 0 ) { - --*commonP; /* decrement whatever's not being looped over */ + --*commonP; /* decrement whatever's not being looped over */ for ( *incr = low; *incr <= high; ++*incr ) { if ( !modelIsEmptyAt( model, col, row ) ) { return XP_TRUE; } } - ++*commonP; /* undo the decrement */ + ++*commonP;/* undo the decrement */ } /* ...and below */ if ( commonCoord <= MAX_ROWS - 1 ) { @@ -419,7 +415,7 @@ isLegalMove( ModelCtxt* model, MoveInfo* mInfo, XP_Bool silent ) } --*commonP; } - + /* if we got here, it's illegal unless this is the first move -- i.e. unless one of the tiles is on the STAR */ if ( ( commonCoord == star_row) && @@ -440,7 +436,7 @@ isLegalMove( ModelCtxt* model, MoveInfo* mInfo, XP_Bool silent ) } } XP_ASSERT( XP_FALSE ); - return XP_FALSE; /* keep compiler happy */ + return XP_FALSE; /* keep compiler happy */ } /* isLegalMove */ XP_U16 @@ -557,7 +553,7 @@ tile_multiplier( const ModelCtxt* model, XP_U16 col, XP_U16 row ) } /* tile_multiplier */ static XP_U16 -scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */ +scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */ EngineCtxt* engine,/* for crosswise caching */ XWStreamCtxt* stream, WordNotifierInfo* notifyInfo, @@ -611,12 +607,13 @@ scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */ if ( engine != NULL ) { XP_ASSERT( nTiles==1 ); - scoreFromCache = engine_getScoreCache( engine, movei->commonCoord ); + scoreFromCache = engine_getScoreCache( engine, + movei->commonCoord ); } /* for a while, at least, calculate and use the cached crosscheck score * each time through in the debug case */ - if ( 0 ) { /* makes keeping parens balanced easier */ + if ( 0 ) { /* makes keeping parens balanced easier */ #ifdef DEBUG } else if ( 1 ) { #else @@ -650,13 +647,13 @@ scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */ XP_ASSERT( (tile & TILE_VALUE_MASK) == tile ); } - *curTile++ = tile; /* save in case we're checking phonies */ + *curTile++ = tile; /* save in case we're checking phonies */ if ( !!stream || !!mainWord ) { wordScoreFormatterAddTile( &fmtr, tile, tileMultiplier, isBlank ); } - + if ( isBlank ) { tile = dict_getBlankTile( dict ); } @@ -689,7 +686,7 @@ scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */ } else if ( engine != NULL ) { #else - } else { /* non-debug case we know it's non-null */ + } else { /* non-debug case we know it's non-null */ #endif XP_ASSERT( nTiles==1 ); XP_ASSERT( engine_getScoreCache( engine, movei->commonCoord ) diff --git a/common/pool.c b/common/pool.c index 70ac5f9d5..699bf59c4 100644 --- a/common/pool.c +++ b/common/pool.c @@ -94,7 +94,7 @@ static Tile getNthPoolTile( PoolContext* pool, short index ) { Tile result; - + /* given an array of counts of remaining letters, subtract each in turn from the total we seek until that total is at or below zero. The count that put it (or would put it) under 0 is the one to pick. */ @@ -164,7 +164,7 @@ pool_replaceTiles( PoolContext* pool, TrayTileSet* tiles ) Tile* tilesP = tiles->tiles; while ( nTiles-- ) { - Tile tile = *tilesP++; /* do I need to filter off high bits? */ + Tile tile = *tilesP++; /* do I need to filter off high bits? */ XP_ASSERT( nTiles < MAX_TRAY_TILES ); XP_ASSERT( tile < pool->numFaces ); @@ -183,7 +183,7 @@ pool_removeTiles( PoolContext* pool, TrayTileSet* tiles ) XP_ASSERT( nTiles <= MAX_TRAY_TILES ); while ( nTiles-- ) { - Tile tile = *tilesP++; /* do I need to filter off high bits? */ + Tile tile = *tilesP++; /* do I need to filter off high bits? */ XP_ASSERT( tile < pool->numFaces ); XP_ASSERT( pool->lettersLeft[tile] > 0 ); diff --git a/common/pool.h b/common/pool.h index 7dd053d18..c55387250 100644 --- a/common/pool.h +++ b/common/pool.h @@ -25,7 +25,7 @@ #include "model.h" void pool_requestTiles( PoolContext* pool, Tile* tiles, - /*in out*/ XP_U8* maxNum ); + /*in out*/ XP_U8* maxNum ); void pool_replaceTiles( PoolContext* pool, TrayTileSet* tiles ); void pool_removeTiles( PoolContext* pool, TrayTileSet* tiles ); diff --git a/common/scorebdp.c b/common/scorebdp.c index bc066c253..7d8a4ff24 100644 --- a/common/scorebdp.c +++ b/common/scorebdp.c @@ -159,7 +159,7 @@ drawScoreBoard( BoardCtxt* board ) *adjustPt += remDim; } - board->remDim = remDim; /* save now so register can be reused */ + board->remDim = remDim; /* save now so register can be reused */ for ( dp = datum, i = 0; i < nPlayers; ++dp, ++i ) { XP_Rect innerRect; @@ -192,7 +192,7 @@ drawScoreBoard( BoardCtxt* board ) board->scoreBoardInvalid = XP_FALSE; } - + drawTimer( board ); } /* drawScoreBoard */ diff --git a/common/server.c b/common/server.c index e4908b743..4f366a9d4 100644 --- a/common/server.c +++ b/common/server.c @@ -55,8 +55,8 @@ enum { typedef XP_U8 GameEndReason; typedef struct ServerPlayer { - EngineCtxt* engine; /* each needs his own so don't interfere each other */ - XP_S8 deviceIndex; /* 0 means local, -1 means unknown */ + EngineCtxt* engine; /* each needs his own so don't interfere each other */ + XP_S8 deviceIndex; /* 0 means local, -1 means unknown */ } ServerPlayer; #define UNKNOWN_DEVICE -1 @@ -87,7 +87,7 @@ typedef struct ServerVolatiles { typedef struct ServerNonvolatiles { XP_U8 nDevices; XW_State gameState; - XP_S8 currentTurn; /* invalid when game is over */ + XP_S8 currentTurn; /* invalid when game is over */ XP_U8 pendingRegistrations; XP_Bool showRobotScores; @@ -201,12 +201,12 @@ initServer( ServerCtxt* server ) if ( !lp->isLocal/* && !lp->name */ ) { ++server->nv.pendingRegistrations; } - + player->deviceIndex = lp->isLocal? SERVER_DEVICE : UNKNOWN_DEVICE; - + } - server->nv.nDevices = 1; /* local device (0) is always there */ + server->nv.nDevices = 1; /* local device (0) is always there */ } /* initServer */ ServerCtxt* @@ -249,7 +249,8 @@ getNV( XWStreamCtxt* stream, ServerNonvolatiles* nv, XP_U16 nPlayers ) nv->pendingRegistrations = (XP_U8)stream_getBits( stream, NPLAYERS_NBITS ); for ( i = 0; i < nPlayers; ++i ) { - nv->addresses[i].channelNo = (XP_PlayerAddr)stream_getBits( stream, 16 ); + nv->addresses[i].channelNo = (XP_PlayerAddr)stream_getBits( stream, + 16 ); } } /* getNV */ @@ -517,7 +518,7 @@ robotTradeTiles( ServerCtxt* server, MoveInfo* newMove ) XP_U16 numInTray = model_getNumPlayerTiles( server->model, turn ); XP_MEMCPY( tradeTiles, curTiles, numInTray ); - for ( i = 0; i < numInTray; ++i ) { /* for each tile in tray */ + for ( i = 0; i < numInTray; ++i ) { /* for each tile in tray */ XP_Bool keep = XP_FALSE; for ( j = 0; j < newMove->numTiles; ++j ) { /* for each in move */ Tile movedTile = newMove->tiles[j].tile; @@ -599,7 +600,7 @@ makeRobotMove( ServerCtxt* server ) CurGameInfo* gi = server->vol.gi; XP_Bool timerEnabled = gi->timerEnabled; XP_Bool canMove; - XP_U32 time = 0L; /* stupid compiler.... */ + XP_U32 time = 0L; /* stupid compiler.... */ XP_U16 targetScore = NO_SCORE_LIMIT; XW_UtilCtxt* util = server->vol.util; @@ -685,7 +686,7 @@ makeRobotMove( ServerCtxt* server ) XP_ASSERT( gi->players[turn].secondsUsed == 0 ); } - return result; /* always return TRUE after robot move? */ + return result; /* always return TRUE after robot move? */ } /* makeRobotMove */ static XP_Bool @@ -764,7 +765,7 @@ server_do( ServerCtxt* server ) server->serverDoing = XP_TRUE; switch( server->nv.gameState ) { - case XWSTATE_BEGIN: + case XWSTATE_BEGIN: if ( server->nv.pendingRegistrations == 0 ) { /* all players on device */ assignTilesToAll( server ); SETSTATE( server, XWSTATE_INTURN ); @@ -1010,7 +1011,7 @@ client_readInitialMessage( ServerCtxt* server, XWStreamCtxt* stream ) dict_destroy( newDict ); } else { dict_destroy( curDict ); - model_setDictionary( model, newDict ); + model_setDictionary( model, newDict ); util_userError( server->vol.util, ERR_SERVER_DICT_WINS ); clearLocalRobots( server ); } @@ -1759,7 +1760,7 @@ reflectMoveAndInform( ServerCtxt* server, XWStreamCtxt* stream ) { ModelCtxt* model = server->vol.model; XP_U16 whoMoved; - XP_U16 nTilesMoved = 0; /* trade case */ + XP_U16 nTilesMoved = 0; /* trade case */ XP_Bool isTrade; XP_Bool isLegalMove; XP_Bool doRequest = XP_FALSE; @@ -1774,7 +1775,7 @@ reflectMoveAndInform( ServerCtxt* server, XWStreamCtxt* stream ) readMoveInfo( server, stream, &whoMoved, &isTrade, &newTiles, &tradedTiles, &isLegalMove ); /* modifies model */ - XP_ASSERT( isLegalMove ); /* client should always report as true */ + XP_ASSERT( isLegalMove ); /* client should always report as true */ isLegalMove = XP_TRUE; if ( isTrade ) { @@ -1825,7 +1826,7 @@ reflectMoveAndInform( ServerCtxt* server, XWStreamCtxt* stream ) XP_ASSERT( !server->vol.prevMoveStream ); server->vol.prevMoveStream = mvStream; } - + } else { /* The client from which the move came still needs to be told. But we can't send a message now since we're burried in a message handler. @@ -2209,7 +2210,7 @@ reflectUndos( ServerCtxt* server, XWStreamCtxt* stream, XW_Proto code ) if ( code == XWPROTO_UNDO_INFO_CLIENT ) { /* need to inform */ XP_U16 sourceClientIndex = getIndexForDevice( server, stream_getAddress( stream ) ); - + sendUndoToClientsExcept( server, sourceClientIndex, nUndone, lastUndone ); @@ -2225,7 +2226,7 @@ XP_Bool server_handleUndo( ServerCtxt* server ) { XP_Bool result = XP_FALSE; - XP_U16 lastTurnUndone = 0; /* quiet compiler good */ + XP_U16 lastTurnUndone = 0; /* quiet compiler good */ XP_U16 nUndone = 0; ModelCtxt* model; CurGameInfo* gi; @@ -2240,7 +2241,7 @@ server_handleUndo( ServerCtxt* server ) The exception is that if the first move was a robot move we'll stop there, and it will immediately move again. */ for ( ; ; ) { - XP_S16 moveNum = -1; /* don't need it checked */ + XP_S16 moveNum = -1; /* don't need it checked */ if ( !model_undoLatestMoves( model, server->pool, 1, &lastTurnUndone, &moveNum ) ) { break; @@ -2297,28 +2298,28 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming ) XP_STATUSF( "client got XWPROTO_CLIENT_SETUP" ); XP_ASSERT( server->vol.gi->serverRole == SERVER_ISCLIENT ); accepted = client_readInitialMessage( server, incoming ); - + } else if ( readStreamHeader( server, incoming ) ) { switch( code ) { - /* case XWPROTO_MOVEMADE_INFO: */ - /* accepted = client_reflectMoveMade( server, incoming ); */ - /* if ( accepted ) { */ - /* nextTurn( server ); */ - /* } */ - /* break; */ - /* case XWPROTO_TRADEMADE_INFO: */ - /* accepted = client_reflectTradeMade( server, incoming ); */ - /* if ( accepted ) { */ - /* nextTurn( server ); */ - /* } */ - /* break; */ - /* case XWPROTO_CLIENT_MOVE_INFO: */ - /* accepted = handleClientMoved( server, incoming ); */ - /* break; */ - /* case XWPROTO_CLIENT_TRADE_INFO: */ - /* accepted = handleClientTraded( server, incoming ); */ - /* break; */ +/* case XWPROTO_MOVEMADE_INFO: */ +/* accepted = client_reflectMoveMade( server, incoming ); */ +/* if ( accepted ) { */ +/* nextTurn( server ); */ +/* } */ +/* break; */ +/* case XWPROTO_TRADEMADE_INFO: */ +/* accepted = client_reflectTradeMade( server, incoming ); */ +/* if ( accepted ) { */ +/* nextTurn( server ); */ +/* } */ +/* break; */ +/* case XWPROTO_CLIENT_MOVE_INFO: */ +/* accepted = handleClientMoved( server, incoming ); */ +/* break; */ +/* case XWPROTO_CLIENT_TRADE_INFO: */ +/* accepted = handleClientTraded( server, incoming ); */ +/* break; */ case XWPROTO_MOVEMADE_INFO_CLIENT: /* client is reporting a move */ accepted = (XWSTATE_INTURN == server->nv.gameState) @@ -2432,7 +2433,7 @@ server_formatRemainingTiles( ServerCtxt* server, XWStreamCtxt* stream, PoolContext* pool = server->pool; if ( !pool ) { - return; /* might want to print an explanation in the stream */ + return; /* might want to print an explanation in the stream */ } XP_ASSERT( !!server->vol.model ); @@ -2509,7 +2510,7 @@ server_writeFinalScores( ServerCtxt* server, XWStreamCtxt* stream ) } if ( highestIndex == -1 ) { - break; /* we're done */ + break; /* we're done */ } else if ( place > 1 ) { stream_putString( stream, XP_CR ); } diff --git a/common/server.h b/common/server.h index 685803da6..d33bc5080 100644 --- a/common/server.h +++ b/common/server.h @@ -21,7 +21,7 @@ #ifndef _SERVER_H_ #define _SERVER_H_ -#include "comtypes.h" /* that's *common* types */ +#include "comtypes.h" /* that's *common* types */ #include "commmgr.h" #include "model.h" @@ -49,7 +49,7 @@ typedef XP_U8 DeviceRole; /* typedef struct ServerVtable { */ /* void (*m_registerPlayer)( ServerCtxt* server, XP_U16 playerNum, */ -/* XP_PlayerSocket socket ); */ +/* XP_PlayerSocket socket ); */ /* void (*m_getTileValueInfo)( ServerCtxt* server, void* valueBuf ); */ diff --git a/common/states.h b/common/states.h index 350c61448..7a07a98d3 100644 --- a/common/states.h +++ b/common/states.h @@ -28,11 +28,11 @@ typedef enum { XWSTATE_NONE, XWSTATE_BEGIN, __UNUSED1, /*XWSTATE_POOL_INITED,*/ - XWSTATE_NEED_SHOWSCORE, /* client-only */ - XWSTATE_WAITING_ALL_REG, /* includes waiting for dict from server */ - XWSTATE_RECEIVED_ALL_REG, /* includes waiting for dict from server */ + XWSTATE_NEED_SHOWSCORE, /* client-only */ + XWSTATE_WAITING_ALL_REG, /* includes waiting for dict from server */ + XWSTATE_RECEIVED_ALL_REG, /* includes waiting for dict from server */ XWSTATE_NEEDSEND_BADWORD_INFO, - XWSTATE_MOVE_CONFIRM_WAIT, /* client's waiting to hear back */ + XWSTATE_MOVE_CONFIRM_WAIT, /* client's waiting to hear back */ XWSTATE_MOVE_CONFIRM_MUSTSEND, /* server should tell client asap */ XWSTATE_NEEDSEND_ENDGAME, XWSTATE_INTURN, diff --git a/common/strutils.h b/common/strutils.h index 2aa756a9c..07f4fac6e 100644 --- a/common/strutils.h +++ b/common/strutils.h @@ -27,7 +27,7 @@ extern "C" { #endif -#define TILE_NBITS 6 /* 32 tiles plus the blank */ +#define TILE_NBITS 6 /* 32 tiles plus the blank */ XP_U16 bitsForMax( XP_U32 n ); diff --git a/common/tray.c b/common/tray.c index 786473f70..b9f3c90d1 100644 --- a/common/tray.c +++ b/common/tray.c @@ -48,7 +48,7 @@ trayLocToIndex( BoardCtxt* board, XP_U16 loc ) XP_S16 pointToTileIndex( BoardCtxt* board, XP_U16 x, XP_U16 y, XP_Bool* onDividerP ) { - XP_S16 result = -1; /* not on a tile */ + XP_S16 result = -1; /* not on a tile */ XP_Rect divider; XP_Rect biggerRect; XP_Bool onDivider; @@ -392,7 +392,7 @@ handleActionInTray( BoardCtxt* board, XP_S16 index, XP_Bool onDivider ) } } else if ( index == -(MAX_TRAY_TILES) ) { /* pending score tile */ result = board_commitTurn( board ); - } else if ( index < 0 ) { /* other empty area */ + } else if ( index < 0 ) { /* other empty area */ /* it better be true */ (void)board_replaceTiles( board ); result = XP_TRUE; @@ -414,7 +414,7 @@ indexForBits( XP_U8 bits ) XP_U16 result = 0; XP_U16 mask = 1; - XP_ASSERT( bits != 0 ); /* otherwise loops forever */ + XP_ASSERT( bits != 0 ); /* otherwise loops forever */ while ( (mask & bits) == 0 ) { ++result; diff --git a/common/util.h b/common/util.h index a136d2098..95108d43d 100644 --- a/common/util.h +++ b/common/util.h @@ -46,8 +46,8 @@ typedef enum { #ifndef XWFEATURE_STANDALONE_ONLY ERR_SERVER_DICT_WINS, ERR_NO_PEEK_REMOTE_TILES, - ERR_REG_UNEXPECTED_USER, /* server asked to register too many remote - users */ + ERR_REG_UNEXPECTED_USER, /* server asked to register too many remote + users */ ERR_REG_SERVER_SANS_REMOTE, STR_NEED_BT_HOST_ADDR, #endif @@ -62,7 +62,7 @@ typedef enum { } UtilErrID; typedef enum { - QUERY_COMMIT_TURN, /* 0 means cancel; 1 means commit */ + QUERY_COMMIT_TURN, /* 0 means cancel; 1 means commit */ QUERY_COMMIT_TRADE, QUERY_ROBOT_MOVE, QUERY_ROBOT_TRADE, diff --git a/common/virtuals.h b/common/virtuals.h index b8192933d..b01853438 100644 --- a/common/virtuals.h +++ b/common/virtuals.h @@ -26,7 +26,7 @@ enum { VIRTUAL_UTIL, VIRTUAL_DRAW, VIRTUAL_STREAM, - VIRTUAL_NUM_VIRTUALS /* must be last */ + VIRTUAL_NUM_VIRTUALS /* must be last */ } XW_VIRTUALS; diff --git a/common/vtabmgr.c b/common/vtabmgr.c index fd1995d17..30f7ef711 100644 --- a/common/vtabmgr.c +++ b/common/vtabmgr.c @@ -46,10 +46,10 @@ vtmgr_destroy( MPFORMAL VTableMgr* vtmgr ) XP_ASSERT( !!vtmgr ); for ( i = 0; i < VTABLE_NUM_SLOTS; ++i ) { - void* vtable = vtmgr->slots[i]; - if ( !!vtable ) { - XP_FREE( mpool, vtable ); - } + void* vtable = vtmgr->slots[i]; + if ( !!vtable ) { + XP_FREE( mpool, vtable ); + } } XP_FREE( mpool, vtmgr ); diff --git a/common/xwproto.h b/common/xwproto.h index 36086d97a..1c6c975c1 100644 --- a/common/xwproto.h +++ b/common/xwproto.h @@ -24,26 +24,26 @@ typedef enum { - XWPROTO_ERROR = 0, /* illegal value */ - XWPROTO_CHAT, /* reserved... */ + XWPROTO_ERROR = 0, /* illegal value */ + XWPROTO_CHAT, /* reserved... */ XWPROTO_DEVICE_REGISTRATION, /* client's first message to server */ - XWPROTO_CLIENT_SETUP, /* server's first message to client */ + XWPROTO_CLIENT_SETUP, /* server's first message to client */ XWPROTO_MOVEMADE_INFO_CLIENT, /* client reports a move it made */ XWPROTO_MOVEMADE_INFO_SERVER, /* server tells all clients about a move - made by it or another client */ - XWPROTO_UNDO_INFO_CLIENT, /* client reports undo[s] on the device */ - XWPROTO_UNDO_INFO_SERVER, /* server reports undos[s] happening - elsewhere*/ - //XWPROTO_CLIENT_MOVE_INFO, /* client says "I made this move" */ - //XWPROTO_SERVER_MOVE_INFO, /* server says "Player X made this move" */ + made by it or another client */ + XWPROTO_UNDO_INFO_CLIENT, /* client reports undo[s] on the device */ + XWPROTO_UNDO_INFO_SERVER, /* server reports undos[s] happening + elsewhere*/ + //XWPROTO_CLIENT_MOVE_INFO, /* client says "I made this move" */ + //XWPROTO_SERVER_MOVE_INFO, /* server says "Player X made this move" */ /* XWPROTO_CLIENT_TRADE_INFO, */ /* XWPROTO_TRADEMADE_INFO, */ XWPROTO_BADWORD_INFO, - XWPROTO_MOVE_CONFIRM, /* server tells move sender that move was - legal */ + XWPROTO_MOVE_CONFIRM, /* server tells move sender that move was + legal */ //XWPROTO_MOVEMADE_INFO, /* info about tiles placed and received */ - XWPROTO_CLIENT_REQ_END_GAME, /* non-server wants to end the game */ - XWPROTO_END_GAME /* server says to end game */ + XWPROTO_CLIENT_REQ_END_GAME, /* non-server wants to end the game */ + XWPROTO_END_GAME /* server says to end game */ } XW_Proto; diff --git a/common/xwstream.h b/common/xwstream.h index b44f6455b..bb9a603cc 100644 --- a/common/xwstream.h +++ b/common/xwstream.h @@ -71,7 +71,7 @@ typedef struct StreamCtxVTable { XP_U16 (*m_stream_getSize)( XWStreamCtxt* dctx ); /* void (*m_stream_makeReturnAddr)( XWStreamCtxt* dctx, XP_PlayerAddr* addr, */ -/* XP_U16* addrLen ); */ +/* XP_U16* addrLen ); */ XP_PlayerAddr (*m_stream_getAddress)( XWStreamCtxt* dctx ); void (*m_stream_setAddress)( XWStreamCtxt* dctx, XP_PlayerAddr channelNo );