Erwan
- 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:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user