add and implement board_canTogglePending

This commit is contained in:
Andy2 2010-07-03 11:38:37 -07:00
parent d44b9907cf
commit 5f92491ca3
4 changed files with 15 additions and 0 deletions

View file

@ -537,6 +537,12 @@ board_canShuffle( const BoardCtxt* board )
TRAY_REVEALED == board->trayVisState );
}
XP_Bool board_canTogglePending( const BoardCtxt* board )
{
return TRAY_REVEALED == board->trayVisState
&& model_canTogglePending( board->model, board->selPlayer );
}
static XP_U16
adjustOffset( XP_U16 curOffset, XP_S16 zoomBy )
{

View file

@ -80,6 +80,7 @@ XP_U16 board_getYOffset( const BoardCtxt* board );
XP_Bool board_canFlip( const BoardCtxt* board );
XP_Bool board_canShuffle( const BoardCtxt* board );
XP_Bool board_canTogglePending( const BoardCtxt* board );
/* zoomBy: >0: zoom in; < 0: zoom out; 0: query only */
XP_Bool board_zoom( BoardCtxt* board, XP_S16 zoomBy, XP_Bool* canInOut );

View file

@ -1162,6 +1162,13 @@ model_canShuffle( const ModelCtxt* model, XP_U16 turn, XP_Bool trayVisible )
&& model_getPlayerTiles( model, turn )->nTiles > 1;
}
XP_Bool
model_canTogglePending( const ModelCtxt* model, XP_U16 turn )
{
const PlayerCtxt* player = &model->players[turn];
return 0 < player->nPending || 0 < player->nUndone;
}
static void
incrPendingTileCountAt( ModelCtxt* model, XP_U16 col, XP_U16 row )
{

View file

@ -197,6 +197,7 @@ XP_Bool model_canFlip( const ModelCtxt* model, XP_U16 turn,
XP_Bool trayVisible );
XP_Bool model_canShuffle( const ModelCtxt* model, XP_U16 turn,
XP_Bool trayVisible );
XP_Bool model_canTogglePending( const ModelCtxt* model, XP_U16 turn );
/********************* notification ********************/
typedef void (*BoardListener)(void* data, XP_U16 turn, XP_U16 col,