- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
std::list<CCPoint> GameMap::stringToCCPArray(std::string points_string, float _x, float _y)
{
points_string.push_back(' ');
std::list<CCPoint> CCPList = list<CCPoint>();
float x = 0.0f;
float y = 0.0f;
unsigned int len = 0;
bool isCurrentX = true;
for(std::string::iterator it = points_string.begin(); it != points_string.end(); ++it){
int q = 0;
len > 0 ?
--len: (isdigit(*it) ?
(q = atoi(&(*it)), len = countNumbersInInt(q),
isCurrentX ?
x = atoi(&(*it)): y = atoi(&(*it))) :
*it == ',' ?
(isCurrentX = false): (CCPList.push_back(ccp(x,(-1 * y))), x = 0.0f, y = 0.0f, isCurrentX = true)) ;
}
return CCPList;
}