Project

General

Profile

« Previous | Next » 

Revision 1f894991

Added by Leszek Koltunski over 4 years ago

Fix a nasty logic error that let people submit bogus results.

View differences:

src/main/java/org/distorted/main/RubikPostRender.java
154 154
      if( RubikState.getCurrentState()==RubikState.SOLV )
155 155
        {
156 156
        RubikStateSolving solving = (RubikStateSolving)RubikState.SOLV.getStateClass();
157
        mNewRecord = solving.stopCounting();
157
        mNewRecord = solving.getRecord();
158 158

  
159 159
        if( mNewRecord< 0 )
160 160
          {
src/main/java/org/distorted/states/RubikStateSolving.java
260 260

  
261 261
///////////////////////////////////////////////////////////////////////////////////////////////////
262 262

  
263
  public long stopCounting()
263
  private void stopCounting()
264
    {
265
    if( mTimer!=null )
266
      {
267
      mTimer.cancel();
268
      mTimer = null;
269
      }
270

  
271
    mRunning = false;
272
    }
273

  
274
///////////////////////////////////////////////////////////////////////////////////////////////////
275

  
276
  public long getRecord()
264 277
    {
265 278
    if( mRunning )
266 279
      {
267
      if( mTimer!=null )
268
        {
269
        mTimer.cancel();
270
        mTimer = null;
271
        }
272
      mRunning = false;
280
      stopCounting();
273 281

  
274 282
      mElapsed = System.currentTimeMillis()-mStartTime;
275 283

  

Also available in: Unified diff