diff options
author | Philipp Sehmisch <crush@themanaworld.org> | 2009-03-19 20:10:27 +0100 |
---|---|---|
committer | Philipp Sehmisch <crush@themanaworld.org> | 2009-03-19 20:10:27 +0100 |
commit | 3dec609dc5f343547fad87dbbd3d7c7e2c59dde5 (patch) | |
tree | e272c0d3ae0c56b9b455d81718b9a51e7439b101 /src/game-server/mapreader.cpp | |
parent | 53cde41db10d69120cdc46f278178fc5667744a1 (diff) | |
download | manaserv-3dec609dc5f343547fad87dbbd3d7c7e2c59dde5.tar.gz manaserv-3dec609dc5f343547fad87dbbd3d7c7e2c59dde5.tar.bz2 manaserv-3dec609dc5f343547fad87dbbd3d7c7e2c59dde5.tar.xz manaserv-3dec609dc5f343547fad87dbbd3d7c7e2c59dde5.zip |
Implemented the possibility to have maps with or without PvP combat.
PvP is governed by the map property "pvp". Currently it can be either "none" for no PvP combat or "free" for unrestricted PvP combat. "none" is the default value which is used when pvp is undefined. Later addition of more sophisticated PvP modes is possible.
Diffstat (limited to 'src/game-server/mapreader.cpp')
-rw-r--r-- | src/game-server/mapreader.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/game-server/mapreader.cpp b/src/game-server/mapreader.cpp index 9caddc24..758b37ee 100644 --- a/src/game-server/mapreader.cpp +++ b/src/game-server/mapreader.cpp @@ -114,7 +114,7 @@ void MapReader::readMap(const std::string &filename, MapComposite *composite) } } -Map* MapReader::readMap(xmlNodePtr node, std::string const &path, +Map* MapReader::readMap(xmlNodePtr node, std::string const &path, MapComposite *composite, std::vector<Thing *> &things) { // Take the filename off the path @@ -140,6 +140,19 @@ Map* MapReader::readMap(xmlNodePtr node, std::string const &path, ::tilesetFirstGids.push_back(XML::getProperty(node, "firstgid", 0)); } } + else if (xmlStrEqual(node->name, BAD_CAST "properties")) + { + for_each_xml_child_node(propNode, node) + { + if (xmlStrEqual(propNode->name, BAD_CAST "property")) + { + std::string key = XML::getProperty(propNode, "name", ""); + std::string val = XML::getProperty(propNode, "value", ""); + LOG_DEBUG(" "<<key<<": "<<val); + map->setProperty(key, val); + } + } + } else if (xmlStrEqual(node->name, BAD_CAST "layer")) { // Layer 3 is collision layer. @@ -166,7 +179,7 @@ Map* MapReader::readMap(xmlNodePtr node, std::string const &path, int objW = XML::getProperty(objectNode, "width", 0); int objH = XML::getProperty(objectNode, "height", 0); Rectangle rect = { objX, objY, objW, objH }; - + if (objType == "WARP") { @@ -236,7 +249,7 @@ Map* MapReader::readMap(xmlNodePtr node, std::string const &path, { if (xmlStrEqual(propertyNode->name, BAD_CAST "property")) { - std::string value = XML::getProperty(propertyNode, "name", std::string()); + std::string value = XML::getProperty(propertyNode, "name", std::string()); value = utils::toupper(value); if (value == "MONSTER_ID") { |