summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-12-27 13:47:05 -0700
committerIra Rice <irarice@gmail.com>2008-12-27 13:47:05 -0700
commit28f93e08a567dfceae93a0b70997eaa3e9593a4b (patch)
tree12ea13ddf0b2097bb944547258dad82d4757190f /src/resources/mapreader.cpp
parentc312d9ca72368542990c6c9d7171bebd84c5c9ab (diff)
downloadmana-client-28f93e08a567dfceae93a0b70997eaa3e9593a4b.tar.gz
mana-client-28f93e08a567dfceae93a0b70997eaa3e9593a4b.tar.bz2
mana-client-28f93e08a567dfceae93a0b70997eaa3e9593a4b.tar.xz
mana-client-28f93e08a567dfceae93a0b70997eaa3e9593a4b.zip
Remove ../ from tileset files.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index bb444330..c6b6d1cd 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -454,6 +454,8 @@ Tileset *MapReader::readTileset(xmlNodePtr node,
if (xmlHasProp(node, BAD_CAST "source"))
{
std::string filename = XML::getProperty(node, "source", "");
+ while (filename.substr(0, 3) == "../")
+ filename.erase(0, 3); // Remove "../"
doc = new XML::Document(filename);
node = doc->rootNode();
firstGid += XML::getProperty(node, "firstgid", 0);
@@ -473,7 +475,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node,
{
std::string sourceStr = source;
while (sourceStr.substr(0, 3) == "../")
- sourceStr.erase(0, 3); // Remove "../"
+ sourceStr.erase(0, 3); // Remove "../"
ResourceManager *resman = ResourceManager::getInstance();
Image* tilebmp = resman->getImage(sourceStr);