Skip to content

Commit

Permalink
Use math::clamp in rain_particle_system.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Aug 26, 2024
1 parent 6376c05 commit 168bdf3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/object/rain_particle_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "math/easing.hpp"
#include "math/random.hpp"
#include "math/util.hpp"
#include "object/camera.hpp"
#include "object/rainsplash.hpp"
#include "supertux/sector.hpp"
Expand Down Expand Up @@ -106,9 +107,7 @@ RainParticleSystem::get_settings()
void RainParticleSystem::set_amount(float amount)
{
// Don't spawn too many particles to avoid destroying the player's computer
float real_amount = amount < min_amount ? min_amount
: amount > max_amount ? max_amount
: amount;
float real_amount = math::clamp(amount, min_amount, max_amount);

int old_raindropcount = static_cast<int>(virtual_width*m_current_real_amount/6.0f);
int new_raindropcount = static_cast<int>(virtual_width*real_amount/6.0f);
Expand Down

0 comments on commit 168bdf3

Please sign in to comment.