add to game state passed into java world whether it's the cur selected

player's turn, and use that to enable/disable Pass/Turn done button.
This commit is contained in:
Andy2 2011-10-05 06:36:01 -07:00
parent 179560867f
commit 90f11abc37
7 changed files with 12 additions and 0 deletions

View file

@ -1185,6 +1185,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1getState
setBool( env, jgsi, "tradeTilesSelected", info.tradeTilesSelected );
setBool( env, jgsi, "gameIsConnected", info.gameIsConnected );
setBool( env, jgsi, "canShuffle", info.canShuffle );
setBool( env, jgsi, "curTurnSelected", info.curTurnSelected );
XWJNI_END();
}

View file

@ -613,6 +613,7 @@ public class BoardActivity extends XWActivity
strId = R.string.board_menu_done;
}
item.setTitle( strId );
item.setEnabled( null == m_gsi || m_gsi.curTurnSelected );
}
return true;

View file

@ -99,6 +99,7 @@ public class JNIThread extends Thread {
public boolean tradeTilesSelected;
public boolean gameIsConnected;
public boolean canShuffle;
public boolean curTurnSelected;
public GameStateInfo clone() {
GameStateInfo obj = null;
try {

View file

@ -541,6 +541,12 @@ board_getYOffset( const BoardCtxt* board )
return vsd->offset;
} /* board_getYOffset */
XP_Bool
board_curTurnSelected( const BoardCtxt* board )
{
return MY_TURN( board );
}
XP_U16
board_visTileCount( const BoardCtxt* board )
{

View file

@ -78,6 +78,7 @@ void board_reset( BoardCtxt* board );
XP_Bool board_setYOffset( BoardCtxt* board, XP_U16 newOffset );
XP_U16 board_getYOffset( const BoardCtxt* board );
XP_Bool board_curTurnSelected( const BoardCtxt* board );
XP_U16 board_visTileCount( const BoardCtxt* board );
XP_Bool board_canShuffle( const BoardCtxt* board );
XP_Bool board_canTogglePending( const BoardCtxt* board );

View file

@ -280,6 +280,7 @@ game_saveToStream( const XWGame* game, const CurGameInfo* gi,
void
game_getState( const XWGame* game, GameStateInfo* gsi )
{
gsi->curTurnSelected = board_curTurnSelected( game->board );
gsi->visTileCount = board_visTileCount( game->board );
gsi->canHint = board_canHint( game->board );
gsi->canRedo = board_canTogglePending( game->board );

View file

@ -97,6 +97,7 @@ typedef struct _GameStateInfo {
XP_Bool tradeTilesSelected;
XP_Bool gameIsConnected;
XP_Bool canShuffle;
XP_Bool curTurnSelected;
} GameStateInfo;
typedef struct XWGame {