1 void GameLevel::ParsePath(const char */*pName*/, const TiXmlNode *WorldCoordNode) 2 { 3 tLevelWall LevelWall; 4 BOOL bFirst = TRUE; 5 6 // Might use name if we use paths for more than walls in the future 7 8 for(const TiXmlNode* CoordNode = WorldCoordNode; CoordNode; 9 CoordNode = CoordNode->NextSibling()) 10 { 11 if (bFirst) 12 { 13 LevelWall.StartingPoint.x = atof(CoordNode->FirstChild("X")->FirstChild()->Value()); 14 LevelWall.StartingPoint.y = atof(CoordNode->FirstChild("Y")->FirstChild()->Value()); 15 bFirst = FALSE; 16 } 17 else 18 { 19 cpFloat SwapVal; 20 21 LevelWall.EndingPoint.x = atof(CoordNode->FirstChild("X")->FirstChild()->Value()); 22 LevelWall.EndingPoint.y = atof(CoordNode->FirstChild("Y")->FirstChild()->Value()); 23 LevelWall.bIsRect = FALSE; 24 25 mWalls.push_back(LevelWall); 26 27 printf("Path Start x %f end %f\n", LevelWall.StartingPoint.x, LevelWall.EndingPoint.x); 28 printf("Path Start y %f end %f\n", LevelWall.StartingPoint.y, LevelWall.EndingPoint.y); 29 30 LevelWall.StartingPoint = LevelWall.EndingPoint; 31 } 32 } 33 }