From 75828a2c9afb58d871ecf4c0338bef9ada42b2bb Mon Sep 17 00:00:00 2001 From: Fabrice Ecaille Date: Wed, 30 Oct 2013 18:30:07 +0100 Subject: [PATCH] Bugfix: right maximum loader : considering the weapon stock --- js/spaceinvaders-models.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/spaceinvaders-models.js b/js/spaceinvaders-models.js index 0307ede..fe344f9 100644 --- a/js/spaceinvaders-models.js +++ b/js/spaceinvaders-models.js @@ -246,7 +246,7 @@ Weapon.prototype = { if( !this.reload_timer) { this.reload_timer = setInterval( function() { - _this.load = Math.min(_this.load + 1, _this.max_load); + _this.load = Math.min(_this.load + 1, Math.min(_this.max_load, _this.stock)); if( _this.load == _this.max_load ) { clearInterval(_this.reload_timer); _this.reload_timer = false;