[FIX] Now using stringstream instead of itoa to stringify.

This commit is contained in:
Tamir Atias 2012-01-07 04:49:10 +02:00
parent cb4f7f54d1
commit d128c32af3
2 changed files with 8 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" ?> <?xml version="1.0" ?>
<save> <save>
<name>Allanis</name> <name>Allanis</name>
<x>572</x> <x>804</x>
<y>364</y> <y>628</y>
<map>map</map> <map>map</map>
</save> </save>

View File

@ -258,18 +258,18 @@ void Game::SaveSavegame(void) {
TiXmlText* nameText = new TiXmlText("Allanis"); //TODO: replace with _player->GetName() when it works. --konom TiXmlText* nameText = new TiXmlText("Allanis"); //TODO: replace with _player->GetName() when it works. --konom
nameElement->LinkEndChild(nameText); nameElement->LinkEndChild(nameText);
char xString[16]; std::stringstream xString;
itoa(_player->GetX(), xString, 10); xString << _player->GetX();
TiXmlElement* xElement = new TiXmlElement("x"); TiXmlElement* xElement = new TiXmlElement("x");
TiXmlText* xText = new TiXmlText(xString); TiXmlText* xText = new TiXmlText(xString.str().c_str());
xElement->LinkEndChild(xText); xElement->LinkEndChild(xText);
char yString[16]; std::stringstream yString;
itoa(_player->GetY(), yString, 10); yString << _player->GetY();
TiXmlElement* yElement = new TiXmlElement("y"); TiXmlElement* yElement = new TiXmlElement("y");
TiXmlText* yText = new TiXmlText(yString); TiXmlText* yText = new TiXmlText(yString.str().c_str());
yElement->LinkEndChild(yText); yElement->LinkEndChild(yText);
TiXmlElement* mapElement = new TiXmlElement("map"); TiXmlElement* mapElement = new TiXmlElement("map");