Huge engine change, replace all std::shared_ptrs

Create a new shared pointer type stdext::shared_object_ptr and stdext::shared_obj
using boost::intrusive_ptr

Advantages:
 * half memory usage
 * faster and lightweight

Disadvantages:
 * using weak_ptr is not supported anymore
 * compiling seems slower
This commit is contained in:
Eduardo Bart
2012-07-29 00:34:40 -03:00
parent 3ca6494343
commit e0431021b5
81 changed files with 314 additions and 336 deletions

View File

@@ -34,7 +34,7 @@ bool ParticleSystem::load(const OTMLNodePtr& node)
{
for(const OTMLNodePtr& childNode : node->children()) {
if(childNode->tag() == "Emitter") {
ParticleEmitterPtr emitter = ParticleEmitterPtr(new ParticleEmitter(shared_from_this()));
ParticleEmitterPtr emitter = ParticleEmitterPtr(new ParticleEmitter());
if(!emitter->load(childNode))
return false;
m_emitters.push_back(emitter);
@@ -84,6 +84,7 @@ void ParticleSystem::update()
return;
m_lastUpdateTime = g_clock.seconds() - std::fmod(elapsedTime, delay);
auto self = self_cast<ParticleSystem>();
for(int i = 0; i < elapsedTime / delay; ++i) {
// update emitters
@@ -93,7 +94,7 @@ void ParticleSystem::update()
it = m_emitters.erase(it);
continue;
}
emitter->update(delay);
emitter->update(delay, self);
++it;
}