added garbage collection to obj mgr

This commit is contained in:
Lauchmelder 2021-12-24 16:21:52 +01:00
parent 9629779b2a
commit 1610813bbe

View file

@ -56,6 +56,17 @@ namespace lol
return it->second;
}
inline void Return(unsigned int id)
{
auto it = objects.find(id);
if (it == objects.end())
return;
if (it->second.use_count() < 3) // I hope I don't forget about this if I ever go multithreaded
objects.erase(it);
}
private:
ObjectManager() {}