fixed missing cast found by Coverity CID 1232664
This commit is contained in:
parent
2d4c4ece8a
commit
9392aa0fca
|
@ -1288,17 +1288,18 @@ void UnitParticleSystem::updateParticle(Particle *p){
|
||||||
if(alternations > 0){
|
if(alternations > 0){
|
||||||
int interval= (maxParticleEnergy / alternations);
|
int interval= (maxParticleEnergy / alternations);
|
||||||
float moduloValue= (float)((int)(static_cast<float> (p->energy)) % interval);
|
float moduloValue= (float)((int)(static_cast<float> (p->energy)) % interval);
|
||||||
|
float floatInterval=static_cast<float> (interval);
|
||||||
|
|
||||||
if(moduloValue < interval / 2){
|
if(moduloValue < floatInterval / 2.0f){
|
||||||
energyRatio= (interval - moduloValue) / interval;
|
energyRatio= (floatInterval - moduloValue) / floatInterval;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
energyRatio= moduloValue / interval;
|
energyRatio= moduloValue / floatInterval;
|
||||||
}
|
}
|
||||||
energyRatio= clamp(energyRatio, 0.f, 1.f);
|
energyRatio= clamp(energyRatio, 0.f, 1.f);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
energyRatio= clamp(static_cast<float> (p->energy) / maxParticleEnergy, 0.f, 1.f);
|
energyRatio= clamp(static_cast<float> (p->energy) / static_cast<float> (maxParticleEnergy), 0.f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
energyRatio = truncateDecimal<float>(energyRatio,6);
|
energyRatio = truncateDecimal<float>(energyRatio,6);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user