]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/particles.cpp
Translated using Weblate (German)
[dragonfireclient.git] / src / particles.cpp
index 64b8936bd7154e7d9c230007141302b12d8f09fc..ebb54a49a1207a61ae1d8fdfba39fab6a774c327 100644 (file)
@@ -20,9 +20,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "particles.h"
 #include "constants.h"
 #include "debug.h"
-#include "main.h" // For g_profiler and g_settings
 #include "settings.h"
-#include "tile.h"
+#include "client/tile.h"
 #include "gamedef.h"
 #include "collision.h"
 #include <stdlib.h>
@@ -289,7 +288,7 @@ void ParticleSpawner::step(float dtime, ClientEnvironment* env)
                        }
                        else
                        {
-                               i++;
+                               ++i;
                        }
                }
        }
@@ -309,7 +308,7 @@ void ParticleSpawner::step(float dtime, ClientEnvironment* env)
                                                *(m_maxsize-m_minsize)
                                                +m_minsize;
 
-                               new Particle(
+                               Particle* toadd = new Particle(
                                        m_gamedef,
                                        m_smgr,
                                        m_player,
@@ -324,6 +323,7 @@ void ParticleSpawner::step(float dtime, ClientEnvironment* env)
                                        m_texture,
                                        v2f(0.0, 0.0),
                                        v2f(1.0, 1.0));
+                               m_particlemanager->addParticle(toadd);
                        }
                }
        }
@@ -347,7 +347,7 @@ void ParticleManager::step(float dtime)
 
 void ParticleManager::stepSpawners (float dtime)
 {
-       JMutexAutoLock lock(m_spawner_list_lock);
+       MutexAutoLock lock(m_spawner_list_lock);
        for(std::map<u32, ParticleSpawner*>::iterator i = 
                        m_particle_spawners.begin();
                        i != m_particle_spawners.end();)
@@ -360,14 +360,14 @@ void ParticleManager::stepSpawners (float dtime)
                else
                {
                        i->second->step(dtime, m_env);
-                       i++;
+                       ++i;
                }
        }
 }
 
 void ParticleManager::stepParticles (float dtime)
 {
-       JMutexAutoLock lock(m_particle_list_lock);
+       MutexAutoLock lock(m_particle_list_lock);
        for(std::vector<Particle*>::iterator i = m_particles.begin();
                        i != m_particles.end();)
        {
@@ -380,15 +380,15 @@ void ParticleManager::stepParticles (float dtime)
                else
                {
                        (*i)->step(dtime);
-                       i++;
+                       ++i;
                }
        }
 }
 
 void ParticleManager::clearAll ()
 {
-       JMutexAutoLock lock(m_spawner_list_lock);
-       JMutexAutoLock lock2(m_particle_list_lock);
+       MutexAutoLock lock(m_spawner_list_lock);
+       MutexAutoLock lock2(m_particle_list_lock);
        for(std::map<u32, ParticleSpawner*>::iterator i =
                        m_particle_spawners.begin();
                        i != m_particle_spawners.end();)
@@ -411,7 +411,7 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, IGameDef *gamedef,
                scene::ISceneManager* smgr, LocalPlayer *player)
 {
        if (event->type == CE_DELETE_PARTICLESPAWNER) {
-               JMutexAutoLock lock(m_spawner_list_lock);
+               MutexAutoLock lock(m_spawner_list_lock);
                if (m_particle_spawners.find(event->delete_particlespawner.id) !=
                                m_particle_spawners.end())
                {
@@ -425,7 +425,7 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, IGameDef *gamedef,
        if (event->type == CE_ADD_PARTICLESPAWNER) {
 
                {
-                       JMutexAutoLock lock(m_spawner_list_lock);
+                       MutexAutoLock lock(m_spawner_list_lock);
                        if (m_particle_spawners.find(event->add_particlespawner.id) !=
                                                        m_particle_spawners.end())
                        {
@@ -434,7 +434,7 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, IGameDef *gamedef,
                        }
                }
                video::ITexture *texture =
-                       gamedef->tsrc()->getTexture(*(event->add_particlespawner.texture));
+                       gamedef->tsrc()->getTextureForMesh(*(event->add_particlespawner.texture));
 
                ParticleSpawner* toadd = new ParticleSpawner(gamedef, smgr, player,
                                event->add_particlespawner.amount,
@@ -465,7 +465,7 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, IGameDef *gamedef,
                delete event->add_particlespawner.maxacc;
 
                {
-                       JMutexAutoLock lock(m_spawner_list_lock);
+                       MutexAutoLock lock(m_spawner_list_lock);
                        m_particle_spawners.insert(
                                        std::pair<u32, ParticleSpawner*>(
                                                        event->add_particlespawner.id,
@@ -477,7 +477,7 @@ void ParticleManager::handleParticleEvent(ClientEvent *event, IGameDef *gamedef,
 
        if (event->type == CE_SPAWN_PARTICLE) {
                video::ITexture *texture =
-                       gamedef->tsrc()->getTexture(*(event->spawn_particle.texture));
+                       gamedef->tsrc()->getTextureForMesh(*(event->spawn_particle.texture));
 
                Particle* toadd = new Particle(gamedef, smgr, player, m_env,
                                *event->spawn_particle.pos,
@@ -568,6 +568,6 @@ void ParticleManager::addNodeParticle(IGameDef* gamedef, scene::ISceneManager* s
 
 void ParticleManager::addParticle(Particle* toadd)
 {
-       JMutexAutoLock lock(m_particle_list_lock);
+       MutexAutoLock lock(m_particle_list_lock);
        m_particles.push_back(toadd);
 }