J :
* Fix some coding style misses.
This commit is contained in:
@@ -70,12 +70,12 @@ int Options::getID(string name){
|
||||
//Is it an unlocked set?
|
||||
size_t un = strlen("unlocked_");
|
||||
if(un < name.size()){
|
||||
string setname = name.substr(un);
|
||||
if(setlist.size()){
|
||||
int unlocked = setlist[setname];
|
||||
if(unlocked != -1)
|
||||
return Options::optionSet(unlocked);
|
||||
}
|
||||
string setname = name.substr(un);
|
||||
if(setlist.size()){
|
||||
int unlocked = setlist[setname];
|
||||
if(unlocked != -1)
|
||||
return Options::optionSet(unlocked);
|
||||
}
|
||||
}
|
||||
|
||||
//Failure.
|
||||
@@ -213,9 +213,8 @@ PIXEL_TYPE GameOption::asColor(PIXEL_TYPE fallback){
|
||||
bool GameOption::read(string input){
|
||||
bool bNumeric = true;
|
||||
|
||||
if(!input.size()){
|
||||
if(!input.size())
|
||||
return true; //Default reader doesn't care about invalid formatting.
|
||||
}
|
||||
|
||||
//Is it a number?
|
||||
for(size_t x=0;x<input.size();x++) {
|
||||
@@ -248,15 +247,15 @@ bool GameOption::write(std::ofstream * file, string name){
|
||||
if(!file)
|
||||
return false;
|
||||
|
||||
if(str ==""){
|
||||
if(number == 0) //This is absolutely default. No need to write it.
|
||||
return true;
|
||||
if(str ==""){
|
||||
if(number == 0) //This is absolutely default. No need to write it.
|
||||
return true;
|
||||
|
||||
//It's a number!
|
||||
sprintf(writer,"%s=%d\n", name.c_str(), number);
|
||||
}
|
||||
else
|
||||
sprintf(writer,"%s=%s\n", name.c_str(), str.c_str());
|
||||
sprintf(writer,"%s=%d\n", name.c_str(), number);
|
||||
}
|
||||
else
|
||||
sprintf(writer,"%s=%s\n", name.c_str(), str.c_str());
|
||||
|
||||
(*file)<<writer;
|
||||
return true;
|
||||
@@ -290,16 +289,14 @@ int GameOptions::load(){
|
||||
file.close();
|
||||
}
|
||||
// (PSY) Make sure that cheatmode is switched off for ineligible profiles:
|
||||
if(options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE) {
|
||||
if(options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE)
|
||||
(*this)[Options::CHEATMODE].number = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
int GameOptions::save(){
|
||||
// (PSY) Make sure that cheatmode is switched off for ineligible profiles:
|
||||
if(options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE) {
|
||||
if(options[Options::ACTIVE_PROFILE].str != SECRET_PROFILE)
|
||||
(*this)[Options::CHEATMODE].number = 0;
|
||||
}
|
||||
|
||||
std::ofstream file(mFilename.c_str());
|
||||
if (file){
|
||||
@@ -314,9 +311,8 @@ int GameOptions::save(){
|
||||
opt->write(&file, name);
|
||||
}
|
||||
|
||||
for(vector<string>::size_type t=0;t<unknown.size();t++){
|
||||
for(vector<string>::size_type t=0;t<unknown.size();t++)
|
||||
file<<unknown[t]<<"\n";
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
return 1;
|
||||
@@ -513,7 +509,7 @@ void GameSettings::checkProfile(){
|
||||
GameOptionAward * goa = dynamic_cast<GameOptionAward *>(globalOptions->get(x));
|
||||
if(goa){
|
||||
GameOptionAward * dupe = dynamic_cast<GameOptionAward *>(profileOptions->get(x));
|
||||
if(dupe && goa->number && !dupe->number) dupe->giveAward();
|
||||
if(dupe && goa->number && !dupe->number) dupe->giveAward();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -580,25 +576,20 @@ void GameSettings::createUsersFirstDeck(int setId){
|
||||
|
||||
MTGDeck *mCollection = NEW MTGDeck(options.profileFile(PLAYER_COLLECTION,"",false).c_str(), theGame->collection);
|
||||
if(mCollection->totalCards() > 0)
|
||||
return;
|
||||
return;
|
||||
|
||||
//10 lands of each
|
||||
int sets[] = {setId};
|
||||
if (!mCollection->addRandomCards(10, sets,1, Constants::RARITY_L,"Forest")){
|
||||
if (!mCollection->addRandomCards(10, sets,1, Constants::RARITY_L,"Forest"))
|
||||
mCollection->addRandomCards(10, 0,0,Constants::RARITY_L,"Forest");
|
||||
}
|
||||
if (!mCollection->addRandomCards(10, sets,1,Constants::RARITY_L,"Plains")){
|
||||
if (!mCollection->addRandomCards(10, sets,1,Constants::RARITY_L,"Plains"))
|
||||
mCollection->addRandomCards(10, 0,0,Constants::RARITY_L,"Plains");
|
||||
}
|
||||
if (!mCollection->addRandomCards(10, sets,1,Constants::RARITY_L,"Swamp")){
|
||||
if (!mCollection->addRandomCards(10, sets,1,Constants::RARITY_L,"Swamp"))
|
||||
mCollection->addRandomCards(10, 0,0,Constants::RARITY_L,"Swamp");
|
||||
}
|
||||
if (!mCollection->addRandomCards(10, sets,1,Constants::RARITY_L,"Mountain")){
|
||||
if (!mCollection->addRandomCards(10, sets,1,Constants::RARITY_L,"Mountain"))
|
||||
mCollection->addRandomCards(10, 0,0,Constants::RARITY_L,"Mountain");
|
||||
}
|
||||
if (!mCollection->addRandomCards(10, sets,1,Constants::RARITY_L,"Island")){
|
||||
if (!mCollection->addRandomCards(10, sets,1,Constants::RARITY_L,"Island"))
|
||||
mCollection->addRandomCards(10, 0,0,Constants::RARITY_L,"Island");
|
||||
}
|
||||
|
||||
|
||||
#if defined (WIN32) || defined (LINUX)
|
||||
@@ -747,11 +738,10 @@ bool GameOptionAward::read(string input){
|
||||
viewed = false;
|
||||
|
||||
size_t inlen = input.size();
|
||||
if(!inlen){
|
||||
if(!inlen)
|
||||
return true; //Default reader doesn't care about invalid formatting.
|
||||
}else if(inlen < 8 || input != "0"){ //Regardless of what garbage this is fed, a non-zero value is "Awarded"
|
||||
else if(inlen < 8 || input != "0") //Regardless of what garbage this is fed, a non-zero value is "Awarded"
|
||||
number = 1;
|
||||
}
|
||||
|
||||
size_t w = input.find("V");
|
||||
|
||||
@@ -774,9 +764,8 @@ bool GameOptionAward::read(string input){
|
||||
buf.clear();
|
||||
i++; //Advance through input.
|
||||
}
|
||||
}else{
|
||||
}else
|
||||
buf+= input[t];
|
||||
}
|
||||
|
||||
if(t >= input.size() || i >= 5)
|
||||
break;
|
||||
@@ -811,7 +800,7 @@ bool GameOptionAward::write(std::ofstream * file, string name){
|
||||
return true;
|
||||
|
||||
tm * at = localtime(&achieved);
|
||||
if(!at) return false; //Hurrah for paranoia.
|
||||
if(!at) return false; //Hurrah for paranoia.
|
||||
|
||||
|
||||
sprintf(writer,"%s=%d/%d/%d@%d:%d %s\n", name.c_str(),
|
||||
@@ -838,9 +827,8 @@ bool GameOptionAward::isViewed(){
|
||||
string GameOptionAward::menuStr(){
|
||||
if(!number)
|
||||
return _("Not unlocked.");
|
||||
else if(achieved == 1){
|
||||
else if(achieved == 1)
|
||||
return _("Unlocked.");
|
||||
}
|
||||
|
||||
char buf[256];
|
||||
Translator * t = Translator::GetInstance();
|
||||
|
||||
Reference in New Issue
Block a user