commit a20e56fca23c5bf8808db14f6ea9f31ecb63b682
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri Mar 4 14:45:36 2022 +0100

    (hopefully!) finally fix the long-standing bug where people could cheat and submit impossible records.

diff --git a/src/main/java/org/distorted/objectlib/main/ObjectControl.java b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
index c07ca1de..e1e2615e 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectControl.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
@@ -479,6 +479,46 @@ public class ObjectControl
         }
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    private void switchTouchControl(int oldMode, int newMode)
+      {
+      if( newMode==MODE_REPLACE )
+        {
+        if( mTouchControlBackup!=null )
+          {
+          TouchControl tmp = mTouchControlBackup;
+          mTouchControlBackup = mTouchControl;
+          mTouchControl = tmp;
+          }
+        else
+          {
+          mTouchControlBackup = mTouchControl;
+          TwistyObject object = getObject();
+          mTouchControl = new TouchControlShapeChanging(object);
+          float ratio = object.getObjectRatio();
+          mTouchControl.setObjectRatio(ratio);
+          }
+        }
+      if( oldMode==MODE_REPLACE )
+        {
+        if( mTouchControlBackup!=null )
+          {
+          TouchControl tmp = mTouchControlBackup;
+          mTouchControlBackup = mTouchControl;
+          mTouchControl = tmp;
+          }
+        else
+          {
+          mTouchControlBackup = mTouchControl;
+          TwistyObject object = getObject();
+          mTouchControl = object.getTouchControl();
+          float ratio = object.getObjectRatio();
+          mTouchControl.setObjectRatio(ratio);
+          }
+        }
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     void setTouchControl(TwistyObject object)
@@ -749,10 +789,17 @@ public class ObjectControl
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
+// if one or more fingers currently touch the screen, and we just pressed the 'scramble' button, do
+// not scramble - otherwise a kind of a cheat is possible where user touches the screen, starts
+// scrambling, then lifts the finger and the act of lifting screws the scrambling - no further
+// scrambles take any effect!
 
     public void scrambleObject(int num)
       {
-      mPreRender.scrambleObject(num);
+      if( !mBeginningRotation && !mContinuingRotation )
+        {
+        mPreRender.scrambleObject(num);
+        }
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -847,46 +894,6 @@ public class ObjectControl
       mPreRender.setTextureMap(cubit,face,newColor);
       }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    private void switchTouchControl(int oldMode, int newMode)
-      {
-      if( newMode==MODE_REPLACE )
-        {
-        if( mTouchControlBackup!=null )
-          {
-          TouchControl tmp = mTouchControlBackup;
-          mTouchControlBackup = mTouchControl;
-          mTouchControl = tmp;
-          }
-        else
-          {
-          mTouchControlBackup = mTouchControl;
-          TwistyObject object = getObject();
-          mTouchControl = new TouchControlShapeChanging(object);
-          float ratio = object.getObjectRatio();
-          mTouchControl.setObjectRatio(ratio);
-          }
-        }
-      if( oldMode==MODE_REPLACE )
-        {
-        if( mTouchControlBackup!=null )
-          {
-          TouchControl tmp = mTouchControlBackup;
-          mTouchControlBackup = mTouchControl;
-          mTouchControl = tmp;
-          }
-        else
-          {
-          mTouchControlBackup = mTouchControl;
-          TwistyObject object = getObject();
-          mTouchControl = object.getTouchControl();
-          float ratio = object.getObjectRatio();
-          mTouchControl.setObjectRatio(ratio);
-          }
-        }
-      }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public boolean onTouchEvent(MotionEvent event, int mode)
