I’m trying to use CCUserDefault to save user settings and which levels have been completed in my game but I’m having a couple of problems.
User settings save correctly between sessions, but the completed levels do not. I am definitely calling flush and I data is definitely being stored during a single session so I have no Idea what could be the problem. Can anyone offer a suggestion?
Code for settings being saved:
CCUserDefault::sharedUserDefault()->setFloatForKey(“SFXVol”, (m_pSFXSlider->GetValue() * 0.01f));
fSFXVolume = CCUserDefault::sharedUserDefault()->getFloatForKey(“SFXVol”);
Code for Level Data being Saved:
s2 << (m_iCurrentArea) << “Level” << (m_iCurrentLevel) << “Unlocked";
Level*" << << "*Unlocked”;
s << << "
bool bUnlocked = CCUserDefault::sharedUserDefault()->getBoolForKey(strLevelUnlocked.c_str());
As I said this works fine in a single session, but when I start a new one all previous level data but not user settings have not saved or are at least not being recovered. Can anyone tell me why?