src/client/tile.cpp: Fix reference counting

This commit is contained in:
Břetislav Štec 2015-08-02 18:42:03 +02:00 committed by est31
parent 47225346be
commit 868a1a5c13
1 changed files with 13 additions and 11 deletions

View File

@ -1011,7 +1011,7 @@ video::IImage* TextureSource::generateImage(const std::string &name)
std::string last_part_of_name = name.substr(last_separator_pos + 1); std::string last_part_of_name = name.substr(last_separator_pos + 1);
/* /*
If this name is enclosed in parentheses, generate it If this name is enclosed in parentheses, generate it
and blit it onto the base image 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 frame_count = stoi(sf.next(":"));
s32 progression = stoi(sf.next(":")); s32 progression = stoi(sf.next(":"));
/* if (progression >= 0) {
Load crack image. /*
Load crack image.
It is an image with a number of cracking stages It is an image with a number of cracking stages
horizontally tiled. horizontally tiled.
*/ */
video::IImage *img_crack = m_sourcecache.getOrLoad( video::IImage *img_crack = m_sourcecache.getOrLoad(
"crack_anylength.png", m_device); "crack_anylength.png", m_device);
if (img_crack && progression >= 0) if (img_crack) {
{ draw_crack(img_crack, baseimg,
draw_crack(img_crack, baseimg,
use_overlay, frame_count, use_overlay, frame_count,
progression, driver); progression, driver);
img_crack->drop(); img_crack->drop();
}
} }
} }
/* /*
@ -1612,6 +1613,7 @@ bool TextureSource::generateImagePart(std::string part_of_name,
if (img) { if (img) {
apply_mask(img, baseimg, v2s32(0, 0), v2s32(0, 0), apply_mask(img, baseimg, v2s32(0, 0), v2s32(0, 0),
img->getDimension()); img->getDimension());
img->drop();
} else { } else {
errorstream << "generateImage(): Failed to load \"" errorstream << "generateImage(): Failed to load \""
<< filename << "\"."; << filename << "\".";