From 6d8eda761a88e0517c744292f673937323b23585 Mon Sep 17 00:00:00 2001 From: halx99 Date: Sat, 6 Apr 2024 23:42:51 +0800 Subject: [PATCH] Fix compile warnings --- core/2d/ParticleSystem.cpp | 10 +++--- .../cocostudio/ActionTimeline/CSLoader.cpp | 35 +++++++++---------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/core/2d/ParticleSystem.cpp b/core/2d/ParticleSystem.cpp index 2e4e97ed40..74e3f4948f 100644 --- a/core/2d/ParticleSystem.cpp +++ b/core/2d/ParticleSystem.cpp @@ -986,7 +986,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe _particleData.size[i] = MAX(0, _particleData.size[i]); } - if (_endSize != START_SIZE_EQUAL_TO_END_SIZE) + if (_endSize != static_cast(START_SIZE_EQUAL_TO_END_SIZE)) { for (int i = start; i < _particleCount; ++i) { @@ -1093,7 +1093,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe AX_DEGREES_TO_RADIANS(modeB.rotatePerSecond + modeB.rotatePerSecondVar * _rng.rangef()); } - if (modeB.endRadius == START_RADIUS_EQUAL_TO_END_RADIUS) + if (modeB.endRadius == static_cast(START_RADIUS_EQUAL_TO_END_RADIUS)) std::fill_n(_particleData.modeB.deltaRadius + start, _particleCount - start, 0.0F); else { @@ -1482,8 +1482,8 @@ bool ParticleSystem::addAnimationIndex(unsigned short index, ax::Rect rect, bool void ParticleSystem::simulate(float seconds, float frameRate) { - seconds = seconds == SIMULATION_USE_PARTICLE_LIFETIME ? getLife() + getLifeVar() : seconds; - frameRate = frameRate == SIMULATION_USE_GAME_ANIMATION_INTERVAL + seconds = seconds == static_cast(SIMULATION_USE_PARTICLE_LIFETIME) ? getLife() + getLifeVar() : seconds; + frameRate = frameRate == static_cast(SIMULATION_USE_GAME_ANIMATION_INTERVAL) ? 1.0F / Director::getInstance()->getAnimationInterval() : frameRate; auto delta = 1.0F / frameRate; @@ -1597,7 +1597,7 @@ void ParticleSystem::update(float dt) _elapsed += dt; if (_elapsed < 0.f) _elapsed = 0.f; - if (_duration != DURATION_INFINITY && _duration < _elapsed) + if (_duration != static_cast(DURATION_INFINITY) && _duration < _elapsed) { this->stopSystem(); } diff --git a/extensions/cocostudio/src/cocostudio/ActionTimeline/CSLoader.cpp b/extensions/cocostudio/src/cocostudio/ActionTimeline/CSLoader.cpp index 8eb37f8108..ff973cda2a 100644 --- a/extensions/cocostudio/src/cocostudio/ActionTimeline/CSLoader.cpp +++ b/extensions/cocostudio/src/cocostudio/ActionTimeline/CSLoader.cpp @@ -933,14 +933,14 @@ Node* CSLoader::createNode(const Data& data, const ccNodeLoadCallback& callback) break; } }); - - AXASSERT(readerVersion >= writterVersion, - StringUtils::format( - "%s%s%s%s%s%s%s%s%s%s", "The reader build id of your Cocos exported file(", csBuildId->c_str(), - ") and the reader build id in your axis(", loader->_csBuildID.c_str(), - ") are not match.\n", "Please get the correct reader(build id ", csBuildId->c_str(), ")from ", - "https://github.com/axmolengine/axmol", " and replace it in your axis") - .c_str()); +# if _AX_DEBUG > 0 + auto prompt = StringUtils::format( + "%s%s%s%s%s%s%s%s%s%s", "The reader build id of your Cocos exported file(", csBuildId->c_str(), + ") and the reader build id in your axmol(", loader->_csBuildID.c_str(), + ") are not match.\n", "Please get the correct reader(build id ", csBuildId->c_str(), ")from ", + "https://github.com/axmolengine/axmol", " and replace it in your axmol"); + AXASSERT(readerVersion >= writterVersion, prompt.c_str()); +#endif } // decode plist @@ -1050,15 +1050,14 @@ Node* CSLoader::nodeWithFlatBuffersFile(std::string_view fileName, const ccNodeL break; } }); - - AXASSERT(readerVersion >= writterVersion, - StringUtils::format( - "%s%s%s%s%s%s%s%s%s%s", "The reader build id of your Cocos exported file(", csBuildId->c_str(), - ") and the reader build id in your axis(", _csBuildID.c_str(), ") are not match.\n", - "Please get the correct reader(build id ", csBuildId->c_str(), ")from ", - "https://github.com/axmolengine/axmol", " and replace it in your axis") - .c_str()); - +# if _AX_DEBUG > 0 + auto prompt = StringUtils::format( + "%s%s%s%s%s%s%s%s%s%s", "The reader build id of your Cocos exported file(", csBuildId->c_str(), + ") and the reader build id in your axmol(", _csBuildID.c_str(), ") are not match.\n", + "Please get the correct reader(build id ", csBuildId->c_str(), ")from ", + "https://github.com/axmolengine/axmol", " and replace it in your axmol"); + AXASSERT(readerVersion >= writterVersion, prompt.c_str()); +#endif if (readerVersion < writterVersion) { auto exceptionMsg = @@ -1164,7 +1163,7 @@ Node* CSLoader::nodeWithFlatBuffers(const flatbuffers::NodeTree* nodetree, const auto exceptionMsg = StringUtils::format( R"(error: Missing custom reader class name:%s, please config at your project fiile xxx.xsxproj like follow: - + %s