From 1f54b034639b2ef29e412e1be443aa0d6fe09a7f Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Mon, 20 Jul 2015 15:51:29 +0200 Subject: [PATCH] Corrected bugs and JsHint --- controllers/prototype/dbrequests.js | 9 ++++++--- js/l3d/src/cameras/ReplayCamera.js | 2 +- js/l3d/src/scenes/initScene.js | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/controllers/prototype/dbrequests.js b/controllers/prototype/dbrequests.js index d752851..9d8a50a 100644 --- a/controllers/prototype/dbrequests.js +++ b/controllers/prototype/dbrequests.js @@ -61,13 +61,16 @@ Info.prototype.tryMerge = function() { // Merges the results of every SQL requests done by the load... methods Info.prototype.merge = function() { + + var i = 0; + this.finalResult = {redCoins : [], events : []}; for (;;) { // Find next element var nextIndex = null; - for (var i in this.results) { + for (i in this.results) { // The next element is placed at the index 0 (since the elements // gotten from the database are sorted) if (this.results[i].length !== 0 && @@ -86,7 +89,7 @@ Info.prototype.merge = function() { } // Set red coins - for (var i = 0; i < this.redCoins.length; i++) { + for (i = 0; i < this.redCoins.length; i++) { this.finalResult.redCoins.push(this.redCoins[i]); } }; @@ -349,7 +352,7 @@ Info.prototype.loadRedCoins = function() { self.tryMerge(); } ); -} +}; var UserCreator = function(finishAction) { this.finishAction = finishAction; diff --git a/js/l3d/src/cameras/ReplayCamera.js b/js/l3d/src/cameras/ReplayCamera.js index 1d57f14..c6b2f3a 100644 --- a/js/l3d/src/cameras/ReplayCamera.js +++ b/js/l3d/src/cameras/ReplayCamera.js @@ -33,7 +33,7 @@ L3D.ReplayCamera.prototype.start = function() { this.counter = 0; this.started = true; this.nextEvent(); -} +}; // Update function L3D.ReplayCamera.prototype.update = function(time) { diff --git a/js/l3d/src/scenes/initScene.js b/js/l3d/src/scenes/initScene.js index 5560914..59be4db 100644 --- a/js/l3d/src/scenes/initScene.js +++ b/js/l3d/src/scenes/initScene.js @@ -217,11 +217,13 @@ L3D.resetBobombElements = function() { L3D.generateCoins = function(totalCoins, coin_ids) { + var i = 0; + if (coin_ids === undefined) L3D.shuffle(totalCoins); else { - for (var i = 0; i < coin_ids.length; i++) { + for (i = 0; i < coin_ids.length; i++) { for (var j = 0; j < totalCoins.length; j++) {