summaryrefslogtreecommitdiff
path: root/src/resources/mapreader.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-14 09:27:43 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-14 09:27:43 +0000
commitd7904f7b7e25bbdd7205e5c18e06d184b2078732 (patch)
tree7f19693da61eb4a5944c220d3085530fd2e2a407 /src/resources/mapreader.cpp
parent24b1c618a11170e825598c5e22bf71f9238eae52 (diff)
downloadmana-d7904f7b7e25bbdd7205e5c18e06d184b2078732.tar.gz
mana-d7904f7b7e25bbdd7205e5c18e06d184b2078732.tar.bz2
mana-d7904f7b7e25bbdd7205e5c18e06d184b2078732.tar.xz
mana-d7904f7b7e25bbdd7205e5c18e06d184b2078732.zip
Added support for map properties, which minimap and background music
functionality can be based upon.
Diffstat (limited to 'src/resources/mapreader.cpp')
-rw-r--r--src/resources/mapreader.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index da7364a4..b62e6029 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -106,7 +106,22 @@ Map* MapReader::readMap(xmlNodePtr node, const std::string &path)
for (node = node->xmlChildrenNode; node != NULL; node = node->next)
{
- if (xmlStrEqual(node->name, BAD_CAST "tileset"))
+ if (xmlStrEqual(node->name, BAD_CAST "property"))
+ {
+ // Example: <property name="name" value="value"/>
+
+ xmlChar *name = xmlGetProp(node, BAD_CAST "name");
+ xmlChar *value = xmlGetProp(node, BAD_CAST "value");
+
+ if (name && value)
+ {
+ map->setProperty((const char*)name, (const char*)value);
+ }
+
+ if (name) xmlFree(name);
+ if (value) xmlFree(value);
+ }
+ else if (xmlStrEqual(node->name, BAD_CAST "tileset"))
{
Tileset *tileset = readTileset(node, pathDir, map);
if (tileset) {