summaryrefslogtreecommitdiff
path: root/src/resources/beingcommon.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-02 02:33:08 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-02 02:33:08 +0300
commit8700635293ff1d39266f0c1a8a77d2d28ba4a241 (patch)
tree18f6c103feca243b1b029fcb99faa643ffa51ac3 /src/resources/beingcommon.cpp
parentb49ae828a16ea9ddd4a06c92f2a5ef719c652e11 (diff)
downloadmanaverse-8700635293ff1d39266f0c1a8a77d2d28ba4a241.tar.gz
manaverse-8700635293ff1d39266f0c1a8a77d2d28ba4a241.tar.bz2
manaverse-8700635293ff1d39266f0c1a8a77d2d28ba4a241.tar.xz
manaverse-8700635293ff1d39266f0c1a8a77d2d28ba4a241.zip
Allow read "walkType" attributes from xml for all being types.
Diffstat (limited to 'src/resources/beingcommon.cpp')
-rw-r--r--src/resources/beingcommon.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp
index d78f9e7ad..b37a6e879 100644
--- a/src/resources/beingcommon.cpp
+++ b/src/resources/beingcommon.cpp
@@ -23,6 +23,8 @@
#include "configuration.h"
#include "logger.h"
+#include "enums/resources/map/blockmask.h"
+
#include "utils/files.h"
#include "resources/beinginfo.h"
@@ -50,6 +52,21 @@ void BeingCommon::readBasicAttributes(BeingInfo *const info,
info->setHpBarOffsetX(XML::getProperty(node, "hpBarOffsetX", 0));
info->setHpBarOffsetY(XML::getProperty(node, "hpBarOffsetY", 0));
+
+ unsigned char block = 0;
+ std::string walkStr = XML::getProperty(
+ node, "walkType", "walk");
+ if (walkStr == "walk")
+ block = BlockMask::WATER | BlockMask::AIR;
+ else if (walkStr == "fly")
+ block = 0;
+ else if (walkStr == "swim")
+ block = BlockMask::GROUND | BlockMask::AIR;
+ else if (walkStr == "walkswim" || walkStr == "swimwalk")
+ block = BlockMask::AIR;
+
+ info->setBlockWalkMask(static_cast<unsigned char>(
+ BlockMask::WALL | block));
}
void BeingCommon::getIncludeFiles(const std::string &dir,