changeset 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
files src/th06/enemy.rs
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/th06/enemy.rs	Sat Aug 17 13:50:54 2019 +0200
+++ b/src/th06/enemy.rs	Sat Aug 17 13:54:52 2019 +0200
@@ -354,7 +354,9 @@
         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