fix problem setting game timers

This commit is contained in:
Eric House 2024-02-18 18:37:57 -08:00
parent b95c86e4e3
commit 6292e498f2
2 changed files with 15 additions and 18 deletions

View file

@ -727,10 +727,10 @@ public class GameConfigDelegate extends DelegateBase
if ( CommonPrefs.getDupModeHidden( m_activity ) ) {
setChecked( R.id.duplicate_check, false );
} else {
CheckBox check = (CheckBox)findViewById( R.id.duplicate_check );
check.setVisibility( View.VISIBLE );
check.setChecked( m_gi.inDuplicateMode );
check.setOnCheckedChangeListener( new OnCheckedChangeListener() {
CheckBox dupCheck = (CheckBox)findViewById( R.id.duplicate_check );
dupCheck.setVisibility( View.VISIBLE );
dupCheck.setChecked( m_gi.inDuplicateMode );
dupCheck.setOnCheckedChangeListener( new OnCheckedChangeListener() {
@Override
public void onCheckedChanged( CompoundButton buttonView,
boolean checked ) {
@ -761,11 +761,11 @@ public class GameConfigDelegate extends DelegateBase
TextView label = (TextView)findViewById(R.id.timer_label );
label.setText( id );
// setInt( R.id.timer_minutes_edit,
// m_gi.gameSeconds/60/m_gi.nPlayers );
// setChecked( R.id.use_timer, m_gi.timerEnabled );
// showTimerSet( m_gi.timerEnabled );
int seconds = m_gi.gameSeconds / 60;
if ( !m_gi.inDuplicateMode ) {
seconds /= m_gi.nPlayers;
}
setInt( R.id.timer_minutes_edit, seconds );
}
private void showTimerSet( boolean show )
@ -1285,11 +1285,10 @@ public class GameConfigDelegate extends DelegateBase
// Get timer value. It's per-move minutes in duplicate mode, otherwise
// it's for the whole game.
int seconds = 60 * getInt( R.id.timer_minutes_edit );
if ( m_gi.inDuplicateMode ) {
m_gi.gameSeconds = seconds;
} else {
m_gi.gameSeconds = seconds * m_gi.nPlayers;
if ( !m_gi.inDuplicateMode ) {
seconds *= m_gi.nPlayers;
}
m_gi.gameSeconds = seconds;
int position = m_phoniesSpinner.getSelectedItemPosition();
m_gi.phoniesAction = CurGameInfo.XWPhoniesChoice.values()[position];

View file

@ -832,9 +832,6 @@ gi_countLocalPlayers( const CurGameInfo* gi, XP_Bool humanOnly )
void
gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi )
{
LocalPlayer* pl;
XP_U16 ii;
XP_UCHAR* str;
XP_U16 strVersion = stream_getVersion( stream );
XP_U16 nColsNBits;
XP_ASSERT( 0 < strVersion );
@ -845,7 +842,7 @@ gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi )
nColsNBits = NUMCOLS_NBITS_4;
#endif
str = stringFromStream( mpool, stream );
XP_UCHAR* str = stringFromStream( mpool, stream );
replaceStringIfDifferent( mpool, &gi->dictName, str );
XP_FREEP( mpool, &str );
@ -907,7 +904,8 @@ gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi )
gi->gameSeconds = stream_getU16( stream );
}
for ( pl = gi->players, ii = 0; ii < gi->nPlayers; ++pl, ++ii ) {
for ( int ii = 0; ii < gi->nPlayers; ++ii ) {
LocalPlayer* pl = &gi->players[ii];
str = stringFromStream( mpool, stream );
replaceStringIfDifferent( mpool, &pl->name, str );
XP_FREEP( mpool, &str );