Project

General

Profile

« Previous | Next » 

Revision c0495b7d

Added by Leszek Koltunski about 4 years ago

Pretty Patterns: some patterns had 'empty' moves (i.e. angle 0). Protect the parser against such sequences and correct the first 12 such patterns.

View differences:

src/main/java/org/distorted/patterns/RubikPattern.java
255 255
          }
256 256
        else
257 257
          {
258
          mCanRotate = false;
259

  
260 258
          int axis     =moves[curMove-1][0];
261 259
		      int rowBitmap=moves[curMove-1][1];
262 260
		      int bareAngle=moves[curMove-1][2];
263 261
          int angle    = bareAngle*(360/object.getBasicAngle());
264 262
          int numRot   = Math.abs(bareAngle);
265 263

  
266
          post.addRotation(this, axis, rowBitmap, angle, numRot*DURATION_MILLIS);
264
          if( angle!=0 )
265
            {
266
            mCanRotate = false;
267
            post.addRotation(this, axis, rowBitmap, angle, numRot*DURATION_MILLIS);
268
            }
269
          else
270
            {
271
            android.util.Log.e("pattern", "error: pattern "+nameStr+" move "+(curMove-1)+" angle 0");
272
            }
267 273
          }
268 274
        }
269 275
      else
......
296 302
          }
297 303
        else
298 304
          {
299
          mCanRotate = false;
300

  
301 305
          int axis     =moves[curMove][0];
302 306
		      int rowBitmap=moves[curMove][1];
303 307
		      int bareAngle=moves[curMove][2];
304 308
          int angle    = bareAngle*(360/object.getBasicAngle());
305 309
          int numRot   = Math.abs(bareAngle);
306 310

  
307
          post.addRotation(this, axis, rowBitmap, -angle, numRot*DURATION_MILLIS);
311
          if( angle!=0 )
312
            {
313
            mCanRotate = false;
314
            post.addRotation(this, axis, rowBitmap, -angle, numRot*DURATION_MILLIS);
315
            }
316
          else
317
            {
318
            android.util.Log.e("pattern", "error: pattern "+nameStr+" move "+curMove+" angle 0");
319
            }
308 320
          }
309 321
        }
310 322
      else

Also available in: Unified diff