diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/resources/beingcommon.cpp | 17 | ||||
-rw-r--r-- | src/resources/db/homunculusdb.cpp | 15 | ||||
-rw-r--r-- | src/resources/db/mercenarydb.cpp | 15 | ||||
-rw-r--r-- | src/resources/db/monsterdb.cpp | 15 |
4 files changed, 17 insertions, 45 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, diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp index 4526228e4..1b5e1650b 100644 --- a/src/resources/db/homunculusdb.cpp +++ b/src/resources/db/homunculusdb.cpp @@ -106,21 +106,6 @@ void HomunculusDB::loadXmlFile(const std::string &fileName) currentInfo->setColorsList(XML::getProperty(homunculusNode, "colors", "")); - unsigned char block = 0; - std::string walkStr = XML::getProperty( - homunculusNode, "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; - - currentInfo->setBlockWalkMask(static_cast<unsigned char>( - BlockMask::WALL | block)); - if (currentInfo->getMaxHP()) currentInfo->setStaticMaxHP(true); diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp index cdd4c71e1..5ca92e347 100644 --- a/src/resources/db/mercenarydb.cpp +++ b/src/resources/db/mercenarydb.cpp @@ -105,21 +105,6 @@ void MercenaryDB::loadXmlFile(const std::string &fileName) currentInfo->setColorsList(XML::getProperty(mercenaryNode, "colors", "")); - unsigned char block = 0; - std::string walkStr = XML::getProperty( - mercenaryNode, "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; - - currentInfo->setBlockWalkMask(static_cast<unsigned char>( - BlockMask::WALL | block)); - if (currentInfo->getMaxHP()) currentInfo->setStaticMaxHP(true); diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp index a7eda3681..c5e80e866 100644 --- a/src/resources/db/monsterdb.cpp +++ b/src/resources/db/monsterdb.cpp @@ -112,21 +112,6 @@ void MonsterDB::loadXmlFile(const std::string &fileName) currentInfo->setColorsList(XML::getProperty(monsterNode, "colors", "")); - unsigned char block = 0; - std::string walkStr = XML::getProperty( - monsterNode, "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; - - currentInfo->setBlockWalkMask(static_cast<unsigned char>( - BlockMask::WALL | block)); - if (currentInfo->getMaxHP()) currentInfo->setStaticMaxHP(true); |