mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-14 08:01:38 +01:00
i => ii; no other change
This commit is contained in:
parent
a86ab69aec
commit
32e1530d3f
12 changed files with 96 additions and 95 deletions
|
@ -1268,9 +1268,9 @@ static void
|
||||||
flipAllLimits( BoardCtxt* board )
|
flipAllLimits( BoardCtxt* board )
|
||||||
{
|
{
|
||||||
XP_U16 nPlayers = board->gi->nPlayers;
|
XP_U16 nPlayers = board->gi->nPlayers;
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( ii = 0; ii < nPlayers; ++ii ) {
|
||||||
flipLimits( &board->pti[i].limits );
|
flipLimits( &board->pti[ii].limits );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1493,9 +1493,9 @@ chooseBestSelPlayer( BoardCtxt* board )
|
||||||
|
|
||||||
if ( curTurn >= 0 ) {
|
if ( curTurn >= 0 ) {
|
||||||
XP_U16 nPlayers = board->gi->nPlayers;
|
XP_U16 nPlayers = board->gi->nPlayers;
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
|
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( ii = 0; ii < nPlayers; ++ii ) {
|
||||||
LocalPlayer* lp = &board->gi->players[curTurn];
|
LocalPlayer* lp = &board->gi->players[curTurn];
|
||||||
|
|
||||||
if ( !LP_IS_ROBOT(lp) && lp->isLocal ) {
|
if ( !LP_IS_ROBOT(lp) && lp->isLocal ) {
|
||||||
|
|
|
@ -135,7 +135,7 @@ invalOldPerimeter( BoardCtxt* board )
|
||||||
static void
|
static void
|
||||||
invalBlanksWithNeighbors( BoardCtxt* board, BlankQueue* bqp )
|
invalBlanksWithNeighbors( BoardCtxt* board, BlankQueue* bqp )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
XP_U16 lastCol, lastRow;
|
XP_U16 lastCol, lastRow;
|
||||||
BlankQueue invalBlanks;
|
BlankQueue invalBlanks;
|
||||||
XP_U16 nInvalBlanks = 0;
|
XP_U16 nInvalBlanks = 0;
|
||||||
|
@ -143,9 +143,9 @@ invalBlanksWithNeighbors( BoardCtxt* board, BlankQueue* bqp )
|
||||||
lastCol = model_numCols(board->model) - 1;
|
lastCol = model_numCols(board->model) - 1;
|
||||||
lastRow = model_numRows(board->model) - 1;
|
lastRow = model_numRows(board->model) - 1;
|
||||||
|
|
||||||
for ( i = 0; i < bqp->nBlanks; ++i ) {
|
for ( ii = 0; ii < bqp->nBlanks; ++ii ) {
|
||||||
XP_U16 modelCol = bqp->col[i];
|
XP_U16 modelCol = bqp->col[ii];
|
||||||
XP_U16 modelRow = bqp->row[i];
|
XP_U16 modelRow = bqp->row[ii];
|
||||||
XP_U16 col, row;
|
XP_U16 col, row;
|
||||||
|
|
||||||
flipIf( board, modelCol, modelRow, &col, &row );
|
flipIf( board, modelCol, modelRow, &col, &row );
|
||||||
|
@ -266,7 +266,7 @@ drawBoard( BoardCtxt* board )
|
||||||
dfsFor( board, OBJ_BOARD ) ) ) {
|
dfsFor( board, OBJ_BOARD ) ) ) {
|
||||||
|
|
||||||
XP_Bool allDrawn = XP_TRUE;
|
XP_Bool allDrawn = XP_TRUE;
|
||||||
XP_S16 i;
|
XP_S16 ii;
|
||||||
XP_S16 col, row, nVisCols;
|
XP_S16 col, row, nVisCols;
|
||||||
ModelCtxt* model = board->model;
|
ModelCtxt* model = board->model;
|
||||||
BoardArrow const* arrow = NULL;
|
BoardArrow const* arrow = NULL;
|
||||||
|
@ -319,8 +319,8 @@ drawBoard( BoardCtxt* board )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw the blanks we skipped before */
|
/* draw the blanks we skipped before */
|
||||||
for ( i = 0; i < bq.nBlanks; ++i ) {
|
for ( ii = 0; ii < bq.nBlanks; ++ii ) {
|
||||||
if ( !drawCell( board, bq.col[i], bq.row[i], XP_FALSE ) ) {
|
if ( !drawCell( board, bq.col[ii], bq.row[ii], XP_FALSE ) ) {
|
||||||
allDrawn = XP_FALSE;
|
allDrawn = XP_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1015,15 +1015,15 @@ static void
|
||||||
printQueue( const CommsCtxt* comms )
|
printQueue( const CommsCtxt* comms )
|
||||||
{
|
{
|
||||||
MsgQueueElem* elem;
|
MsgQueueElem* elem;
|
||||||
short i;
|
short ii;
|
||||||
|
|
||||||
for ( elem = comms->msgQueueHead, i = 0; i < comms->queueLen;
|
for ( elem = comms->msgQueueHead, ii = 0; ii < comms->queueLen;
|
||||||
elem = elem->next, ++i ) {
|
elem = elem->next, ++ii ) {
|
||||||
XP_STATUSF( "\t%d: channel: %x; msgID=" XP_LD
|
XP_STATUSF( "\t%d: channel: %x; msgID=" XP_LD
|
||||||
#ifdef COMMS_CHECKSUM
|
#ifdef COMMS_CHECKSUM
|
||||||
"; check=%s"
|
"; check=%s"
|
||||||
#endif
|
#endif
|
||||||
,i+1, elem->channelNo, elem->msgID
|
,ii+1, elem->channelNo, elem->msgID
|
||||||
#ifdef COMMS_CHECKSUM
|
#ifdef COMMS_CHECKSUM
|
||||||
, elem->checksum
|
, elem->checksum
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -323,7 +323,7 @@ game_dispose( XWGame* game )
|
||||||
void
|
void
|
||||||
gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
|
gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
|
|
||||||
XP_MEMSET( gi, 0, sizeof(*gi) );
|
XP_MEMSET( gi, 0, sizeof(*gi) );
|
||||||
gi->serverRole = SERVER_STANDALONE;
|
gi->serverRole = SERVER_STANDALONE;
|
||||||
|
@ -333,17 +333,17 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
|
||||||
|
|
||||||
gi->confirmBTConnect = XP_TRUE;
|
gi->confirmBTConnect = XP_TRUE;
|
||||||
|
|
||||||
for ( i = 0; i < MAX_NUM_PLAYERS; ++i ) {
|
for ( ii = 0; ii < MAX_NUM_PLAYERS; ++ii ) {
|
||||||
XP_UCHAR buf[20];
|
XP_UCHAR buf[20];
|
||||||
LocalPlayer* fp = &gi->players[i];
|
LocalPlayer* fp = &gi->players[ii];
|
||||||
|
|
||||||
if ( !!nameTemplate ) {
|
if ( !!nameTemplate ) {
|
||||||
XP_SNPRINTF( buf, sizeof(buf), nameTemplate, i+1 );
|
XP_SNPRINTF( buf, sizeof(buf), nameTemplate, ii+1 );
|
||||||
XP_ASSERT( fp->name == NULL );
|
XP_ASSERT( fp->name == NULL );
|
||||||
fp->name = copyString( mpool, buf );
|
fp->name = copyString( mpool, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
fp->robotIQ = (i == 0) ? 1 : 0; /* one robot */
|
fp->robotIQ = (ii == 0) ? 1 : 0; /* one robot */
|
||||||
fp->isLocal = XP_TRUE;
|
fp->isLocal = XP_TRUE;
|
||||||
fp->secondsUsed = 0;
|
fp->secondsUsed = 0;
|
||||||
}
|
}
|
||||||
|
@ -352,10 +352,11 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
|
||||||
static void
|
static void
|
||||||
disposePlayerInfoInt( MPFORMAL CurGameInfo* gi )
|
disposePlayerInfoInt( MPFORMAL CurGameInfo* gi )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
LocalPlayer* lp;
|
LocalPlayer* lp;
|
||||||
|
|
||||||
for ( lp = gi->players, i = 0; i < MAX_NUM_PLAYERS; ++lp, ++i ) {
|
for ( lp = gi->players, ii = 0; ii < MAX_NUM_PLAYERS; ++lp, ++ii ) {
|
||||||
|
XP_LOGF( "%s: disposing name %p", __func__, lp->name );
|
||||||
XP_FREEP( mpool, &lp->name );
|
XP_FREEP( mpool, &lp->name );
|
||||||
XP_FREEP( mpool, &lp->password );
|
XP_FREEP( mpool, &lp->password );
|
||||||
XP_FREEP( mpool, &lp->dictName );
|
XP_FREEP( mpool, &lp->dictName );
|
||||||
|
@ -373,7 +374,7 @@ gi_disposePlayerInfo( MPFORMAL CurGameInfo* gi )
|
||||||
void
|
void
|
||||||
gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
|
gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
|
||||||
{
|
{
|
||||||
XP_U16 nPlayers, i;
|
XP_U16 nPlayers, ii;
|
||||||
const LocalPlayer* srcPl;
|
const LocalPlayer* srcPl;
|
||||||
LocalPlayer* destPl;
|
LocalPlayer* destPl;
|
||||||
|
|
||||||
|
@ -393,8 +394,8 @@ gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
|
||||||
destGI->phoniesAction = srcGI->phoniesAction;
|
destGI->phoniesAction = srcGI->phoniesAction;
|
||||||
destGI->allowPickTiles = srcGI->allowPickTiles;
|
destGI->allowPickTiles = srcGI->allowPickTiles;
|
||||||
|
|
||||||
for ( srcPl = srcGI->players, destPl = destGI->players, i = 0;
|
for ( srcPl = srcGI->players, destPl = destGI->players, ii = 0;
|
||||||
i < nPlayers; ++srcPl, ++destPl, ++i ) {
|
ii < nPlayers; ++srcPl, ++destPl, ++ii ) {
|
||||||
|
|
||||||
replaceStringIfDifferent( mpool, &destPl->name, srcPl->name );
|
replaceStringIfDifferent( mpool, &destPl->name, srcPl->name );
|
||||||
replaceStringIfDifferent( mpool, &destPl->password,
|
replaceStringIfDifferent( mpool, &destPl->password,
|
||||||
|
|
|
@ -552,13 +552,13 @@ getPendingTileFor( const ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row,
|
||||||
XP_Bool found = XP_FALSE;
|
XP_Bool found = XP_FALSE;
|
||||||
const PlayerCtxt* player;
|
const PlayerCtxt* player;
|
||||||
const PendingTile* pendings;
|
const PendingTile* pendings;
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
|
|
||||||
XP_ASSERT( turn < VSIZE(model->players) );
|
XP_ASSERT( turn < VSIZE(model->players) );
|
||||||
|
|
||||||
player = &model->players[turn];
|
player = &model->players[turn];
|
||||||
pendings = player->pendingTiles;
|
pendings = player->pendingTiles;
|
||||||
for ( i = 0; i < player->nPending; ++i ) {
|
for ( ii = 0; ii < player->nPending; ++ii ) {
|
||||||
|
|
||||||
if ( (pendings->col == col) && (pendings->row == row) ) {
|
if ( (pendings->col == col) && (pendings->row == row) ) {
|
||||||
*cellTile = pendings->tile;
|
*cellTile = pendings->tile;
|
||||||
|
@ -742,14 +742,14 @@ getModelTileRaw( const ModelCtxt* model, XP_U16 col, XP_U16 row )
|
||||||
static void
|
static void
|
||||||
undoFromMoveInfo( ModelCtxt* model, XP_U16 turn, Tile blankTile, MoveInfo* mi )
|
undoFromMoveInfo( ModelCtxt* model, XP_U16 turn, Tile blankTile, MoveInfo* mi )
|
||||||
{
|
{
|
||||||
XP_U16 col, row, i;
|
XP_U16 col, row, ii;
|
||||||
XP_U16* other;
|
XP_U16* other;
|
||||||
MoveInfoTile* tinfo;
|
MoveInfoTile* tinfo;
|
||||||
|
|
||||||
col = row = mi->commonCoord;
|
col = row = mi->commonCoord;
|
||||||
other = mi->isHorizontal? &col: &row;
|
other = mi->isHorizontal? &col: &row;
|
||||||
|
|
||||||
for ( tinfo = mi->tiles, i = 0; i < mi->nTiles; ++tinfo, ++i ) {
|
for ( tinfo = mi->tiles, ii = 0; ii < mi->nTiles; ++tinfo, ++ii ) {
|
||||||
Tile tile;
|
Tile tile;
|
||||||
|
|
||||||
*other = tinfo->varCoord;
|
*other = tinfo->varCoord;
|
||||||
|
@ -1074,7 +1074,7 @@ void
|
||||||
model_makeTurnFromMoveInfo( ModelCtxt* model, XP_U16 playerNum,
|
model_makeTurnFromMoveInfo( ModelCtxt* model, XP_U16 playerNum,
|
||||||
const MoveInfo* newMove )
|
const MoveInfo* newMove )
|
||||||
{
|
{
|
||||||
XP_U16 col, row, i;
|
XP_U16 col, row, ii;
|
||||||
XP_U16* other;
|
XP_U16* other;
|
||||||
const MoveInfoTile* tinfo;
|
const MoveInfoTile* tinfo;
|
||||||
Tile blank;
|
Tile blank;
|
||||||
|
@ -1086,7 +1086,7 @@ model_makeTurnFromMoveInfo( ModelCtxt* model, XP_U16 playerNum,
|
||||||
col = row = newMove->commonCoord; /* just assign both */
|
col = row = newMove->commonCoord; /* just assign both */
|
||||||
other = newMove->isHorizontal? &col: &row;
|
other = newMove->isHorizontal? &col: &row;
|
||||||
|
|
||||||
for ( tinfo = newMove->tiles, i = 0; i < numTiles; ++i, ++tinfo ) {
|
for ( tinfo = newMove->tiles, ii = 0; ii < numTiles; ++ii, ++tinfo ) {
|
||||||
XP_S16 tileIndex;
|
XP_S16 tileIndex;
|
||||||
Tile tile = tinfo->tile;
|
Tile tile = tinfo->tile;
|
||||||
|
|
||||||
|
@ -1110,13 +1110,13 @@ model_countAllTrayTiles( ModelCtxt* model, XP_U16* counts,
|
||||||
{
|
{
|
||||||
PlayerCtxt* player;
|
PlayerCtxt* player;
|
||||||
XP_S16 nPlayers = model->nPlayers;
|
XP_S16 nPlayers = model->nPlayers;
|
||||||
XP_S16 i;
|
XP_S16 ii;
|
||||||
Tile blank;
|
Tile blank;
|
||||||
|
|
||||||
blank = dict_getBlankTile( model_getDictionary(model) );
|
blank = dict_getBlankTile( model_getDictionary(model) );
|
||||||
|
|
||||||
for ( i = 0, player = model->players; i < nPlayers; ++i, ++player ) {
|
for ( ii = 0, player = model->players; ii < nPlayers; ++ii, ++player ) {
|
||||||
if ( i != excludePlayer ) {
|
if ( ii != excludePlayer ) {
|
||||||
XP_U16 nTiles = player->nPending;
|
XP_U16 nTiles = player->nPending;
|
||||||
PendingTile* pt;
|
PendingTile* pt;
|
||||||
Tile* tiles;
|
Tile* tiles;
|
||||||
|
@ -1927,11 +1927,11 @@ formatTray( const TrayTileSet* tiles, DictionaryCtxt* dict, XP_UCHAR* buf,
|
||||||
XP_U16 bufSize, XP_Bool keepHidden )
|
XP_U16 bufSize, XP_Bool keepHidden )
|
||||||
{
|
{
|
||||||
if ( keepHidden ) {
|
if ( keepHidden ) {
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
for ( i = 0; i < tiles->nTiles; ++i ) {
|
for ( ii = 0; ii < tiles->nTiles; ++ii ) {
|
||||||
buf[i] = '?';
|
buf[ii] = '?';
|
||||||
}
|
}
|
||||||
buf[i] = '\0';
|
buf[ii] = '\0';
|
||||||
} else {
|
} else {
|
||||||
dict_tilesToString( dict, (Tile*)tiles->tiles, tiles->nTiles,
|
dict_tilesToString( dict, (Tile*)tiles->tiles, tiles->nTiles,
|
||||||
buf, bufSize );
|
buf, bufSize );
|
||||||
|
|
|
@ -258,11 +258,11 @@ tilesInLine( ModelCtxt* model, XP_S16 turn, XP_Bool* isHorizontal )
|
||||||
PendingTile* pt = player->pendingTiles;
|
PendingTile* pt = player->pendingTiles;
|
||||||
XP_U16 commonX = pt->col;
|
XP_U16 commonX = pt->col;
|
||||||
XP_U16 commonY = pt->row;
|
XP_U16 commonY = pt->row;
|
||||||
short i;
|
short ii;
|
||||||
|
|
||||||
xIsCommon = yIsCommon = XP_TRUE;
|
xIsCommon = yIsCommon = XP_TRUE;
|
||||||
|
|
||||||
for ( i = 1; ++pt, i < player->nPending; ++i ) {
|
for ( ii = 1; ++pt, ii < player->nPending; ++ii ) {
|
||||||
// test the boolean first in case it's already been made false
|
// test the boolean first in case it's already been made false
|
||||||
// (to save time)
|
// (to save time)
|
||||||
if ( xIsCommon && (pt->col != commonX) ) {
|
if ( xIsCommon && (pt->col != commonX) ) {
|
||||||
|
@ -460,7 +460,7 @@ figureMoveScore( const ModelCtxt* model, XP_U16 turn, MoveInfo* moveInfo,
|
||||||
XP_U16* incr;
|
XP_U16* incr;
|
||||||
XP_U16 oneScore;
|
XP_U16 oneScore;
|
||||||
XP_U16 score = 0;
|
XP_U16 score = 0;
|
||||||
short i;
|
short ii;
|
||||||
short moveMultiplier = 1;
|
short moveMultiplier = 1;
|
||||||
short multipliers[MAX_TRAY_TILES];
|
short multipliers[MAX_TRAY_TILES];
|
||||||
MoveInfo tmpMI;
|
MoveInfo tmpMI;
|
||||||
|
@ -477,9 +477,9 @@ figureMoveScore( const ModelCtxt* model, XP_U16 turn, MoveInfo* moveInfo,
|
||||||
incr = &row;
|
incr = &row;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; i < nTiles; ++i ) {
|
for ( ii = 0; ii < nTiles; ++ii ) {
|
||||||
*incr = moveInfo->tiles[i].varCoord;
|
*incr = moveInfo->tiles[ii].varCoord;
|
||||||
moveMultiplier *= multipliers[i] = word_multiplier( model, col, row );
|
moveMultiplier *= multipliers[ii] = word_multiplier( model, col, row );
|
||||||
}
|
}
|
||||||
|
|
||||||
oneScore = scoreWord( model, turn, moveInfo, (EngineCtxt*)NULL, stream,
|
oneScore = scoreWord( model, turn, moveInfo, (EngineCtxt*)NULL, stream,
|
||||||
|
@ -495,16 +495,16 @@ figureMoveScore( const ModelCtxt* model, XP_U16 turn, MoveInfo* moveInfo,
|
||||||
tmpMI.nTiles = 1;
|
tmpMI.nTiles = 1;
|
||||||
tmpMI.tiles[0].varCoord = moveInfo->commonCoord;
|
tmpMI.tiles[0].varCoord = moveInfo->commonCoord;
|
||||||
|
|
||||||
for ( i = 0, tiles = moveInfo->tiles; i < nTiles; ++i, ++tiles ) {
|
for ( ii = 0, tiles = moveInfo->tiles; ii < nTiles; ++ii, ++tiles ) {
|
||||||
|
|
||||||
tmpMI.commonCoord = tiles->varCoord;
|
tmpMI.commonCoord = tiles->varCoord;
|
||||||
tmpMI.tiles[0].tile = tiles->tile;
|
tmpMI.tiles[0].tile = tiles->tile;
|
||||||
|
|
||||||
oneScore = scoreWord( model, turn, &tmpMI, engine, stream, notifyInfo );
|
oneScore = scoreWord( model, turn, &tmpMI, engine, stream, notifyInfo );
|
||||||
if ( !!stream ) {
|
if ( !!stream ) {
|
||||||
formatWordScore( stream, oneScore, multipliers[i] );
|
formatWordScore( stream, oneScore, multipliers[ii] );
|
||||||
}
|
}
|
||||||
oneScore *= multipliers[i];
|
oneScore *= multipliers[ii];
|
||||||
score += oneScore;
|
score += oneScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,14 +345,14 @@ static XP_Bool
|
||||||
checkConsistent( NewGameCtx* ngc, XP_Bool warnUser )
|
checkConsistent( NewGameCtx* ngc, XP_Bool warnUser )
|
||||||
{
|
{
|
||||||
XP_Bool consistent;
|
XP_Bool consistent;
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
|
|
||||||
/* If ISSERVER, make sure there's at least one non-local player. */
|
/* If ISSERVER, make sure there's at least one non-local player. */
|
||||||
consistent = ngc->role != SERVER_ISSERVER;
|
consistent = ngc->role != SERVER_ISSERVER;
|
||||||
for ( i = 0; !consistent && i < ngc->nPlayersShown; ++i ) {
|
for ( ii = 0; !consistent && ii < ngc->nPlayersShown; ++ii ) {
|
||||||
DeepValue dValue;
|
DeepValue dValue;
|
||||||
dValue.col = NG_COL_REMOTE;
|
dValue.col = NG_COL_REMOTE;
|
||||||
(*ngc->getColProc)( ngc->closure, i, NG_COL_REMOTE,
|
(*ngc->getColProc)( ngc->closure, ii, NG_COL_REMOTE,
|
||||||
deepCopy, &dValue );
|
deepCopy, &dValue );
|
||||||
if ( dValue.value.ng_bool ) {
|
if ( dValue.value.ng_bool ) {
|
||||||
consistent = XP_TRUE;
|
consistent = XP_TRUE;
|
||||||
|
|
|
@ -239,7 +239,7 @@ void
|
||||||
pool_initFromDict( PoolContext* pool, DictionaryCtxt* dict )
|
pool_initFromDict( PoolContext* pool, DictionaryCtxt* dict )
|
||||||
{
|
{
|
||||||
XP_U16 numFaces = dict_numTileFaces( dict );
|
XP_U16 numFaces = dict_numTileFaces( dict );
|
||||||
Tile i;
|
Tile ii;
|
||||||
|
|
||||||
XP_FREEP( pool->mpool, &pool->lettersLeft );
|
XP_FREEP( pool->mpool, &pool->lettersLeft );
|
||||||
|
|
||||||
|
@ -248,9 +248,9 @@ pool_initFromDict( PoolContext* pool, DictionaryCtxt* dict )
|
||||||
numFaces * sizeof(pool->lettersLeft[0]) );
|
numFaces * sizeof(pool->lettersLeft[0]) );
|
||||||
pool->numTilesLeft = 0;
|
pool->numTilesLeft = 0;
|
||||||
|
|
||||||
for ( i = 0; i < numFaces; ++i ) {
|
for ( ii = 0; ii < numFaces; ++ii ) {
|
||||||
XP_U16 numTiles = dict_numTiles( dict, i );
|
XP_U16 numTiles = dict_numTiles( dict, ii );
|
||||||
pool->lettersLeft[i] = (XP_U8)numTiles;
|
pool->lettersLeft[ii] = (XP_U8)numTiles;
|
||||||
pool->numTilesLeft += numTiles;
|
pool->numTilesLeft += numTiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,7 @@ server_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
|
||||||
{
|
{
|
||||||
ServerCtxt* server;
|
ServerCtxt* server;
|
||||||
XP_U16 version = stream_getVersion( stream );
|
XP_U16 version = stream_getVersion( stream );
|
||||||
short i;
|
short ii;
|
||||||
|
|
||||||
server = server_make( MPPARM(mpool) model, comms, util );
|
server = server_make( MPPARM(mpool) model, comms, util );
|
||||||
getNV( stream, &server->nv, nPlayers );
|
getNV( stream, &server->nv, nPlayers );
|
||||||
|
@ -378,8 +378,8 @@ server_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
|
||||||
server->pool = pool_makeFromStream( MPPARM(mpool) stream );
|
server->pool = pool_makeFromStream( MPPARM(mpool) stream );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( ii = 0; ii < nPlayers; ++ii ) {
|
||||||
ServerPlayer* player = &server->players[i];
|
ServerPlayer* player = &server->players[ii];
|
||||||
|
|
||||||
player->deviceIndex = stream_getU8( stream );
|
player->deviceIndex = stream_getU8( stream );
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ server_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
|
||||||
void
|
void
|
||||||
server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream )
|
server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
XP_U16 nPlayers = server->vol.gi->nPlayers;
|
XP_U16 nPlayers = server->vol.gi->nPlayers;
|
||||||
|
|
||||||
putNV( stream, &server->nv, nPlayers );
|
putNV( stream, &server->nv, nPlayers );
|
||||||
|
@ -423,8 +423,8 @@ server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
pool_writeToStream( server->pool, stream );
|
pool_writeToStream( server->pool, stream );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( ii = 0; ii < nPlayers; ++ii ) {
|
||||||
const ServerPlayer* player = &server->players[i];
|
const ServerPlayer* player = &server->players[ii];
|
||||||
|
|
||||||
stream_putU8( stream, player->deviceIndex );
|
stream_putU8( stream, player->deviceIndex );
|
||||||
|
|
||||||
|
@ -447,9 +447,9 @@ server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
static void
|
static void
|
||||||
cleanupServer( ServerCtxt* server )
|
cleanupServer( ServerCtxt* server )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
for ( i = 0; i < VSIZE(server->players); ++i ){
|
for ( ii = 0; ii < VSIZE(server->players); ++ii ){
|
||||||
ServerPlayer* player = &server->players[i];
|
ServerPlayer* player = &server->players[ii];
|
||||||
if ( player->engine != NULL ) {
|
if ( player->engine != NULL ) {
|
||||||
engine_destroy( player->engine );
|
engine_destroy( player->engine );
|
||||||
}
|
}
|
||||||
|
@ -1080,13 +1080,13 @@ server_do( ServerCtxt* server )
|
||||||
static XP_S8
|
static XP_S8
|
||||||
getIndexForDevice( ServerCtxt* server, XP_PlayerAddr channelNo )
|
getIndexForDevice( ServerCtxt* server, XP_PlayerAddr channelNo )
|
||||||
{
|
{
|
||||||
short i;
|
short ii;
|
||||||
XP_S8 result = -1;
|
XP_S8 result = -1;
|
||||||
|
|
||||||
for ( i = 0; i < server->nv.nDevices; ++i ) {
|
for ( ii = 0; ii < server->nv.nDevices; ++ii ) {
|
||||||
RemoteAddress* addr = &server->nv.addresses[i];
|
RemoteAddress* addr = &server->nv.addresses[ii];
|
||||||
if ( addr->channelNo == channelNo ) {
|
if ( addr->channelNo == channelNo ) {
|
||||||
result = i;
|
result = ii;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1170,12 +1170,12 @@ registerRemotePlayer( ServerCtxt* server, XWStreamCtxt* stream )
|
||||||
static void
|
static void
|
||||||
clearLocalRobots( ServerCtxt* server )
|
clearLocalRobots( ServerCtxt* server )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
CurGameInfo* gi = server->vol.gi;
|
CurGameInfo* gi = server->vol.gi;
|
||||||
XP_U16 nPlayers = gi->nPlayers;
|
XP_U16 nPlayers = gi->nPlayers;
|
||||||
|
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( ii = 0; ii < nPlayers; ++ii ) {
|
||||||
LocalPlayer* player = &gi->players[i];
|
LocalPlayer* player = &gi->players[ii];
|
||||||
if ( LP_IS_LOCAL( player ) ) {
|
if ( LP_IS_LOCAL( player ) ) {
|
||||||
player->robotIQ = 0;
|
player->robotIQ = 0;
|
||||||
}
|
}
|
||||||
|
@ -1551,11 +1551,11 @@ server_resetEngine( ServerCtxt* server, XP_U16 playerNum )
|
||||||
static void
|
static void
|
||||||
resetEngines( ServerCtxt* server )
|
resetEngines( ServerCtxt* server )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
XP_U16 nPlayers = server->vol.gi->nPlayers;
|
XP_U16 nPlayers = server->vol.gi->nPlayers;
|
||||||
|
|
||||||
for ( i = 0; i < nPlayers; ++i ) {
|
for ( ii = 0; ii < nPlayers; ++ii ) {
|
||||||
server_resetEngine( server, i );
|
server_resetEngine( server, ii );
|
||||||
}
|
}
|
||||||
} /* resetEngines */
|
} /* resetEngines */
|
||||||
|
|
||||||
|
|
|
@ -234,18 +234,18 @@ XP_Bool
|
||||||
randIntArray( XP_U16* rnums, XP_U16 count )
|
randIntArray( XP_U16* rnums, XP_U16 count )
|
||||||
{
|
{
|
||||||
XP_Bool changed = XP_FALSE;
|
XP_Bool changed = XP_FALSE;
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
|
|
||||||
for ( i = 0; i < count; ++i ) {
|
for ( ii = 0; ii < count; ++ii ) {
|
||||||
rnums[i] = i;
|
rnums[ii] = ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( i = count; i > 0 ; ) {
|
for ( ii = count; ii > 0 ; ) {
|
||||||
XP_U16 rIndex = ((XP_U16)XP_RANDOM()) % i;
|
XP_U16 rIndex = ((XP_U16)XP_RANDOM()) % ii;
|
||||||
if ( --i != rIndex ) {
|
if ( --ii != rIndex ) {
|
||||||
XP_U16 tmp = rnums[rIndex];
|
XP_U16 tmp = rnums[rIndex];
|
||||||
rnums[rIndex] = rnums[i];
|
rnums[rIndex] = rnums[ii];
|
||||||
rnums[i] = tmp;
|
rnums[ii] = tmp;
|
||||||
if ( !changed ) {
|
if ( !changed ) {
|
||||||
changed = XP_TRUE;
|
changed = XP_TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,13 +350,13 @@ invalTilesUnderRect( BoardCtxt* board, const XP_Rect* rect )
|
||||||
it for now. If it needs to be faster, invalCellsUnderRect is the model
|
it for now. If it needs to be faster, invalCellsUnderRect is the model
|
||||||
to use. */
|
to use. */
|
||||||
|
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
XP_Rect locRect;
|
XP_Rect locRect;
|
||||||
|
|
||||||
for ( i = 0; i < MAX_TRAY_TILES; ++i ) {
|
for ( ii = 0; ii < MAX_TRAY_TILES; ++ii ) {
|
||||||
figureTrayTileRect( board, i, &locRect );
|
figureTrayTileRect( board, ii, &locRect );
|
||||||
if ( rectsIntersect( rect, &locRect ) ) {
|
if ( rectsIntersect( rect, &locRect ) ) {
|
||||||
board_invalTrayTiles( board, (TileBit)(1 << i) );
|
board_invalTrayTiles( board, (TileBit)(1 << ii) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,7 +553,7 @@ board_juggleTray( BoardCtxt* board )
|
||||||
|
|
||||||
nTiles = model_getNumTilesInTray( model, turn ) - dividerLoc;
|
nTiles = model_getNumTilesInTray( model, turn ) - dividerLoc;
|
||||||
if ( nTiles > 1 ) {
|
if ( nTiles > 1 ) {
|
||||||
XP_S16 i;
|
XP_S16 ii;
|
||||||
Tile tmpT[MAX_TRAY_TILES];
|
Tile tmpT[MAX_TRAY_TILES];
|
||||||
XP_U16 newT[MAX_TRAY_TILES];
|
XP_U16 newT[MAX_TRAY_TILES];
|
||||||
|
|
||||||
|
@ -562,15 +562,15 @@ board_juggleTray( BoardCtxt* board )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save copies of the tiles in juggled order */
|
/* save copies of the tiles in juggled order */
|
||||||
for ( i = 0; i < nTiles; ++i ) {
|
for ( ii = 0; ii < nTiles; ++ii ) {
|
||||||
tmpT[i] = model_getPlayerTile( model, turn,
|
tmpT[ii] = model_getPlayerTile( model, turn,
|
||||||
(Tile)(dividerLoc + newT[i]) );
|
(Tile)(dividerLoc + newT[ii]) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* delete tiles off right end; put juggled ones back on the other */
|
/* delete tiles off right end; put juggled ones back on the other */
|
||||||
for ( i = nTiles - 1; i >= 0; --i ) {
|
for ( ii = nTiles - 1; ii >= 0; --ii ) {
|
||||||
(void)model_removePlayerTile( model, turn, -1 );
|
(void)model_removePlayerTile( model, turn, -1 );
|
||||||
model_addPlayerTile( model, turn, dividerLoc, tmpT[i] );
|
model_addPlayerTile( model, turn, dividerLoc, tmpT[ii] );
|
||||||
}
|
}
|
||||||
board->selInfo->traySelBits = 0;
|
board->selInfo->traySelBits = 0;
|
||||||
result = XP_TRUE;
|
result = XP_TRUE;
|
||||||
|
|
|
@ -41,12 +41,12 @@ make_vtablemgr( MPFORMAL_NOCOMMA )
|
||||||
void
|
void
|
||||||
vtmgr_destroy( MPFORMAL VTableMgr* vtmgr )
|
vtmgr_destroy( MPFORMAL VTableMgr* vtmgr )
|
||||||
{
|
{
|
||||||
XP_U16 i;
|
XP_U16 ii;
|
||||||
|
|
||||||
XP_ASSERT( !!vtmgr );
|
XP_ASSERT( !!vtmgr );
|
||||||
|
|
||||||
for ( i = 0; i < VTABLE_NUM_SLOTS; ++i ) {
|
for ( ii = 0; ii < VTABLE_NUM_SLOTS; ++ii ) {
|
||||||
void* vtable = vtmgr->slots[i];
|
void* vtable = vtmgr->slots[ii];
|
||||||
XP_FREEP( mpool, &vtable );
|
XP_FREEP( mpool, &vtable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue