summaryrefslogtreecommitdiff
path: root/src/sim/materials/smoke.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/materials/smoke.rs')
-rw-r--r--src/sim/materials/smoke.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/sim/materials/smoke.rs b/src/sim/materials/smoke.rs
index 68f77ca..5240bc9 100644
--- a/src/sim/materials/smoke.rs
+++ b/src/sim/materials/smoke.rs
@@ -1,24 +1,20 @@
use rand::RngExt;
-use crate::sim::{cell::Cell, materials::MaterialId, sim::UpdateCtx};
+use crate::sim::sim::UpdateCtx;
#[inline]
pub fn sim_update(ctx: &mut UpdateCtx) {
// only allow upward movement some of the time to limit movement speed
- if ctx.rng.random_range(0.0..1.0) > 0.8 {
- if ctx.candidates_swap(&[(0, -1)]) {
- return;
- }
+ if ctx.rng.random_range(0.0..1.0) > 0.8 && ctx.candidates_swap(&[(0, -1)]) {
+ return;
}
// same for each horizontal direction
- if ctx.rng.random_range(0.0..1.0) > 0.8 {
- if ctx.candidates_swap(&[(1 - ctx.seqno_parity as i32 * 2, 0)]) {
- return;
- }
- }
- if ctx.rng.random_range(0.0..1.0) > 0.8 {
- if ctx.candidates_swap(&[(-1 + ctx.seqno_parity as i32 * 2, 0)]) {
- return;
- }
+ if ctx.rng.random_range(0.0..1.0) > 0.8
+ && ctx.candidates_swap(&[(1 - ctx.seqno_parity as i32 * 2, 0)])
+ {
+ return;
}
+ if ctx.rng.random_range(0.0..1.0) > 0.8
+ && ctx.candidates_swap(&[(-1 + ctx.seqno_parity as i32 * 2, 0)])
+ {}
}