1
This commit is contained in:
parent
4564dca5a6
commit
9b9b497ed2
@ -133,6 +133,9 @@ namespace mt
|
||||
|
||||
void MetaMgr::UnInit()
|
||||
{
|
||||
for (auto t : meta_tables) {
|
||||
t->destory_cb();
|
||||
}
|
||||
meta_tables.clear();
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,7 @@ namespace mt
|
||||
|
||||
struct MetaTable
|
||||
{
|
||||
std::function<void()> destory_cb;
|
||||
std::function<void()> static_pre_init_cb;
|
||||
std::function<void()> load_cb;
|
||||
std::vector<std::function<void()>> init_cbs;
|
||||
@ -82,6 +83,16 @@ namespace mt
|
||||
void RegMetaTable(const std::string& dir)
|
||||
{
|
||||
std::shared_ptr<mt::MetaTable> p = std::make_shared<mt::MetaTable>();
|
||||
p->destory_cb =
|
||||
[] ()
|
||||
{
|
||||
for (T* item : T::raw_list) {
|
||||
delete item;
|
||||
}
|
||||
T::raw_list.clear();
|
||||
T::id_hash.clear();
|
||||
T::name_hash.clear();
|
||||
};
|
||||
p->static_pre_init_cb =
|
||||
[] ()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user