Jeck - Bugfix for createUsersFirstDeck and isDefault.

This commit is contained in:
wagic.jeck
2009-09-08 19:28:07 +00:00
parent 457266184d
commit a03c35e440
+6 -10
View File
@@ -75,12 +75,9 @@ const string Metrics::KEYPAD_TC = "_tKeypadTC";
GameOption::GameOption(int value) : number(value){} GameOption::GameOption(int value) : number(value){}
GameOption::GameOption(string value) : str(value){} GameOption::GameOption(string value) : number(0), str(value) {}
bool GameOption::isDefault(){ bool GameOption::isDefault(){
if(number != 0)
return false;
string test = str; string test = str;
std::transform(test.begin(),test.end(),test.begin(),::tolower); std::transform(test.begin(),test.end(),test.begin(),::tolower);
@@ -234,10 +231,9 @@ int GameSettings::save(){
string GameSettings::profileFile(string filename, string fallback,bool sanity, bool relative) string GameSettings::profileFile(string filename, string fallback,bool sanity, bool relative)
{ {
char buf[512]; char buf[512];
string profile =(*this)[Options::ACTIVE_PROFILE].str; string profile = (*this)[Options::ACTIVE_PROFILE].str;
std::transform(profile.begin(),profile.end(),profile.begin(),::tolower);
if(profile != "" && profile != "default") { if(!(*this)[Options::ACTIVE_PROFILE].isDefault()) {
//No file, return root of profile directory //No file, return root of profile directory
if(filename == ""){ if(filename == ""){
sprintf(buf,"%sprofiles/%s",( relative ? "" : RESPATH"/" ),profile.c_str()); sprintf(buf,"%sprofiles/%s",( relative ? "" : RESPATH"/" ),profile.c_str());
@@ -286,8 +282,7 @@ void GameSettings::checkProfile(){
SAFE_DELETE(profileOptions); SAFE_DELETE(profileOptions);
profileOptions = NEW GameOptions(temp); profileOptions = NEW GameOptions(temp);
//Force a profile.
//Force a theme.
if((*profileOptions)[Options::ACTIVE_THEME].isDefault()){ if((*profileOptions)[Options::ACTIVE_THEME].isDefault()){
temp = "Default"; temp = "Default";
(*profileOptions)[Options::ACTIVE_THEME].str = "Default"; (*profileOptions)[Options::ACTIVE_THEME].str = "Default";
@@ -309,7 +304,8 @@ void GameSettings::checkProfile(){
if(theGame == NULL || theGame->collection == NULL) if(theGame == NULL || theGame->collection == NULL)
return; return;
if(profileFile(PLAYER_COLLECTION) == "") string pcFile = profileFile(PLAYER_COLLECTION);
if(!pcFile.size() || !fileExists(pcFile.c_str()))
{ {
//If we had any default settings, we'd set them here. //If we had any default settings, we'd set them here.