summaryrefslogtreecommitdiff
path: root/src/particle.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-03-28 08:02:46 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-08 20:43:23 +0200
commit14dc8218eeebd1583e6bd3c49013b3e501f47228 (patch)
tree387778ceddd2165ab033c742e5c0eff583a6327a /src/particle.cpp
parentde442e7b15a52729ba37946e74f2799804a77dab (diff)
downloadmana-14dc8218eeebd1583e6bd3c49013b3e501f47228.tar.gz
mana-14dc8218eeebd1583e6bd3c49013b3e501f47228.tar.bz2
mana-14dc8218eeebd1583e6bd3c49013b3e501f47228.tar.xz
mana-14dc8218eeebd1583e6bd3c49013b3e501f47228.zip
Use ResourceRef<Image> in more places
Automatic reference counting of images is now used by Item, Icon, AnimatedSprite, ImageSprite, ParticleEmitter, Minimap, Desktop and Emote. Since ResourceManager::get automatically adds a reference, it needs to be explicitly subtracted when the resource is managed by ResourceRef. This is taken care of by the new ResourceManager::getImageRef. Also removed the apprently unused and duplicate "mDrawImage" from Item (which also didn't get decRef called on it). Fixes cleanup of emote ImageSet and ImageSprite instances, as well as particle images.
Diffstat (limited to 'src/particle.cpp')
-rw-r--r--src/particle.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/particle.cpp b/src/particle.cpp
index 953e4160..56998df4 100644
--- a/src/particle.cpp
+++ b/src/particle.cpp
@@ -19,17 +19,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "particle.h"
+
#include "animationparticle.h"
#include "configuration.h"
-#include "resources/dye.h"
#include "imageparticle.h"
#include "log.h"
#include "map.h"
-#include "particle.h"
#include "particleemitter.h"
#include "rotationalparticle.h"
#include "textparticle.h"
+#include "resources/dye.h"
+#include "resources/image.h"
#include "resources/resourcemanager.h"
#include "utils/dtor.h"
@@ -295,8 +297,8 @@ Particle *Particle::addEffect(const std::string &particleEffectFile,
std::string imageSrc = (const char*)node->xmlChildrenNode->content;
if (!imageSrc.empty() && !dyePalettes.empty())
Dye::instantiate(imageSrc, dyePalettes);
- Image *img= resman->getImage(imageSrc);
+ auto img = resman->getImageRef(imageSrc);
newParticle = new ImageParticle(mMap, img);
}
// Other