made the fix to color= a fancy loop deal by request of wololo

This commit is contained in:
omegablast2002@yahoo.com
2010-10-17 13:48:59 +00:00
parent 6a81228275
commit 35fa4d9786
+16 -25
View File
@@ -84,33 +84,24 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
} }
break; break;
case 'c': //color case 'c': //color
if (!primitive) primitive = NEW CardPrimitive(); if (!primitive) primitive = NEW CardPrimitive();
{ {
string value = val; string value = val;
std::transform(value.begin(), value.end(), value.begin(), ::tolower); std::transform(value.begin(), value.end(), value.begin(), ::tolower);
int found = value.find("green"); list<int>colors;
if (found != string::npos){ for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
primitive->setColor(1,0); size_t found = value.find(Constants::MTGColorStrings[j]);
} if (found != string::npos){
found = value.find("blue"); colors.push_back(j);
if (found != string::npos){ }
primitive->setColor(2,0); }
} list<int>::iterator it;
found = value.find("red"); for ( it=colors.begin() ; it != colors.end(); it++ ){
if(found != string::npos){ primitive->setColor(*it);
primitive->setColor(3,0); }
}
found = value.find("black");
if (found != string::npos){
primitive->setColor(4,0);
}
found = value.find("white");
if (found != string::npos){
primitive->setColor(5,0);
}
} }
break; break;
case 'g': //grade case 'g': //grade
if (s.size() - i - 1 > 2) currentGrade = getGrade(val[2]); if (s.size() - i - 1 > 2) currentGrade = getGrade(val[2]);