aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/LResource.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbTk/LResource.cc')
-rw-r--r--src/FbTk/LResource.cc29
1 files changed, 2 insertions, 27 deletions
diff --git a/src/FbTk/LResource.cc b/src/FbTk/LResource.cc
index fd8ef2f..5842b65 100644
--- a/src/FbTk/LResource.cc
+++ b/src/FbTk/LResource.cc
@@ -108,8 +108,7 @@ void LResourceManager::addResource(Resource_base &r) {
108 m_l->checkstack(5); 108 m_l->checkstack(5);
109 lua::stack_sentry s(*m_l); 109 lua::stack_sentry s(*m_l);
110 110
111 m_resourcelist.push_back(&r); 111 ResourceManager_base::addResource(r);
112 m_resourcelist.unique();
113 112
114 m_l->getfield(lua::REGISTRYINDEX, register_resource); 113 m_l->getfield(lua::REGISTRYINDEX, register_resource);
115 m_l->getfield(lua::GLOBALSINDEX, m_root.c_str()); 114 m_l->getfield(lua::GLOBALSINDEX, m_root.c_str());
@@ -133,31 +132,7 @@ void LResourceManager::removeResource(Resource_base &r) {
133 *static_cast<Resource_base **>(m_l->touserdata(-1)) = NULL; 132 *static_cast<Resource_base **>(m_l->touserdata(-1)) = NULL;
134 m_l->pop(); 133 m_l->pop();
135 134
136 m_resourcelist.remove(&r); 135 ResourceManager_base::removeResource(r);
137}
138
139Resource_base *LResourceManager::findResource(const std::string &resname) {
140 // find resource name
141 ResourceList::const_iterator i = m_resourcelist.begin();
142 ResourceList::const_iterator i_end = m_resourcelist.end();
143 for (; i != i_end; ++i) {
144 if ((*i)->name() == resname ||
145 (*i)->altName() == resname)
146 return *i;
147 }
148 return 0;
149}
150
151const Resource_base *LResourceManager::findResource(const std::string &resname) const {
152 // find resource name
153 ResourceList::const_iterator i = m_resourcelist.begin();
154 ResourceList::const_iterator i_end = m_resourcelist.end();
155 for (; i != i_end; ++i) {
156 if ((*i)->name() == resname ||
157 (*i)->altName() == resname)
158 return *i;
159 }
160 return 0;
161} 136}
162 137
163} // end namespace FbTk 138} // end namespace FbTk