@@ -298,8 +298,9 @@ void LazySprite::doInitFromBytes(std::vector<uint8_t> data, std::string cacheKey
298
298
299
299
image->release (); // deallocate the image, not needed anymore
300
300
texture->release (); // bring texture's refcount back to 1
301
-
302
- if (!self->initWithTexture (texture)) {
301
+
302
+ // this is weird but don't touch it unless you should
303
+ if (!self->CCSprite ::initWithTexture (texture)) {
303
304
// this should never happen tbh
304
305
self->onError (" failed to initialize the sprite" );
305
306
}
@@ -323,7 +324,7 @@ CCTexture2D* LazySprite::lookupCache(char const* key) {
323
324
324
325
bool LazySprite::initFromCache (char const * key) {
325
326
if (auto tex = this ->lookupCache (key)) {
326
- return this -> initWithTexture (tex);
327
+ return CCSprite:: initWithTexture (tex); // this will end up calling our overriden 2-arg func, which is what we want
327
328
}
328
329
329
330
return false ;
@@ -335,10 +336,6 @@ bool LazySprite::initWithTexture(CCTexture2D* texture, const CCRect& rect) {
335
336
return this ->postInit (CCSprite::initWithTexture (texture, rect));
336
337
}
337
338
338
- bool LazySprite::initWithTexture (CCTexture2D* texture) {
339
- return this ->postInit (CCSprite::initWithTexture (texture));
340
- }
341
-
342
339
bool LazySprite::initWithSpriteFrame (CCSpriteFrame* sf) {
343
340
return this ->postInit (CCSprite::initWithSpriteFrame (sf));
344
341
}
@@ -347,10 +344,6 @@ bool LazySprite::initWithSpriteFrameName(const char* fn) {
347
344
return this ->postInit (CCSprite::initWithSpriteFrameName (fn));
348
345
}
349
346
350
- bool LazySprite::initWithFile (const char * fn) {
351
- return this ->postInit (CCSprite::initWithFile (fn));
352
- }
353
-
354
347
bool LazySprite::initWithFile (const char * fn, const CCRect& rect) {
355
348
return this ->postInit (CCSprite::initWithFile (fn, rect));
356
349
}
0 commit comments