From ac65e2c9b72e35a9e5a1a84da57ecdbd41e5923e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 16 Mar 2016 18:05:12 +0300 Subject: Split ParticleEngine from Particle class. --- src/resources/map/map.cpp | 19 +++++++++++++------ src/resources/map/map.h | 3 +-- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src/resources/map') diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index ada25e3d6..93b950ba5 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -1067,11 +1067,10 @@ void Map::addParticleEffect(const std::string &effectFile, mParticleEffects.push_back(newEffect); } -void Map::initializeParticleEffects(Particle *restrict const engine) - const restrict2 +void Map::initializeParticleEffects() const restrict2 { BLOCK_START("Map::initializeParticleEffects") - if (!engine) + if (!particleEngine) { BLOCK_END("Map::initializeParticleEffects") return; @@ -1081,11 +1080,19 @@ void Map::initializeParticleEffects(Particle *restrict const engine) { for (std::vector::const_iterator i = mParticleEffects.begin(); - i != mParticleEffects.end(); ++i) + i != mParticleEffects.end(); + ++i) { - Particle *const p = engine->addEffect(i->file, i->x, i->y); - if (p && i->w > 0 && i->h > 0) + Particle *const p = particleEngine->addEffect( + i->file, + i->x, + i->y); + if (p && + i->w > 0 && + i->h > 0) + { p->adjustEmitterSize(i->w, i->h); + } } } BLOCK_END("Map::initializeParticleEffects") diff --git a/src/resources/map/map.h b/src/resources/map/map.h index 61d328313..1f92f5951 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -222,8 +222,7 @@ class Map final : public Properties, public ConfigListener /** * Initializes all added particle effects */ - void initializeParticleEffects(Particle *restrict const particleEngine) - const restrict2; + void initializeParticleEffects() const restrict2; /** * Adds a tile animation to the map -- cgit v1.2.3-70-g09d2