|
|
|
@ -16,7 +16,7 @@ |
|
|
|
|
#include "map.h" |
|
|
|
|
#include "SeasonI.h" |
|
|
|
|
|
|
|
|
|
#include "test/test.h" |
|
|
|
|
//#include "test/test.h"
|
|
|
|
|
|
|
|
|
|
#ifndef TEST_SUITE |
|
|
|
|
#define OLC_PGE_APPLICATION |
|
|
|
@ -4275,33 +4275,24 @@ void SeasonI::CalculateEquipmentStats(int partyMemberSlot,int&atk,int&def) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string SeasonI::Wrap(std::string str,int width,bool proportional,vd2d scale) { |
|
|
|
|
int marker=0; |
|
|
|
|
std::string newStr=""; |
|
|
|
|
bool firstChar=false; |
|
|
|
|
while (marker<str.length()) { |
|
|
|
|
if (firstChar||!firstChar&&str[marker]!=' ') { |
|
|
|
|
newStr+=str[marker]; |
|
|
|
|
} |
|
|
|
|
vd2d siz; |
|
|
|
|
if (proportional) { |
|
|
|
|
siz={GetTextSizeProp(newStr).x*scale.x,GetTextSizeProp(newStr).y*scale.y}; |
|
|
|
|
std::string newStr; |
|
|
|
|
while (true) { |
|
|
|
|
std::string word; |
|
|
|
|
if (str.find(" ")==std::string::npos) { |
|
|
|
|
word=str; |
|
|
|
|
} else { |
|
|
|
|
siz={GetTextSize(newStr).x*scale.x,GetTextSize(newStr).y*scale.y}; |
|
|
|
|
word = str.substr(0,str.find(" ")); |
|
|
|
|
} |
|
|
|
|
if (siz.x>width) { |
|
|
|
|
do { |
|
|
|
|
if (newStr[newStr.length()-1]!=' ') { |
|
|
|
|
marker--; |
|
|
|
|
//printf("%s\n",newStr.c_str());
|
|
|
|
|
} |
|
|
|
|
newStr.erase(newStr.end()-1); |
|
|
|
|
} while (newStr[newStr.length()-1]!=' '); |
|
|
|
|
//newStr.erase(newStr.end()-1);
|
|
|
|
|
newStr+='\n'; |
|
|
|
|
firstChar=false; |
|
|
|
|
vi2d newSize = (proportional?GetTextSizeProp(newStr+(newStr.size()>0?" ":"")+word):GetTextSize(newStr+(newStr.size()>0?" ":"")+word))*scale; |
|
|
|
|
if (newSize.x>width) { |
|
|
|
|
newStr+="\n"+word; |
|
|
|
|
} else { |
|
|
|
|
newStr+=(newStr.size()>0?" ":"")+word; |
|
|
|
|
} |
|
|
|
|
if (str.find(" ")==std::string::npos) { |
|
|
|
|
break; |
|
|
|
|
} else { |
|
|
|
|
firstChar=true; |
|
|
|
|
marker++; |
|
|
|
|
str.erase(0,str.find(" ")+1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return newStr; |
|
|
|
|