[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" ?>
<save>
<name>Allanis</name>
<x>572</x>
<y>364</y>
<x>804</x>
<y>628</y>
<map>map</map>
</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
nameElement->LinkEndChild(nameText);
char xString[16];
itoa(_player->GetX(), xString, 10);
std::stringstream xString;
xString << _player->GetX();
TiXmlElement* xElement = new TiXmlElement("x");
TiXmlText* xText = new TiXmlText(xString);
TiXmlText* xText = new TiXmlText(xString.str().c_str());
xElement->LinkEndChild(xText);
char yString[16];
itoa(_player->GetY(), yString, 10);
std::stringstream yString;
yString << _player->GetY();
TiXmlElement* yElement = new TiXmlElement("y");
TiXmlText* yText = new TiXmlText(yString);
TiXmlText* yText = new TiXmlText(yString.str().c_str());
yElement->LinkEndChild(yText);
TiXmlElement* mapElement = new TiXmlElement("map");