From ca6558bd5da5bbb159173582c2eb7b7acc168e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s=20B=C3=A1lint=20Misius?= Date: Sat, 16 Sep 2023 21:41:07 +0200 Subject: [PATCH] Fix FUSE not burning as fiercely as meant to Broken in 49703404bef7. Also fix .chance's parameter names. --- src/common/tpt-rand.cpp | 6 +++--- src/common/tpt-rand.h | 2 +- src/simulation/elements/FUSE.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/tpt-rand.cpp b/src/common/tpt-rand.cpp index 84af99189..cb5155d89 100644 --- a/src/common/tpt-rand.cpp +++ b/src/common/tpt-rand.cpp @@ -38,11 +38,11 @@ int RNG::between(int lower, int upper) return static_cast(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 next() % denominator < static_cast(nominator); + return next() % denominator < static_cast(numerator); } float RNG::uniform01() diff --git a/src/common/tpt-rand.h b/src/common/tpt-rand.h index 9eb4ed29a..e71430a6c 100644 --- a/src/common/tpt-rand.h +++ b/src/common/tpt-rand.h @@ -15,7 +15,7 @@ public: unsigned int operator()(); unsigned int gen(); int between(int lower, int upper); - bool chance(int nominator, unsigned int denominator); + bool chance(int numerator, unsigned int denominator); float uniform01(); RNG(); diff --git a/src/simulation/elements/FUSE.cpp b/src/simulation/elements/FUSE.cpp index 0c3a61ca1..51ac430de 100644 --- a/src/simulation/elements/FUSE.cpp +++ b/src/simulation/elements/FUSE.cpp @@ -59,7 +59,7 @@ static int update(UPDATE_FUNC_ARGS) else if (parts[i].life < 40) { parts[i].life--; 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) parts[r].life = 50; }