mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-23 23:10:55 +00:00
preparations for gems save format update; not yet sure how to best do this so i'm leaving it at that
This commit is contained in:
parent
9047e5e083
commit
73c58b3153
1 changed files with 37 additions and 31 deletions
|
@ -2310,47 +2310,53 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
|
||||||
|
|
||||||
XMLElement *gems = doc.NewElement("Gems");
|
XMLElement *gems = doc.NewElement("Gems");
|
||||||
{
|
{
|
||||||
std::ostringstream os;
|
// old gems format; used in 1.1.x <= 1.1.3
|
||||||
bool hasUserString = false;
|
|
||||||
os << this->gems.size() << " ";
|
|
||||||
for (Gems::iterator i = this->gems.begin(); i != this->gems.end(); i++)
|
|
||||||
{
|
{
|
||||||
os << (*i).name << " " << (*i).pos.x << " " << (*i).pos.y << " ";
|
std::ostringstream os;
|
||||||
os << (*i).canMove << " ";
|
bool hasUserString = false;
|
||||||
|
os << this->gems.size() << " ";
|
||||||
|
for (Gems::iterator i = this->gems.begin(); i != this->gems.end(); i++)
|
||||||
|
{
|
||||||
|
os << (*i).name << " " << (*i).pos.x << " " << (*i).pos.y << " ";
|
||||||
|
os << (*i).canMove << " ";
|
||||||
|
|
||||||
hasUserString = !(*i).userString.empty();
|
hasUserString = !(*i).userString.empty();
|
||||||
|
|
||||||
os << hasUserString << " ";
|
os << hasUserString << " ";
|
||||||
|
|
||||||
if (hasUserString)
|
if (hasUserString)
|
||||||
os << spacesToUnderscores((*i).userString) << " ";
|
os << spacesToUnderscores((*i).userString) << " ";
|
||||||
|
}
|
||||||
|
gems->SetAttribute("c", os.str().c_str());
|
||||||
}
|
}
|
||||||
gems->SetAttribute("c", os.str().c_str());
|
|
||||||
|
|
||||||
// This is the format used in the android version. Keeping this commented out for now,
|
// This is the format used in the android version.
|
||||||
// but it should be used instead of the code above in some time -- FG
|
|
||||||
/*
|
|
||||||
os.str("");
|
|
||||||
bool hasMapName = false;
|
|
||||||
os << this->gems.size() << " ";
|
|
||||||
for (Gems::iterator i = this->gems.begin(); i != this->gems.end(); i++)
|
|
||||||
{
|
{
|
||||||
os << (*i).name << " ";
|
std::ostringstream os;
|
||||||
hasMapName = !(*i).mapName.empty();
|
os << this->gems.size() << " ";
|
||||||
os << hasMapName << " ";
|
for (Gems::iterator i = this->gems.begin(); i != this->gems.end(); i++)
|
||||||
if(hasMapName)
|
{
|
||||||
os << (*i).mapName << " "; // warning: this will fail to load if the map name contains whitespace
|
os << (*i).name << " ";
|
||||||
|
bool hasMapName = !(*i).mapName.empty();
|
||||||
|
os << hasMapName << " ";
|
||||||
|
if(hasMapName)
|
||||||
|
os << (*i).mapName << " "; // warning: this will fail to load if the map name contains whitespace
|
||||||
|
|
||||||
os << (*i).pos.x << " " << (*i).pos.y << " ";
|
os << (*i).pos.x << " " << (*i).pos.y << " ";
|
||||||
os << (*i).canMove << " ";
|
os << (*i).canMove << " ";
|
||||||
|
|
||||||
|
bool hasUserString = !(*i).userString.empty();
|
||||||
|
os << hasUserString << " ";
|
||||||
|
if (hasUserString)
|
||||||
|
os << spacesToUnderscores((*i).userString) << " ";
|
||||||
|
}
|
||||||
|
gems->SetAttribute("d", os.str().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
// newest format; is aware if tile-relative position
|
||||||
|
{
|
||||||
|
|
||||||
hasUserString = !(*i).userString.empty();
|
|
||||||
os << hasUserString << " ";
|
|
||||||
if (hasUserString)
|
|
||||||
os << spacesToUnderscores((*i).userString) << " ";
|
|
||||||
}
|
}
|
||||||
gems->SetAttribute("d", os.str());
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
doc.InsertEndChild(gems);
|
doc.InsertEndChild(gems);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue