Project

General

Profile

« Previous | Next » 

Revision 20dea800

Added by Leszek Koltunski over 3 years ago

Fix the long-standing issue with the double 'READY' state which, as I now see, was causing some impossible records.

View differences:

src/main/java/org/distorted/effects/scramble/ScrambleEffect.java
71 71
  private long mDurationSingleTurn;
72 72
  private final Random mRnd;
73 73
  private int mBasicAngle;
74
  private boolean mRotReady, mPluginReady;
74 75

  
75 76
  TwistyObject mObject;
76 77
  Effect[] mNodeEffects;
......
119 120
    mDurationSingleTurn = duration/(mNumScramblesLeft+mNumDoubleScramblesLeft);
120 121
    mNumScrambles = 0;
121 122

  
123
    mRotReady    = false;
124
    mPluginReady = false;
125

  
122 126
    addNewScramble();
123 127
    }
124 128

  
......
153 157
      {
154 158
      if( mEffectReturned == mCubeEffectNumber+mNodeEffectNumber )
155 159
        {
156
        mController.effectFinished(FAKE_EFFECT_ID);
160
        mRotReady = true;
161
        if( mPluginReady ) mController.effectFinished(FAKE_EFFECT_ID);
157 162
        }
158 163
      }
159 164
    }
......
226 231
    addNewScramble();
227 232
    }
228 233

  
234
///////////////////////////////////////////////////////////////////////////////////////////////////
235

  
236
  private void effectFinishedAction(final long effectID, final long id)
237
    {
238
    mEffectReturned++;
239
    effectFinishedPlugin(effectID);
240

  
241
    if( mEffectReturned == mCubeEffectNumber+mNodeEffectNumber )
242
      {
243
      disassignEffects();
244

  
245
      if( mNumScramblesLeft==0 )
246
        {
247
        mPluginReady = true;
248
        if( mRotReady ) mController.effectFinished(FAKE_EFFECT_ID);
249
        }
250
      }
251
    }
252

  
229 253
///////////////////////////////////////////////////////////////////////////////////////////////////
230 254

  
231 255
  public void effectFinished(final long effectID)
......
236 260

  
237 261
      if( effectID == id )
238 262
        {
239
        mEffectReturned++;
240
        effectFinishedPlugin(effectID);
241

  
242
        if( mEffectReturned == mCubeEffectNumber+mNodeEffectNumber )
243
          {
244
          disassignEffects();
245

  
246
          if( mNumScramblesLeft==0 )
247
            {
248
            mController.effectFinished(FAKE_EFFECT_ID);
249
            }
250
          }
251

  
263
        effectFinishedAction(effectID,id);
252 264
        return;
253 265
        }
254 266
      }
......
259 271

  
260 272
      if( effectID == id )
261 273
        {
262
        mEffectReturned++;
263
        effectFinishedPlugin(effectID);
264

  
265
        if( mEffectReturned == mCubeEffectNumber+mNodeEffectNumber )
266
          {
267
          disassignEffects();
268

  
269
          if( mNumScramblesLeft==0 )
270
            {
271
            mController.effectFinished(FAKE_EFFECT_ID);
272
            }
273
          }
274

  
274
        effectFinishedAction(effectID,id);
275 275
        return;
276 276
        }
277 277
      }

Also available in: Unified diff