Skip to content

Commit

Permalink
fix 6060 some more
Browse files Browse the repository at this point in the history
  • Loading branch information
rt committed Nov 7, 2018
1 parent 8294eeb commit 204d265
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion rts/Sim/Projectiles/ProjectileHandler.cpp
Expand Up @@ -783,11 +783,13 @@ CProjectile* CProjectileHandler::GetProjectileByUnsyncedID(int id)

float CProjectileHandler::GetParticleSaturation(bool randomized) const
{
const int curParticles = GetCurrentParticles();

// use the random mult to weaken the max limit a little
// so the chance is better spread when being close to the limit
// i.e. when there are rockets that spam CEGs this gives smaller CEGs still a chance
const float total = std::max(1.0f, maxParticles * 1.0f);
const float fract = GetCurrentParticles() / total;
const float fract = std::max(int(curParticles >= maxParticles), curParticles) / total;
const float rmult = 1.0f + (int(randomized) * 0.3f * guRNG.NextFloat());

return (fract * rmult);
Expand Down
3 changes: 2 additions & 1 deletion rts/Sim/Projectiles/ProjectileHandler.h
Expand Up @@ -56,7 +56,8 @@ class CProjectileHandler
float GetParticleSaturation(bool randomized = true) const;
float GetNanoParticleSaturation(float priority) const {
const float total = std::max(1.0f, maxNanoParticles * priority);
const float fract = currentNanoParticles / total;
const float fract = std::max(int(currentNanoParticles >= maxNanoParticles), currentNanoParticles) / total;

return std::min(1.0f, fract);
}

Expand Down

0 comments on commit 204d265

Please sign in to comment.