mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-08-10 16:19:59 +00:00
Initial support for loading android save files.
Apparently there is a new map with the index 55 -- a related entry was added to the worldmap.txt file to prevent data loss, just in case. <StartData ch=... /> field is not yet handled missing. Hopefully the resulting format can be loaded on android without problems, especially because both "ingr" and "ingrNames" fields appear in the StartData tag now.
This commit is contained in:
parent
54d609a8b5
commit
416b521a12
2 changed files with 92 additions and 1 deletions
|
@ -2461,6 +2461,7 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
|
|||
startData.SetAttribute("scene", dsq->game->sceneName);
|
||||
startData.SetAttribute("exp", dsq->continuity.exp);
|
||||
startData.SetAttribute("h", dsq->continuity.maxHealth);
|
||||
// ANDROID TODO: "ch" field
|
||||
startData.SetAttribute("naijaModel", dsq->continuity.naijaModel);
|
||||
startData.SetAttribute("costume", dsq->continuity.costume);
|
||||
startData.SetAttribute("form", dsq->continuity.form);
|
||||
|
@ -2479,6 +2480,16 @@ void Continuity::saveFile(int slot, Vector position, unsigned char *scrShotData,
|
|||
}
|
||||
startData.SetAttribute("songs", os2.str());
|
||||
|
||||
// new format as used by android version
|
||||
std::ostringstream ingrNames;
|
||||
for (int i = 0; i < ingredients.size(); i++)
|
||||
{
|
||||
IngredientData *data = ingredients[i];
|
||||
ingrNames << data->name << " " << data->amount << " ";
|
||||
}
|
||||
startData.SetAttribute("ingrNames", ingrNames.str());
|
||||
|
||||
// for compatibility with older versions
|
||||
std::ostringstream ingrOs;
|
||||
for (int i = 0; i < ingredients.size(); i++)
|
||||
{
|
||||
|
@ -2551,6 +2562,9 @@ std::string Continuity::getSaveFileName(int slot, const std::string &pfix)
|
|||
void Continuity::loadFileData(int slot, TiXmlDocument &doc)
|
||||
{
|
||||
std::string teh_file = dsq->continuity.getSaveFileName(slot, "aqs");
|
||||
if(!exists(teh_file))
|
||||
teh_file = dsq->continuity.getSaveFileName(slot, "bin");
|
||||
|
||||
if (exists(teh_file))
|
||||
{
|
||||
unsigned long size = 0;
|
||||
|
@ -2810,7 +2824,9 @@ void Continuity::loadFile(int slot)
|
|||
|
||||
if (!tile)
|
||||
{
|
||||
errorLog("tile dummy");
|
||||
std::ostringstream os;
|
||||
os << "tile dummy: dropping data for worldmap tile index " << idx;
|
||||
debugLog(os.str());
|
||||
tile = &dummy;
|
||||
}
|
||||
|
||||
|
@ -2853,6 +2869,23 @@ void Continuity::loadFile(int slot)
|
|||
dsq->continuity.form = FormType(atoi(startData->Attribute("form")));
|
||||
}
|
||||
|
||||
if (startData->Attribute("ingrNames"))
|
||||
{
|
||||
std::istringstream is(startData->Attribute("ingrNames"));
|
||||
std::string name;
|
||||
while (is >> name)
|
||||
{
|
||||
int amount=0;
|
||||
is >> amount;
|
||||
IngredientData *data = getIngredientDataByName(name);
|
||||
if (data)
|
||||
{
|
||||
data->amount = 0;
|
||||
pickupIngredient(data, amount, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (startData->Attribute("ingr"))
|
||||
{
|
||||
std::istringstream is(startData->Attribute("ingr"));
|
||||
|
@ -2916,6 +2949,8 @@ void Continuity::loadFile(int slot)
|
|||
}
|
||||
}
|
||||
|
||||
// TODO ANDROID: "ch" field
|
||||
|
||||
if (startData->Attribute("h"))
|
||||
{
|
||||
int read = atoi(startData->Attribute("h"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue