diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/monsterdb.cpp | 8 | ||||
-rw-r--r-- | src/resources/monsterdb.h | 2 | ||||
-rw-r--r-- | src/resources/settingsmanager.cpp | 8 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index 5fd74c24..c4abeecf 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -53,11 +53,15 @@ void MonsterDB::init() if (mLoaded) unload(); - // This used to be read from offset attribute of monsters root tag, however - // I couldn't find any place it was used, so for now the default values are set + // This can be overridden by an 'offset' attribute on a 'monsters' root tag. mMonsterIdOffset = Net::getNetworkType() == ServerInfo::TMWATHENA ? OLD_TMWATHENA_OFFSET : 0; } +void MonsterDB::setMonsterIdOffset(int offset) +{ + mMonsterIdOffset = offset; +} + /** * Read <monster> node from settings. */ diff --git a/src/resources/monsterdb.h b/src/resources/monsterdb.h index 5b2f3c2d..dc8b50cb 100644 --- a/src/resources/monsterdb.h +++ b/src/resources/monsterdb.h @@ -33,6 +33,8 @@ namespace MonsterDB { void init(); + void setMonsterIdOffset(int offset); + void readMonsterNode(xmlNodePtr node, const std::string &filename); void checkStatus(); diff --git a/src/resources/settingsmanager.cpp b/src/resources/settingsmanager.cpp index b307d565..f4a40577 100644 --- a/src/resources/settingsmanager.cpp +++ b/src/resources/settingsmanager.cpp @@ -121,6 +121,14 @@ namespace SettingsManager return false; } + if (xmlStrEqual(node->name, BAD_CAST "monsters")) + { + if (XML::hasProperty(node, "offset")) + { + MonsterDB::setMonsterIdOffset(XML::getProperty(node, "offset", 0)); + } + } + // go through every node for_each_xml_child_node(childNode, node) { |