modify model_getTile to take NULL for out parms where the result is

often ignored, then pass NULL instead of the address of variables
called 'ignore'.  Should be no behavior change.
This commit is contained in:
Andy2 2010-10-29 19:52:15 -07:00
parent 3d52698939
commit 5b33df4e25
5 changed files with 22 additions and 24 deletions

View file

@ -1215,10 +1215,8 @@ invalCellsWithTiles( BoardCtxt* board )
*/
for ( row = model_numRows( model )-1; row >= 0; --row ) {
for ( col = model_numCols( model )-1; col >= 0; --col ) {
Tile tile;
XP_Bool ignore;
if ( model_getTile( model, col, row, includePending,
turn, &tile, &ignore, &ignore, &ignore ) ) {
turn, NULL, NULL, NULL, NULL ) ) {
XP_U16 boardCol, boardRow;
flipIf( board, col, row, &boardCol, &boardRow );
invalCell( board, boardCol, boardRow );
@ -2327,13 +2325,12 @@ cellOccupied( const BoardCtxt* board, XP_U16 col, XP_U16 row,
XP_Bool inclPending )
{
Tile tile;
XP_Bool ignr;
XP_Bool result;
flipIf( board, col, row, &col, &row );
result = model_getTile( board->model, col, row, inclPending,
board->selPlayer, &tile,
&ignr, &ignr, &ignr );
NULL, NULL, NULL );
return result;
} /* cellOccupied */
@ -2379,13 +2376,13 @@ XP_Bool
holdsPendingTile( BoardCtxt* board, XP_U16 pencol, XP_U16 penrow )
{
Tile tile;
XP_Bool ignore, isPending;
XP_Bool isPending;
XP_U16 modcol, modrow;
flipIf( board, pencol, penrow, &modcol, &modrow );
return model_getTile( board->model, modcol, modrow, XP_TRUE,
board->selPlayer, &tile, &ignore, &isPending,
(XP_Bool*)NULL )
board->selPlayer, &tile, NULL, &isPending,
NULL )
&& isPending;
} /* holdsPendingTile */
@ -3232,16 +3229,14 @@ boardCellChanged( void* p_board, XP_U16 turn, XP_U16 modelCol, XP_U16 modelRow,
XP_Bool added )
{
BoardCtxt* board = (BoardCtxt*)p_board;
XP_Bool pending, found, ignoreBlank;
Tile ignoreTile;
XP_Bool pending, found;
XP_U16 col, row;
flipIf( board, modelCol, modelRow, &col, &row );
/* for each player, check if the tile overwrites the cursor */
found = model_getTile( board->model, modelCol, modelRow, XP_TRUE, turn,
&ignoreTile, &ignoreBlank, &pending,
(XP_Bool*)NULL );
NULL, NULL, &pending, NULL );
XP_ASSERT( !added || found ); /* if added is true so must found be */

View file

@ -91,14 +91,13 @@ ddStartBoard( BoardCtxt* board, XP_U16 xx, XP_U16 yy )
trayVisible = board->trayVisState == TRAY_REVEALED;
if ( trayVisible && holdsPendingTile( board, col, row ) ) {
XP_U16 modelc, modelr;
XP_Bool ignore;
ds->dtype = DT_TILE;
flipIf( board, col, row, &modelc, &modelr );
found = model_getTile( board->model, modelc, modelr, XP_TRUE,
board->selPlayer, &ds->tile, &ds->isBlank,
&ignore, &ignore );
NULL, NULL );
XP_ASSERT( found );
} else {
/* If we're not dragging a tile, we can either drag the board (scroll)

View file

@ -732,7 +732,7 @@ localGetBoardTile( EngineCtxt* engine, XP_U16 col, XP_U16 row,
XP_Bool substBlank )
{
Tile result;
XP_Bool isBlank, ignore;
XP_Bool isBlank;
if ( !engine->searchHorizontal ) {
XP_U16 tmp = col;
@ -742,7 +742,7 @@ localGetBoardTile( EngineCtxt* engine, XP_U16 col, XP_U16 row,
if ( model_getTile( engine->model, col, row, XP_FALSE,
0, /* don't get pending, so turn doesn't matter */
&result, &isBlank, &ignore, (XP_Bool*)NULL ) ) {
&result, &isBlank, NULL, NULL ) ) {
if ( isBlank && substBlank ) {
result = engine->blankTile;
}

View file

@ -327,10 +327,16 @@ model_getTile( const ModelCtxt* model, XP_U16 col, XP_U16 row,
if ( (cellTile & TILE_EMPTY_BIT) != 0 ) {
return XP_FALSE;
}
*tileP = cellTile & TILE_VALUE_MASK;
*isBlank = IS_BLANK(cellTile);
*pendingP = pending;
if ( NULL != tileP ) {
*tileP = cellTile & TILE_VALUE_MASK;
}
if ( NULL != isBlank ) {
*isBlank = IS_BLANK(cellTile);
}
if ( NULL != pendingP ) {
*pendingP = pending;
}
if ( !!recentP ) {
*recentP = (cellTile & PREV_MOVE_BIT) != 0;
}

View file

@ -317,11 +317,10 @@ static XP_Bool
modelIsEmptyAt( const ModelCtxt* model, XP_U16 col, XP_U16 row )
{
Tile tile;
XP_Bool ignore;
XP_Bool found;
found = model_getTile( model, col, row, XP_FALSE, -1, &tile,
&ignore, &ignore, (XP_Bool*)NULL );
NULL, NULL, NULL );
return !found;
} /* modelIsEmptyAt */
@ -643,11 +642,10 @@ scoreWord( const ModelCtxt* model, MoveInfo* movei, /* new tiles */
++tiles;
--nTiles;
} else { /* placed on the board before this move */
XP_Bool ignore;
tileMultiplier = 1;
(void)model_getTile( model, col, row, XP_FALSE, -1, &tile,
&isBlank, &ignore, (XP_Bool*)NULL );
&isBlank, NULL, NULL );
XP_ASSERT( (tile & TILE_VALUE_MASK) == tile );
}