diff options
author | chai <chaifix@163.com> | 2018-11-26 16:37:02 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-11-26 16:37:02 +0800 |
commit | f49291959d22b9f05f0c19a31c3f9a8905805014 (patch) | |
tree | 9521247e6a9381548c8958755b0ca603570b519e /src/lua/common/je_lua_shared.cpp | |
parent | 24b712a956a48f43788e1c11e121aedf52e22278 (diff) |
*lua bind
Diffstat (limited to 'src/lua/common/je_lua_shared.cpp')
-rw-r--r-- | src/lua/common/je_lua_shared.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/lua/common/je_lua_shared.cpp b/src/lua/common/je_lua_shared.cpp index acf1494..b95d1a0 100644 --- a/src/lua/common/je_lua_shared.cpp +++ b/src/lua/common/je_lua_shared.cpp @@ -15,21 +15,17 @@ namespace JinEngine { if (--mCount <= 0) { - // Remove all objects referenced by object. luax_removereference(mL, this); - // Remove game object reference. luax_removeobject(mL, this); delete this; } } - void SharedBase::setDependency(int key, SharedBase* shared) + void SharedBase::setDependency(int key, SharedBase* dep) { removeDependency(key); - shared->retain(); - mDependencies.insert(std::pair<int, SharedBase*>(key, shared)); - // Set lua reference. - luax_addreference(mL, this, shared); + mDependencies.insert(std::pair<int, SharedBase*>(key, dep)); + luax_addreference(mL, this, dep); } void SharedBase::removeDependency(int key) @@ -38,9 +34,7 @@ namespace JinEngine return; DepsMap::iterator it = mDependencies.find(key); SharedBase* dep = it->second; - // Remove lua reference. luax_removereference(mL, this, dep); - dep->release(); mDependencies.erase(it); } @@ -51,8 +45,6 @@ namespace JinEngine SharedBase* dep = it->second; if (dep == dependency) { - dep->release(); - // Remove lua reference. luax_removereference(mL, this, dep); mDependencies.erase(it); } @@ -79,7 +71,7 @@ namespace JinEngine void SharedBase::clearDependencies() { for (std::pair<int, SharedBase*> dep : mDependencies) - dep.second->release(); + luax_removereference(mL, this); mDependencies.clear(); } @@ -92,7 +84,7 @@ namespace JinEngine bool SharedBase::isType(const char* t) { - return strcmp(type, t) == 0; + return strcmp(mType, t) == 0; } int SharedBase::getDependencyCount() @@ -100,6 +92,10 @@ namespace JinEngine return mDependencies.size(); } + const char* SharedBase::getType() + { + return mType; + } } }
\ No newline at end of file |