i => ii; no other change

This commit is contained in:
Eric House 2012-08-22 07:44:21 -07:00
parent a86ab69aec
commit 32e1530d3f
12 changed files with 96 additions and 95 deletions

View file

@ -1268,9 +1268,9 @@ static void
flipAllLimits( BoardCtxt* board )
{
XP_U16 nPlayers = board->gi->nPlayers;
XP_U16 i;
for ( i = 0; i < nPlayers; ++i ) {
flipLimits( &board->pti[i].limits );
XP_U16 ii;
for ( ii = 0; ii < nPlayers; ++ii ) {
flipLimits( &board->pti[ii].limits );
}
}
#endif
@ -1493,9 +1493,9 @@ chooseBestSelPlayer( BoardCtxt* board )
if ( curTurn >= 0 ) {
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];
if ( !LP_IS_ROBOT(lp) && lp->isLocal ) {

View file

@ -135,7 +135,7 @@ invalOldPerimeter( BoardCtxt* board )
static void
invalBlanksWithNeighbors( BoardCtxt* board, BlankQueue* bqp )
{
XP_U16 i;
XP_U16 ii;
XP_U16 lastCol, lastRow;
BlankQueue invalBlanks;
XP_U16 nInvalBlanks = 0;
@ -143,9 +143,9 @@ invalBlanksWithNeighbors( BoardCtxt* board, BlankQueue* bqp )
lastCol = model_numCols(board->model) - 1;
lastRow = model_numRows(board->model) - 1;
for ( i = 0; i < bqp->nBlanks; ++i ) {
XP_U16 modelCol = bqp->col[i];
XP_U16 modelRow = bqp->row[i];
for ( ii = 0; ii < bqp->nBlanks; ++ii ) {
XP_U16 modelCol = bqp->col[ii];
XP_U16 modelRow = bqp->row[ii];
XP_U16 col, row;
flipIf( board, modelCol, modelRow, &col, &row );
@ -266,7 +266,7 @@ drawBoard( BoardCtxt* board )
dfsFor( board, OBJ_BOARD ) ) ) {
XP_Bool allDrawn = XP_TRUE;
XP_S16 i;
XP_S16 ii;
XP_S16 col, row, nVisCols;
ModelCtxt* model = board->model;
BoardArrow const* arrow = NULL;
@ -319,8 +319,8 @@ drawBoard( BoardCtxt* board )
}
/* draw the blanks we skipped before */
for ( i = 0; i < bq.nBlanks; ++i ) {
if ( !drawCell( board, bq.col[i], bq.row[i], XP_FALSE ) ) {
for ( ii = 0; ii < bq.nBlanks; ++ii ) {
if ( !drawCell( board, bq.col[ii], bq.row[ii], XP_FALSE ) ) {
allDrawn = XP_FALSE;
}
}

View file

@ -1015,15 +1015,15 @@ static void
printQueue( const CommsCtxt* comms )
{
MsgQueueElem* elem;
short i;
short ii;
for ( elem = comms->msgQueueHead, i = 0; i < comms->queueLen;
elem = elem->next, ++i ) {
for ( elem = comms->msgQueueHead, ii = 0; ii < comms->queueLen;
elem = elem->next, ++ii ) {
XP_STATUSF( "\t%d: channel: %x; msgID=" XP_LD
#ifdef COMMS_CHECKSUM
"; check=%s"
#endif
,i+1, elem->channelNo, elem->msgID
,ii+1, elem->channelNo, elem->msgID
#ifdef COMMS_CHECKSUM
, elem->checksum
#endif

View file

@ -323,7 +323,7 @@ game_dispose( XWGame* game )
void
gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
{
XP_U16 i;
XP_U16 ii;
XP_MEMSET( gi, 0, sizeof(*gi) );
gi->serverRole = SERVER_STANDALONE;
@ -333,17 +333,17 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
gi->confirmBTConnect = XP_TRUE;
for ( i = 0; i < MAX_NUM_PLAYERS; ++i ) {
for ( ii = 0; ii < MAX_NUM_PLAYERS; ++ii ) {
XP_UCHAR buf[20];
LocalPlayer* fp = &gi->players[i];
LocalPlayer* fp = &gi->players[ii];
if ( !!nameTemplate ) {
XP_SNPRINTF( buf, sizeof(buf), nameTemplate, i+1 );
XP_SNPRINTF( buf, sizeof(buf), nameTemplate, ii+1 );
XP_ASSERT( fp->name == NULL );
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->secondsUsed = 0;
}
@ -352,10 +352,11 @@ gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate )
static void
disposePlayerInfoInt( MPFORMAL CurGameInfo* gi )
{
XP_U16 i;
XP_U16 ii;
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->password );
XP_FREEP( mpool, &lp->dictName );
@ -373,7 +374,7 @@ gi_disposePlayerInfo( MPFORMAL CurGameInfo* gi )
void
gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
{
XP_U16 nPlayers, i;
XP_U16 nPlayers, ii;
const LocalPlayer* srcPl;
LocalPlayer* destPl;
@ -393,8 +394,8 @@ gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI )
destGI->phoniesAction = srcGI->phoniesAction;
destGI->allowPickTiles = srcGI->allowPickTiles;
for ( srcPl = srcGI->players, destPl = destGI->players, i = 0;
i < nPlayers; ++srcPl, ++destPl, ++i ) {
for ( srcPl = srcGI->players, destPl = destGI->players, ii = 0;
ii < nPlayers; ++srcPl, ++destPl, ++ii ) {
replaceStringIfDifferent( mpool, &destPl->name, srcPl->name );
replaceStringIfDifferent( mpool, &destPl->password,

View file

@ -552,13 +552,13 @@ getPendingTileFor( const ModelCtxt* model, XP_U16 turn, XP_U16 col, XP_U16 row,
XP_Bool found = XP_FALSE;
const PlayerCtxt* player;
const PendingTile* pendings;
XP_U16 i;
XP_U16 ii;
XP_ASSERT( turn < VSIZE(model->players) );
player = &model->players[turn];
pendings = player->pendingTiles;
for ( i = 0; i < player->nPending; ++i ) {
for ( ii = 0; ii < player->nPending; ++ii ) {
if ( (pendings->col == col) && (pendings->row == row) ) {
*cellTile = pendings->tile;
@ -742,14 +742,14 @@ getModelTileRaw( const ModelCtxt* model, XP_U16 col, XP_U16 row )
static void
undoFromMoveInfo( ModelCtxt* model, XP_U16 turn, Tile blankTile, MoveInfo* mi )
{
XP_U16 col, row, i;
XP_U16 col, row, ii;
XP_U16* other;
MoveInfoTile* tinfo;
col = row = mi->commonCoord;
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;
*other = tinfo->varCoord;
@ -1074,7 +1074,7 @@ void
model_makeTurnFromMoveInfo( ModelCtxt* model, XP_U16 playerNum,
const MoveInfo* newMove )
{
XP_U16 col, row, i;
XP_U16 col, row, ii;
XP_U16* other;
const MoveInfoTile* tinfo;
Tile blank;
@ -1086,7 +1086,7 @@ model_makeTurnFromMoveInfo( ModelCtxt* model, XP_U16 playerNum,
col = row = newMove->commonCoord; /* just assign both */
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;
Tile tile = tinfo->tile;
@ -1110,13 +1110,13 @@ model_countAllTrayTiles( ModelCtxt* model, XP_U16* counts,
{
PlayerCtxt* player;
XP_S16 nPlayers = model->nPlayers;
XP_S16 i;
XP_S16 ii;
Tile blank;
blank = dict_getBlankTile( model_getDictionary(model) );
for ( i = 0, player = model->players; i < nPlayers; ++i, ++player ) {
if ( i != excludePlayer ) {
for ( ii = 0, player = model->players; ii < nPlayers; ++ii, ++player ) {
if ( ii != excludePlayer ) {
XP_U16 nTiles = player->nPending;
PendingTile* pt;
Tile* tiles;
@ -1927,11 +1927,11 @@ formatTray( const TrayTileSet* tiles, DictionaryCtxt* dict, XP_UCHAR* buf,
XP_U16 bufSize, XP_Bool keepHidden )
{
if ( keepHidden ) {
XP_U16 i;
for ( i = 0; i < tiles->nTiles; ++i ) {
buf[i] = '?';
XP_U16 ii;
for ( ii = 0; ii < tiles->nTiles; ++ii ) {
buf[ii] = '?';
}
buf[i] = '\0';
buf[ii] = '\0';
} else {
dict_tilesToString( dict, (Tile*)tiles->tiles, tiles->nTiles,
buf, bufSize );

View file

@ -258,11 +258,11 @@ tilesInLine( ModelCtxt* model, XP_S16 turn, XP_Bool* isHorizontal )
PendingTile* pt = player->pendingTiles;
XP_U16 commonX = pt->col;
XP_U16 commonY = pt->row;
short i;
short ii;
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
// (to save time)
if ( xIsCommon && (pt->col != commonX) ) {
@ -460,7 +460,7 @@ figureMoveScore( const ModelCtxt* model, XP_U16 turn, MoveInfo* moveInfo,
XP_U16* incr;
XP_U16 oneScore;
XP_U16 score = 0;
short i;
short ii;
short moveMultiplier = 1;
short multipliers[MAX_TRAY_TILES];
MoveInfo tmpMI;
@ -477,9 +477,9 @@ figureMoveScore( const ModelCtxt* model, XP_U16 turn, MoveInfo* moveInfo,
incr = &row;
}
for ( i = 0; i < nTiles; ++i ) {
*incr = moveInfo->tiles[i].varCoord;
moveMultiplier *= multipliers[i] = word_multiplier( model, col, row );
for ( ii = 0; ii < nTiles; ++ii ) {
*incr = moveInfo->tiles[ii].varCoord;
moveMultiplier *= multipliers[ii] = word_multiplier( model, col, row );
}
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.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.tiles[0].tile = tiles->tile;
oneScore = scoreWord( model, turn, &tmpMI, engine, stream, notifyInfo );
if ( !!stream ) {
formatWordScore( stream, oneScore, multipliers[i] );
formatWordScore( stream, oneScore, multipliers[ii] );
}
oneScore *= multipliers[i];
oneScore *= multipliers[ii];
score += oneScore;
}

View file

@ -345,14 +345,14 @@ static XP_Bool
checkConsistent( NewGameCtx* ngc, XP_Bool warnUser )
{
XP_Bool consistent;
XP_U16 i;
XP_U16 ii;
/* If ISSERVER, make sure there's at least one non-local player. */
consistent = ngc->role != SERVER_ISSERVER;
for ( i = 0; !consistent && i < ngc->nPlayersShown; ++i ) {
for ( ii = 0; !consistent && ii < ngc->nPlayersShown; ++ii ) {
DeepValue dValue;
dValue.col = NG_COL_REMOTE;
(*ngc->getColProc)( ngc->closure, i, NG_COL_REMOTE,
(*ngc->getColProc)( ngc->closure, ii, NG_COL_REMOTE,
deepCopy, &dValue );
if ( dValue.value.ng_bool ) {
consistent = XP_TRUE;

View file

@ -239,7 +239,7 @@ void
pool_initFromDict( PoolContext* pool, DictionaryCtxt* dict )
{
XP_U16 numFaces = dict_numTileFaces( dict );
Tile i;
Tile ii;
XP_FREEP( pool->mpool, &pool->lettersLeft );
@ -248,9 +248,9 @@ pool_initFromDict( PoolContext* pool, DictionaryCtxt* dict )
numFaces * sizeof(pool->lettersLeft[0]) );
pool->numTilesLeft = 0;
for ( i = 0; i < numFaces; ++i ) {
XP_U16 numTiles = dict_numTiles( dict, i );
pool->lettersLeft[i] = (XP_U8)numTiles;
for ( ii = 0; ii < numFaces; ++ii ) {
XP_U16 numTiles = dict_numTiles( dict, ii );
pool->lettersLeft[ii] = (XP_U8)numTiles;
pool->numTilesLeft += numTiles;
}

View file

@ -369,7 +369,7 @@ server_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
{
ServerCtxt* server;
XP_U16 version = stream_getVersion( stream );
short i;
short ii;
server = server_make( MPPARM(mpool) model, comms, util );
getNV( stream, &server->nv, nPlayers );
@ -378,8 +378,8 @@ server_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
server->pool = pool_makeFromStream( MPPARM(mpool) stream );
}
for ( i = 0; i < nPlayers; ++i ) {
ServerPlayer* player = &server->players[i];
for ( ii = 0; ii < nPlayers; ++ii ) {
ServerPlayer* player = &server->players[ii];
player->deviceIndex = stream_getU8( stream );
@ -413,7 +413,7 @@ server_makeFromStream( MPFORMAL XWStreamCtxt* stream, ModelCtxt* model,
void
server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream )
{
XP_U16 i;
XP_U16 ii;
XP_U16 nPlayers = server->vol.gi->nPlayers;
putNV( stream, &server->nv, nPlayers );
@ -423,8 +423,8 @@ server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream )
pool_writeToStream( server->pool, stream );
}
for ( i = 0; i < nPlayers; ++i ) {
const ServerPlayer* player = &server->players[i];
for ( ii = 0; ii < nPlayers; ++ii ) {
const ServerPlayer* player = &server->players[ii];
stream_putU8( stream, player->deviceIndex );
@ -447,9 +447,9 @@ server_writeToStream( const ServerCtxt* server, XWStreamCtxt* stream )
static void
cleanupServer( ServerCtxt* server )
{
XP_U16 i;
for ( i = 0; i < VSIZE(server->players); ++i ){
ServerPlayer* player = &server->players[i];
XP_U16 ii;
for ( ii = 0; ii < VSIZE(server->players); ++ii ){
ServerPlayer* player = &server->players[ii];
if ( player->engine != NULL ) {
engine_destroy( player->engine );
}
@ -1080,13 +1080,13 @@ server_do( ServerCtxt* server )
static XP_S8
getIndexForDevice( ServerCtxt* server, XP_PlayerAddr channelNo )
{
short i;
short ii;
XP_S8 result = -1;
for ( i = 0; i < server->nv.nDevices; ++i ) {
RemoteAddress* addr = &server->nv.addresses[i];
for ( ii = 0; ii < server->nv.nDevices; ++ii ) {
RemoteAddress* addr = &server->nv.addresses[ii];
if ( addr->channelNo == channelNo ) {
result = i;
result = ii;
break;
}
}
@ -1170,12 +1170,12 @@ registerRemotePlayer( ServerCtxt* server, XWStreamCtxt* stream )
static void
clearLocalRobots( ServerCtxt* server )
{
XP_U16 i;
XP_U16 ii;
CurGameInfo* gi = server->vol.gi;
XP_U16 nPlayers = gi->nPlayers;
for ( i = 0; i < nPlayers; ++i ) {
LocalPlayer* player = &gi->players[i];
for ( ii = 0; ii < nPlayers; ++ii ) {
LocalPlayer* player = &gi->players[ii];
if ( LP_IS_LOCAL( player ) ) {
player->robotIQ = 0;
}
@ -1551,11 +1551,11 @@ server_resetEngine( ServerCtxt* server, XP_U16 playerNum )
static void
resetEngines( ServerCtxt* server )
{
XP_U16 i;
XP_U16 ii;
XP_U16 nPlayers = server->vol.gi->nPlayers;
for ( i = 0; i < nPlayers; ++i ) {
server_resetEngine( server, i );
for ( ii = 0; ii < nPlayers; ++ii ) {
server_resetEngine( server, ii );
}
} /* resetEngines */

View file

@ -234,18 +234,18 @@ XP_Bool
randIntArray( XP_U16* rnums, XP_U16 count )
{
XP_Bool changed = XP_FALSE;
XP_U16 i;
XP_U16 ii;
for ( i = 0; i < count; ++i ) {
rnums[i] = i;
for ( ii = 0; ii < count; ++ii ) {
rnums[ii] = ii;
}
for ( i = count; i > 0 ; ) {
XP_U16 rIndex = ((XP_U16)XP_RANDOM()) % i;
if ( --i != rIndex ) {
for ( ii = count; ii > 0 ; ) {
XP_U16 rIndex = ((XP_U16)XP_RANDOM()) % ii;
if ( --ii != rIndex ) {
XP_U16 tmp = rnums[rIndex];
rnums[rIndex] = rnums[i];
rnums[i] = tmp;
rnums[rIndex] = rnums[ii];
rnums[ii] = tmp;
if ( !changed ) {
changed = XP_TRUE;
}

View file

@ -350,13 +350,13 @@ invalTilesUnderRect( BoardCtxt* board, const XP_Rect* rect )
it for now. If it needs to be faster, invalCellsUnderRect is the model
to use. */
XP_U16 i;
XP_U16 ii;
XP_Rect locRect;
for ( i = 0; i < MAX_TRAY_TILES; ++i ) {
figureTrayTileRect( board, i, &locRect );
for ( ii = 0; ii < MAX_TRAY_TILES; ++ii ) {
figureTrayTileRect( board, ii, &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;
if ( nTiles > 1 ) {
XP_S16 i;
XP_S16 ii;
Tile tmpT[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 */
for ( i = 0; i < nTiles; ++i ) {
tmpT[i] = model_getPlayerTile( model, turn,
(Tile)(dividerLoc + newT[i]) );
for ( ii = 0; ii < nTiles; ++ii ) {
tmpT[ii] = model_getPlayerTile( model, turn,
(Tile)(dividerLoc + newT[ii]) );
}
/* 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 );
model_addPlayerTile( model, turn, dividerLoc, tmpT[i] );
model_addPlayerTile( model, turn, dividerLoc, tmpT[ii] );
}
board->selInfo->traySelBits = 0;
result = XP_TRUE;

View file

@ -41,12 +41,12 @@ make_vtablemgr( MPFORMAL_NOCOMMA )
void
vtmgr_destroy( MPFORMAL VTableMgr* vtmgr )
{
XP_U16 i;
XP_U16 ii;
XP_ASSERT( !!vtmgr );
for ( i = 0; i < VTABLE_NUM_SLOTS; ++i ) {
void* vtable = vtmgr->slots[i];
for ( ii = 0; ii < VTABLE_NUM_SLOTS; ++ii ) {
void* vtable = vtmgr->slots[ii];
XP_FREEP( mpool, &vtable );
}