Mercurial > touhou
diff src/th06/enemy.rs @ 689:482d81f50a11
ecl_vm: fix panic when bullet_interval is zero (disabled).
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 17 Aug 2019 13:54:52 +0200 |
parents | 1adecaddf442 |
children | eecb8626f472 |
line wrap: on
line diff
--- a/src/th06/enemy.rs +++ b/src/th06/enemy.rs @@ -354,7 +354,9 @@ impl Enemy { let coeff_interval = interval / 5; let difficulty_modifier = coeff_interval + (-coeff_interval * 2) * self.get_difficulty() / 32; self.bullet_launch_interval = (interval + difficulty_modifier) as u32; - self.bullet_launch_timer = rand_start % self.bullet_launch_interval; + if self.bullet_launch_interval > 0 { + self.bullet_launch_timer = rand_start % self.bullet_launch_interval; + } } /// Run all interpolators and such, and update internal variables once per