- Adding a generic "ueot" effect. This will be initially confusing, but the ultimate goal is to get rid of all the particular cases we handled with "until end of turn" effects. this "ueot " works like "may " and "choice ", it has to be at the very beginning of the ability(ies) it targets. The reason is to avoid conflicts with the existing "ueot" we have all over the place. I have only tested it with transforms and loseabilities for now (see "ovinize") but hopefully this will become the new norm. This should also reduce the code inside the parser, long term.

- Adding "Ovinize" as an example of this new keyword.
- moved "parseBetween" in utils as I am using it in other files for wome work in Progress.
This commit is contained in:
wagic.the.homebrew
2011-05-05 06:18:50 +00:00
parent 4c572a1ffa
commit 748af5b461
10 changed files with 108 additions and 41 deletions

View File

@@ -302,6 +302,38 @@ std::vector<std::string> split(const std::string& s, char delim)
return split(s, delim, elems);
}
std::vector<std::string>& parseBetween(const std::string& s, string start, string stop, bool stopRequired, std::vector<std::string>& elems)
{
size_t found = s.find(start);
if (found == string::npos)
return elems;
size_t offset = found + start.size();
size_t end = s.find(stop, offset);
if (end == string::npos && stopRequired)
return elems;
elems.push_back(s.substr(0,found));
if (end != string::npos)
{
elems.push_back(s.substr(offset, end - offset));
elems.push_back(s.substr(end + 1));
}
else
{
elems.push_back(s.substr(offset));
elems.push_back("");
}
return elems;
}
std::vector<std::string> parseBetween(const std::string& s, string start, string stop, bool stopRequired)
{
std::vector<std::string> elems;
return parseBetween(s, start, stop, stopRequired, elems);
}
// This is a customized word wrap based on pixel width. It tries it's best
// to wrap strings using spaces as delimiters.
// Not sure how this translates into non-english fonts.