aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mapgen.cpp')
-rw-r--r--src/mapgen.cpp15
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();
+}