When creating game in response to new-from menuitem, juggle players if

the juggle newgame preference is set.
This commit is contained in:
Andy2 2011-12-20 17:31:13 -08:00
parent 3e42c68091
commit 0e487a4a42

View file

@ -172,7 +172,7 @@ public class GameUtils {
* basis for a new one. * basis for a new one.
*/ */
public static GameLock resetGame( Context context, GameLock lockSrc, public static GameLock resetGame( Context context, GameLock lockSrc,
GameLock lockDest ) GameLock lockDest, boolean juggle )
{ {
CurGameInfo gi = new CurGameInfo( context ); CurGameInfo gi = new CurGameInfo( context );
CommsAddrRec addr = null; CommsAddrRec addr = null;
@ -199,6 +199,10 @@ public class GameUtils {
CommonPrefs.get( context ), dictNames, CommonPrefs.get( context ), dictNames,
pairs.m_bytes, pairs.m_paths, gi.langName() ); pairs.m_bytes, pairs.m_paths, gi.langName() );
if ( juggle ) {
gi.juggle();
}
if ( null != addr ) { if ( null != addr ) {
XwJNI.comms_setAddr( gamePtr, addr ); XwJNI.comms_setAddr( gamePtr, addr );
} }
@ -218,7 +222,7 @@ public class GameUtils {
{ {
GameLock lock = new GameLock( rowidIn, true ).lock(); GameLock lock = new GameLock( rowidIn, true ).lock();
tellRelayDied( context, lock, true ); tellRelayDied( context, lock, true );
resetGame( context, lock, lock ); resetGame( context, lock, lock, false );
lock.unlock(); lock.unlock();
} }
@ -265,8 +269,9 @@ public class GameUtils {
public static long dupeGame( Context context, long rowidIn ) public static long dupeGame( Context context, long rowidIn )
{ {
boolean juggle = CommonPrefs.getAutoJuggle( context );
GameLock lockSrc = new GameLock( rowidIn, false ).lock(); GameLock lockSrc = new GameLock( rowidIn, false ).lock();
GameLock lockDest = resetGame( context, lockSrc, null ); GameLock lockDest = resetGame( context, lockSrc, null, juggle );
long rowid = lockDest.getRowid(); long rowid = lockDest.getRowid();
lockDest.unlock(); lockDest.unlock();
lockSrc.unlock(); lockSrc.unlock();