- Updated fix for Dragon Broodmother
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-10-18 13:33:54 +00:00
parent d13e8904b5
commit f5575ac68e
6 changed files with 30 additions and 45 deletions
+6 -16
View File
@@ -89,22 +89,12 @@ int MTGAllCards::processConfLine(string &s, MTGCard *card, CardPrimitive * primi
{
string value = val;
std::transform(value.begin(), value.end(), value.begin(), ::tolower);
list<int>colors;
for (int j = 0; j < Constants::MTG_NB_COLORS; j++){
size_t found = value.find(Constants::MTGColorStrings[j]);
if (found != string::npos){
colors.push_back(j);
}
}
if(colors.size())
{
primitive->setColor(0,1);
primitive->removeColor(0);
}
list<int>::iterator it;
for ( it=colors.begin() ; it != colors.end(); it++ ){
primitive->setColor(*it);
}
vector<string> values = split(value, ',');
int removeAllOthers = 1;
for (size_t values_i = 0; values_i < values.size(); ++values_i) {
primitive->setColor(values[values_i], removeAllOthers);
removeAllOthers = 0;
}
}
break;
+18
View File
@@ -1,6 +1,9 @@
#include "../include/config.h"
#include "../include/utils.h"
#include <vector>
#include <sstream>
#include <string>
using std::vector;
int randValuesCursor = -1;
@@ -201,3 +204,18 @@ string& rtrim(string &str)
str.resize(str.find_last_not_of(" \t") + 1);
return str;
}
std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) {
std::stringstream ss(s);
std::string item;
while(std::getline(ss, item, delim)) {
elems.push_back(item);
}
return elems;
}
std::vector<std::string> split(const std::string &s, char delim) {
std::vector<std::string> elems;
return split(s, delim, elems);
}