diff options
author | Ira Rice <irarice@gmail.com> | 2008-12-03 15:00:30 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-12-03 15:00:30 -0700 |
commit | 37900285377966500d4f97a67dc37327f097ff8a (patch) | |
tree | f7489d251f79f5b3245cffe1ebcdfc586d28f203 /src/resources | |
parent | 7d6c6b7a5711536bbb8262312457b8422cf883bb (diff) | |
download | mana-37900285377966500d4f97a67dc37327f097ff8a.tar.gz mana-37900285377966500d4f97a67dc37327f097ff8a.tar.bz2 mana-37900285377966500d4f97a67dc37327f097ff8a.tar.xz mana-37900285377966500d4f97a67dc37327f097ff8a.zip |
Changed tileset code so that it removes all ... paths. This assumes that
the tileset to be loaded will not be in a different root directory than
the tsx file.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/mapreader.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index b1068510..894cc4fc 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -470,7 +470,8 @@ MapReader::readTileset(xmlNodePtr node, if (!source.empty()) { std::string sourceStr = source; - sourceStr.erase(0, 3); // Remove "../" + while (sourceStr.substr(0, 3) == "../") + sourceStr.erase(0, 3); // Remove "../" ResourceManager *resman = ResourceManager::getInstance(); Image* tilebmp = resman->getImage(sourceStr); @@ -479,8 +480,7 @@ MapReader::readTileset(xmlNodePtr node, { Tileset *set = new Tileset(tilebmp, tw, th, firstGid); tilebmp->decRef(); - if (doc) - delete doc; + delete doc; return set; } else { @@ -492,8 +492,7 @@ MapReader::readTileset(xmlNodePtr node, break; } - if (doc) - delete doc; + delete doc; return NULL; } |