- fixed memory leak in AEquip/ATeach 
- Test suite now trims strings correctly (allows to have space between comma-separated card names)
- Added Paradise Mantle (for ATeach test)
- removed a missing wallpaper from wallpapers list
This commit is contained in:
wagic.the.homebrew@gmail.com
2010-11-07 02:27:54 +00:00
parent b2ee9c0f41
commit 416617fc0d
7 changed files with 72 additions and 40 deletions

View File

@@ -219,40 +219,40 @@ std::vector<std::string> split(const std::string &s, char delim) {
}
std::string wordWrap(std::string sentence, int width)
{
std::string::iterator it = sentence.begin();
//remember how long next word is
int nextWordLength = 0;
int distanceFromWidth = width;
while (it != sentence.end())
{
while (*it != ' ')
{
nextWordLength++;
distanceFromWidth--;
++it;
// check if done
if (it == sentence.end())
{
return sentence;
}
}
if (nextWordLength > distanceFromWidth)
{
*it = '\n';
distanceFromWidth = width;
nextWordLength = 0;
}
//skip the space
++it;
}
return sentence;
std::string wordWrap(std::string sentence, int width)
{
std::string::iterator it = sentence.begin();
//remember how long next word is
int nextWordLength = 0;
int distanceFromWidth = width;
while (it != sentence.end())
{
while (*it != ' ')
{
nextWordLength++;
distanceFromWidth--;
++it;
// check if done
if (it == sentence.end())
{
return sentence;
}
}
if (nextWordLength > distanceFromWidth)
{
*it = '\n';
distanceFromWidth = width;
nextWordLength = 0;
}
//skip the space
++it;
}
return sentence;
}