mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-01 20:12:50 +02:00
Fix FUSE not burning as fiercely as meant to
Broken in 49703404be
.
Also fix .chance's parameter names.
This commit is contained in:
@@ -38,11 +38,11 @@ int RNG::between(int lower, int upper)
|
|||||||
return static_cast<int>(r % ((unsigned int)(upper) - (unsigned int)(lower) + 1U)) + lower;
|
return static_cast<int>(r % ((unsigned int)(upper) - (unsigned int)(lower) + 1U)) + lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RNG::chance(int nominator, unsigned int denominator)
|
bool RNG::chance(int numerator, unsigned int denominator)
|
||||||
{
|
{
|
||||||
if (nominator < 0)
|
if (numerator < 0)
|
||||||
return false;
|
return false;
|
||||||
return next() % denominator < static_cast<unsigned int>(nominator);
|
return next() % denominator < static_cast<unsigned int>(numerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
float RNG::uniform01()
|
float RNG::uniform01()
|
||||||
|
@@ -15,7 +15,7 @@ public:
|
|||||||
unsigned int operator()();
|
unsigned int operator()();
|
||||||
unsigned int gen();
|
unsigned int gen();
|
||||||
int between(int lower, int upper);
|
int between(int lower, int upper);
|
||||||
bool chance(int nominator, unsigned int denominator);
|
bool chance(int numerator, unsigned int denominator);
|
||||||
float uniform01();
|
float uniform01();
|
||||||
|
|
||||||
RNG();
|
RNG();
|
||||||
|
@@ -59,7 +59,7 @@ static int update(UPDATE_FUNC_ARGS)
|
|||||||
else if (parts[i].life < 40) {
|
else if (parts[i].life < 40) {
|
||||||
parts[i].life--;
|
parts[i].life--;
|
||||||
if (sim->rng.chance(1, 100)) {
|
if (sim->rng.chance(1, 100)) {
|
||||||
auto r = sim->create_part(-1, x + sim->rng.chance(-1, 1), y + sim->rng.chance(-1, 1), PT_PLSM);
|
auto r = sim->create_part(-1, x + sim->rng.between(-1, 1), y + sim->rng.between(-1, 1), PT_PLSM);
|
||||||
if (r>-1)
|
if (r>-1)
|
||||||
parts[r].life = 50;
|
parts[r].life = 50;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user