always save after receiving messages that may have changed state.

Previously did so only when in background, but that leaves a problem:
if device A sends messages to B and B ACKs them so that they're
deleted but exits without saving (for any reason) the game is
permanently horked.  It's safer to save immediately.
This commit is contained in:
Andy2 2011-02-24 17:35:22 -08:00
parent f382f17d20
commit 66bc435f28

View file

@ -97,7 +97,6 @@ public class JNIThread extends Thread {
private static final int kMinDivWidth = 10;
private Rect m_connsIconRect;
private int m_connsIconID = 0;
private boolean m_inBack = false;
LinkedBlockingQueue<QueueElem> m_queue;
@ -149,7 +148,6 @@ public class JNIThread extends Thread {
public void setInBackground( boolean inBack )
{
m_inBack = inBack;
if ( inBack ) {
handle( JNICmd.CMD_SAVE );
}
@ -308,7 +306,7 @@ public class JNIThread extends Thread {
draw = XwJNI.game_receiveMessage( m_jniGamePtr,
(byte[])args[0] );
handle( JNICmd.CMD_DO );
if ( m_inBack ) {
if ( draw ) {
handle( JNICmd.CMD_SAVE );
}
break;