aboutsummaryrefslogtreecommitdiff
path: root/src/nodedef.cpp
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2016-02-09 07:08:31 +0100
committerest31 <MTest31@outlook.com>2016-03-07 19:54:26 +0100
commitd494733839e9cf6cb557462326ed21e7a58816c7 (patch)
tree07ead00672b0096aa2a60938b769bf030bba2951 /src/nodedef.cpp
parent88fbe7ca1e5451851ee0c7ab5524c39a7bb703c2 (diff)
downloadminetest-d494733839e9cf6cb557462326ed21e7a58816c7.tar.gz
minetest-d494733839e9cf6cb557462326ed21e7a58816c7.tar.bz2
minetest-d494733839e9cf6cb557462326ed21e7a58816c7.zip
Add minetest.register_lbm() to run code on block load only
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r--src/nodedef.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp
index 1dd5aa537..ba9b4abf2 100644
--- a/src/nodedef.cpp
+++ b/src/nodedef.cpp
@@ -419,7 +419,7 @@ public:
inline virtual const ContentFeatures& get(const MapNode &n) const;
virtual bool getId(const std::string &name, content_t &result) const;
virtual content_t getId(const std::string &name) const;
- virtual void getIds(const std::string &name, std::set<content_t> &result) const;
+ virtual bool getIds(const std::string &name, std::set<content_t> &result) const;
virtual const ContentFeatures& get(const std::string &name) const;
content_t allocateId();
virtual content_t set(const std::string &name, const ContentFeatures &def);
@@ -603,22 +603,23 @@ content_t CNodeDefManager::getId(const std::string &name) const
}
-void CNodeDefManager::getIds(const std::string &name,
+bool CNodeDefManager::getIds(const std::string &name,
std::set<content_t> &result) const
{
//TimeTaker t("getIds", NULL, PRECISION_MICRO);
if (name.substr(0,6) != "group:") {
content_t id = CONTENT_IGNORE;
- if(getId(name, id))
+ bool exists = getId(name, id);
+ if (exists)
result.insert(id);
- return;
+ return exists;
}
std::string group = name.substr(6);
std::map<std::string, GroupItems>::const_iterator
i = m_group_to_items.find(group);
if (i == m_group_to_items.end())
- return;
+ return true;
const GroupItems &items = i->second;
for (GroupItems::const_iterator j = items.begin();
@@ -627,6 +628,7 @@ void CNodeDefManager::getIds(const std::string &name,
result.insert((*j).first);
}
//printf("getIds: %dus\n", t.stop());
+ return true;
}