Fix compile warnings

This commit is contained in:
halx99 2024-04-06 23:42:51 +08:00
parent 5261235697
commit 6d8eda761a
2 changed files with 22 additions and 23 deletions

View File

@ -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<float>(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<float>(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<float>(SIMULATION_USE_PARTICLE_LIFETIME) ? getLife() + getLifeVar() : seconds;
frameRate = frameRate == static_cast<float>(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<float>(DURATION_INFINITY) && _duration < _elapsed)
{
this->stopSystem();
}

View File

@ -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:
<Project>
<publish-opts>
<publish-opts>
<custom-readers>
<item>%s</item>
</custom-readers>