aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorBřetislav Štec <valsiterb@gmail.com>2015-08-02 18:42:03 +0200
committerest31 <MTest31@outlook.com>2015-08-02 19:26:15 +0200
commit868a1a5c13a0c086aa1ff3414a1eb12076821c27 (patch)
treed31c3d81cb62cf54a5c1d82b6fbbed51a749ec8a /src/client
parent47225346be9ab0d55bc2dbc71b6c0f085f47a75e (diff)
downloadminetest-868a1a5c13a0c086aa1ff3414a1eb12076821c27.tar.gz
minetest-868a1a5c13a0c086aa1ff3414a1eb12076821c27.tar.bz2
minetest-868a1a5c13a0c086aa1ff3414a1eb12076821c27.zip
src/client/tile.cpp: Fix reference counting
Diffstat (limited to 'src/client')
-rw-r--r--src/client/tile.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/client/tile.cpp b/src/client/tile.cpp
index 03badd817..79ed4a072 100644
--- a/src/client/tile.cpp
+++ b/src/client/tile.cpp
@@ -1011,7 +1011,7 @@ video::IImage* TextureSource::generateImage(const std::string &name)
std::string last_part_of_name = name.substr(last_separator_pos + 1);
- /*
+ /*
If this name is enclosed in parentheses, generate it
and blit it onto the base image
*/
@@ -1209,21 +1209,22 @@ bool TextureSource::generateImagePart(std::string part_of_name,
s32 frame_count = stoi(sf.next(":"));
s32 progression = stoi(sf.next(":"));
- /*
- Load crack image.
+ if (progression >= 0) {
+ /*
+ Load crack image.
- It is an image with a number of cracking stages
- horizontally tiled.
- */
- video::IImage *img_crack = m_sourcecache.getOrLoad(
+ It is an image with a number of cracking stages
+ horizontally tiled.
+ */
+ video::IImage *img_crack = m_sourcecache.getOrLoad(
"crack_anylength.png", m_device);
- if (img_crack && progression >= 0)
- {
- draw_crack(img_crack, baseimg,
+ if (img_crack) {
+ draw_crack(img_crack, baseimg,
use_overlay, frame_count,
progression, driver);
- img_crack->drop();
+ img_crack->drop();
+ }
}
}
/*
@@ -1612,6 +1613,7 @@ bool TextureSource::generateImagePart(std::string part_of_name,
if (img) {
apply_mask(img, baseimg, v2s32(0, 0), v2s32(0, 0),
img->getDimension());
+ img->drop();
} else {
errorstream << "generateImage(): Failed to load \""
<< filename << "\".";