瀏覽代碼

progress towards proper fast forwards

tsdedhar 6 年之前
父節點
當前提交
5c3dbf5f65

二進制
assignments/a2/.gradle/4.7/fileHashes/fileHashes.bin


二進制
assignments/a2/.gradle/4.7/fileHashes/fileHashes.lock


二進制
assignments/a2/.gradle/4.7/taskHistory/taskHistory.bin


二進制
assignments/a2/.gradle/4.7/taskHistory/taskHistory.lock


二進制
assignments/a2/.gradle/buildOutputCleanup/buildOutputCleanup.lock


二進制
assignments/a2/build/classes/java/main/Model.class


二進制
assignments/a2/build/libs/a2-1.0-SNAPSHOT.jar


+ 5 - 5
assignments/a2/src/main/java/Model.java

@@ -91,23 +91,23 @@ public class Model extends Observable
       index = i;
     }
     
-    Thingy tempThingy = thingies.get(index);
     // off by one adjustments if we're at the end of a thingy
-    if (tempThingy.getVisibleLen() == 0 && tempLen > x) tempThingy = thingies.get(index - 1);
-    if (tempThingy.getVisibleLen() == tempThingy.getPoints().size() && tempLen < x) tempThingy = thingies.get(index + 1);
+    if (curThingy.getVisibleLen() == 0 && tempLen > x) curThingy = thingies.get(index - 1);
+    if (curThingy.getVisibleLen() == curThingy.getPoints().size() && tempLen < x) curThingy = thingies.get(index + 1);
     
     // now modify tempThingy
     // if we want to go back in time
     if (tempLen > x)
     {
-      tempThingy.reduceLen();
+      curThingy.reduceLen();
       totalVisibleLen--;
     }
     else // go forwards
     {
-      tempThingy.increaseLen();
+      curThingy.increaseLen();
       totalVisibleLen++;
     }
+
     setChanged();
     notifyObservers();
   }