diff options
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r-- | src/resources/mapreader.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index d6154ee0..b1068510 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -446,13 +446,17 @@ MapReader::readTileset(xmlNodePtr node, const std::string &path, Map *map) { + int firstGid = XML::getProperty(node, "firstgid", 0); + XML::Document* doc = NULL; + if (xmlHasProp(node, BAD_CAST "source")) { - logger->log("Warning: External tilesets not supported yet."); - return NULL; + std::string filename = XML::getProperty(node, "source", ""); + doc = new XML::Document(filename); + node = doc->rootNode(); + firstGid += XML::getProperty(node, "firstgid", 0); } - const int firstGid = XML::getProperty(node, "firstgid", 0); const int tw = XML::getProperty(node, "tilewidth", map->getTileWidth()); const int th = XML::getProperty(node, "tileheight", map->getTileHeight()); @@ -475,6 +479,8 @@ MapReader::readTileset(xmlNodePtr node, { Tileset *set = new Tileset(tilebmp, tw, th, firstGid); tilebmp->decRef(); + if (doc) + delete doc; return set; } else { @@ -486,5 +492,8 @@ MapReader::readTileset(xmlNodePtr node, break; } + if (doc) + delete doc; + return NULL; } |