mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-01-24 17:26:41 +00:00
Fix a couple oversights in gem data loading
This commit is contained in:
parent
78005c1a51
commit
da7cd05ffa
1 changed files with 17 additions and 24 deletions
|
@ -2845,7 +2845,7 @@ bool Continuity::loadFile(int slot)
|
||||||
}
|
}
|
||||||
// ---- Legacy formats -----
|
// ---- Legacy formats -----
|
||||||
// This is the format used by the android version
|
// This is the format used by the android version
|
||||||
// num [name hasMapName (mapName) mapX mapY canMove hasUserString (userString)]
|
// num [name hasMapName (mapName) mapX mapY canMove hasUserString (userString)]...
|
||||||
else if (const char *attr = gems->Attribute("d"))
|
else if (const char *attr = gems->Attribute("d"))
|
||||||
{
|
{
|
||||||
SimpleIStringStream is(attr, SimpleIStringStream::REUSE);
|
SimpleIStringStream is(attr, SimpleIStringStream::REUSE);
|
||||||
|
@ -2853,26 +2853,21 @@ bool Continuity::loadFile(int slot)
|
||||||
int num = 0;
|
int num = 0;
|
||||||
is >> num;
|
is >> num;
|
||||||
|
|
||||||
bool hasUserString = false;
|
|
||||||
bool hasMapName = false;
|
|
||||||
GemData g;
|
GemData g;
|
||||||
|
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
g.pos = Vector(0,0,0);
|
bool hasUserString=false;
|
||||||
g.canMove = false;
|
bool hasMapName = false;
|
||||||
g.userString = "";
|
|
||||||
g.mapName = "";
|
|
||||||
|
|
||||||
hasUserString=false;
|
|
||||||
hasMapName = false;
|
|
||||||
|
|
||||||
is >> g.name;
|
is >> g.name;
|
||||||
is >> hasMapName;
|
is >> hasMapName;
|
||||||
if(hasMapName)
|
if(hasMapName)
|
||||||
is >> g.mapName;
|
is >> g.mapName;
|
||||||
|
else
|
||||||
|
g.mapName.clear();
|
||||||
|
|
||||||
is >> g.pos.x >> g.pos.y; // FIXME: check whether this is local coords or global coords
|
is >> g.pos.x >> g.pos.y; // This is in (global) worldmap coords!
|
||||||
is >> g.canMove;
|
is >> g.canMove;
|
||||||
is >> hasUserString;
|
is >> hasUserString;
|
||||||
|
|
||||||
|
@ -2883,7 +2878,7 @@ bool Continuity::loadFile(int slot)
|
||||||
this->gems.push_back(g);
|
this->gems.push_back(g);
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "Loading a Gem called [" << g.name << "] with userString [" << g.userString << "] pos (" << g.pos.x << ", " << g.pos.y << ")\n";
|
os << "Loading a Gem called [" << g.name << "] with userString [" << g.userString << "] pos (" << g.pos.x << ", " << g.pos.y << ")";
|
||||||
debugLog(os.str());
|
debugLog(os.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2896,32 +2891,27 @@ bool Continuity::loadFile(int slot)
|
||||||
int num = 0;
|
int num = 0;
|
||||||
is >> num;
|
is >> num;
|
||||||
|
|
||||||
bool hasUserString = false;
|
|
||||||
GemData g;
|
GemData g;
|
||||||
|
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
g.pos = Vector(0,0,0);
|
bool hasUserString=false;
|
||||||
g.canMove = false;
|
|
||||||
g.userString = "";
|
|
||||||
|
|
||||||
hasUserString=false;
|
|
||||||
|
|
||||||
is >> g.name;
|
is >> g.name;
|
||||||
is >> g.pos.x >> g.pos.y;
|
is >> g.pos.x >> g.pos.y; // This is in (global) worldmap coords!
|
||||||
is >> g.canMove;
|
is >> g.canMove;
|
||||||
is >> hasUserString;
|
is >> hasUserString;
|
||||||
|
|
||||||
if (hasUserString)
|
if (hasUserString)
|
||||||
is >> g.userString;
|
is >> g.userString;
|
||||||
else
|
else
|
||||||
g.userString = "";
|
g.userString.clear();
|
||||||
|
|
||||||
g.userString = underscoresToSpaces(g.userString);
|
g.userString = underscoresToSpaces(g.userString);
|
||||||
this->gems.push_back(g);
|
this->gems.push_back(g);
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "Loading a Gem called [" << g.name << "] with userString [" << g.userString << "] pos (" << g.pos.x << ", " << g.pos.y << ")\n";
|
os << "Loading a Gem called [" << g.name << "] with userString [" << g.userString << "] pos (" << g.pos.x << ", " << g.pos.y << ")";
|
||||||
debugLog(os.str());
|
debugLog(os.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2936,15 +2926,17 @@ bool Continuity::loadFile(int slot)
|
||||||
{
|
{
|
||||||
hasUserString=false;
|
hasUserString=false;
|
||||||
|
|
||||||
is >> g.pos.x >> g.pos.y;
|
is >> g.pos.x >> g.pos.y; // This is in (global) worldmap coords!
|
||||||
is >> g.canMove;
|
is >> g.canMove;
|
||||||
is >> hasUserString;
|
is >> hasUserString;
|
||||||
|
|
||||||
if (hasUserString)
|
if (hasUserString)
|
||||||
is >> g.userString;
|
is >> g.userString;
|
||||||
|
else
|
||||||
|
g.userString.clear();
|
||||||
|
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "Loading a Gem called [" << g.name << "] with userString [" << g.userString << "] pos (" << g.pos.x << ", " << g.pos.y << ")\n";
|
os << "Loading a Gem called [" << g.name << "] with userString [" << g.userString << "] pos (" << g.pos.x << ", " << g.pos.y << ")";
|
||||||
debugLog(os.str());
|
debugLog(os.str());
|
||||||
|
|
||||||
g.userString = underscoresToSpaces(g.userString);
|
g.userString = underscoresToSpaces(g.userString);
|
||||||
|
@ -2973,9 +2965,10 @@ bool Continuity::loadFile(int slot)
|
||||||
for(Gems::iterator it = this->gems.begin(); it != this->gems.end(); ++it)
|
for(Gems::iterator it = this->gems.begin(); it != this->gems.end(); ++it)
|
||||||
{
|
{
|
||||||
GemData& g = *it;
|
GemData& g = *it;
|
||||||
g.global = g.mapName.empty();
|
g.global = true; // ALL legacy map gems are stored in the global worldmap coordinate system (except the naija gem below)
|
||||||
if(doPlayerGem && !nocasecmp(g.name.c_str(), "Naija-Token")) // First gem with the special texture name is the player gem
|
if(doPlayerGem && !nocasecmp(g.name.c_str(), "Naija-Token")) // First gem with the special texture name is the player gem
|
||||||
{
|
{
|
||||||
|
doPlayerGem = false; // one is enough
|
||||||
g.isPlayer = true;
|
g.isPlayer = true;
|
||||||
g.blink = true;
|
g.blink = true;
|
||||||
g.global = false;
|
g.global = false;
|
||||||
|
|
Loading…
Reference in a new issue