diff ExplorePresetManager.mm @ 19:bd23c1b922be

Explore preset saving slot stuff kind of works.
author Robert Tubb <rt300@eecs.qmul.ac.uk>
date Wed, 22 Oct 2014 16:29:31 +0100
parents 36cdb73691da
children a677c027e3a0
line wrap: on
line diff
--- a/ExplorePresetManager.mm	Wed Oct 22 15:00:14 2014 +0100
+++ b/ExplorePresetManager.mm	Wed Oct 22 16:29:31 2014 +0100
@@ -14,11 +14,8 @@
 void ExplorePresetManager::onAppLoad(){
     // check for already saved stuff
     startLoadAll();
-    
-    if (thePresets.size() != MAX_PRESETS){
-        
-        initPresetSlots();
-    }
+    initPresetSlots();
+
     
 }
 
@@ -39,12 +36,13 @@
     currentPresetSlotIndex++;
     if(filledSlots == MAX_PRESETS){
         cout << "FINISHED EXP STAGE!" << endl;
+        currentPresetSlotIndex = 0;
         return true;
     }
     return false;
 }
 //--------------------------------------------------------------------------------
-Preset* ExplorePresetManager::getCurrentPresetSlot(){
+PresetSlot* ExplorePresetManager::getCurrentPresetSlot(){
     
     return getPresetSlotAtIndex(currentPresetSlotIndex);
 }
@@ -129,8 +127,16 @@
 }
 //-----------------------------------------------------------------------------
 
-void ExplorePresetManager::fillSlotFromLoadedPreset(vector<PresetSlot*>::iterator psi, vector<Preset*>::iterator pi){
-    (*pi) = (*psi); // dodgy?
+void ExplorePresetManager::fillSlotFromLoadedPreset(vector<PresetSlot*>::iterator slotToFill, vector<Preset*>::iterator preset){
+    (*slotToFill)->setValues((*preset)->CCValues);
+    (*slotToFill)->isFilled = true;
+    filledSlots++;
+
+    if(filledSlots == MAX_PRESETS){
+        cout << "ALL SLOTS ARE FILLED!" << endl;
+    }
+    
+    
 }
 //-----------------------------------------------------------------------------
 void ExplorePresetManager::generatePresetSlot(const string name, const string imagefn){