diff options
author | kwolekr <kwolekr@minetest.net> | 2014-12-06 18:08:08 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2014-12-06 18:08:23 -0500 |
commit | 60feb4ad25003b4ed5f93f7fda7f4b8177a0ba51 (patch) | |
tree | 1b4a9e41b4bea77463cc1fb144ff88bfd790c404 /src/mapgen.cpp | |
parent | f3abaec83be741094ef1b0949e3400fb16729f97 (diff) | |
download | minetest-60feb4ad25003b4ed5f93f7fda7f4b8177a0ba51.tar.gz minetest-60feb4ad25003b4ed5f93f7fda7f4b8177a0ba51.tar.bz2 minetest-60feb4ad25003b4ed5f93f7fda7f4b8177a0ba51.zip |
Add minetest.clear_registered_biomes() api
Diffstat (limited to 'src/mapgen.cpp')
-rw-r--r-- | src/mapgen.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 44ce0c615..880ea1eea 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -419,22 +419,17 @@ GenElement *GenElementManager::get(u32 id) } -GenElement *GenElementManager::getByName(const char *name) +GenElement *GenElementManager::getByName(const std::string &name) { for (size_t i = 0; i != m_elements.size(); i++) { GenElement *elem = m_elements[i]; - if (elem && !strcmp(elem->name.c_str(), name)) + if (elem && name == elem->name) return elem; } return NULL; } -GenElement *GenElementManager::getByName(std::string &name) -{ - return getByName(name.c_str()); -} - GenElement *GenElementManager::update(u32 id, GenElement *elem) { @@ -451,3 +446,9 @@ GenElement *GenElementManager::remove(u32 id) { return update(id, NULL); } + + +void GenElementManager::clear() +{ + m_elements.clear(); +} |