Project

General

Profile

« Previous | Next » 

Revision fc3c5170

Added by Leszek Koltunski about 4 years ago

Even more debugs for the 'failed to restore preferences' mystery.

View differences:

src/main/java/org/distorted/objects/Cubit.java
181 181
    {
182 182
    String number = mOrigPosition.get0()+"_"+mOrigPosition.get1()+"_"+mOrigPosition.get2();
183 183
    mQuatIndex = preferences.getInt("q_"+number, 0);
184

  
185
    if( mQuatIndex < mParent.QUATS.length )
186
      {
187
      modifyCurrentPosition(mParent.QUATS[mQuatIndex]);
188
      return mQuatIndex;
189
      }
190

  
191
    return -mQuatIndex;
184
    return mQuatIndex;
192 185
    }
193 186

  
194 187
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistyObject.java
458 458

  
459 459
  public synchronized void restorePreferences(SharedPreferences preferences)
460 460
    {
461
    boolean error = false;
462

  
461 463
    for(int i=0; i<NUM_CUBITS; i++)
462 464
      {
463 465
      mQuatDebug[i] = CUBITS[i].restorePreferences(preferences);
464 466

  
465
      if( mQuatDebug[i]<0 )
467
      if( mQuatDebug[i]>=0 && mQuatDebug[i]<QUATS.length)
466 468
        {
467
        for(int j=0; j<NUM_CUBITS; j++)
468
          {
469
          CUBITS[j].solve();
470
          mMesh.setEffectAssociation(j, CUBITS[j].computeAssociation(),0);
471
          }
472
        recordQuatsState("Failed to restorePreferences");
473

  
474
        break;
469
        CUBITS[i].modifyCurrentPosition(QUATS[mQuatDebug[i]]);
470
        mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(),mQuatDebug[i]);
471
        }
472
      else
473
        {
474
        error = true;
475 475
        }
476
      }
476 477

  
477
      mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(),mQuatDebug[i]);
478
    if( error )
479
      {
480
      for(int i=0; i<NUM_CUBITS; i++)
481
        {
482
        CUBITS[i].solve();
483
        mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(),0);
484
        }
485
      recordQuatsState("Failed to restorePreferences");
478 486
      }
479 487
    }
480 488

  

Also available in: Unified diff