Corrected bugs and JsHint

This commit is contained in:
Thomas FORGIONE 2015-07-20 15:51:29 +02:00
parent 7409133857
commit 1f54b03463
3 changed files with 10 additions and 5 deletions

View File

@ -61,13 +61,16 @@ Info.prototype.tryMerge = function() {
// Merges the results of every SQL requests done by the load... methods // Merges the results of every SQL requests done by the load... methods
Info.prototype.merge = function() { Info.prototype.merge = function() {
var i = 0;
this.finalResult = {redCoins : [], events : []}; this.finalResult = {redCoins : [], events : []};
for (;;) { for (;;) {
// Find next element // Find next element
var nextIndex = null; 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 // The next element is placed at the index 0 (since the elements
// gotten from the database are sorted) // gotten from the database are sorted)
if (this.results[i].length !== 0 && if (this.results[i].length !== 0 &&
@ -86,7 +89,7 @@ Info.prototype.merge = function() {
} }
// Set red coins // 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]); this.finalResult.redCoins.push(this.redCoins[i]);
} }
}; };
@ -349,7 +352,7 @@ Info.prototype.loadRedCoins = function() {
self.tryMerge(); self.tryMerge();
} }
); );
} };
var UserCreator = function(finishAction) { var UserCreator = function(finishAction) {
this.finishAction = finishAction; this.finishAction = finishAction;

View File

@ -33,7 +33,7 @@ L3D.ReplayCamera.prototype.start = function() {
this.counter = 0; this.counter = 0;
this.started = true; this.started = true;
this.nextEvent(); this.nextEvent();
} };
// Update function // Update function
L3D.ReplayCamera.prototype.update = function(time) { L3D.ReplayCamera.prototype.update = function(time) {

View File

@ -217,11 +217,13 @@ L3D.resetBobombElements = function() {
L3D.generateCoins = function(totalCoins, coin_ids) { L3D.generateCoins = function(totalCoins, coin_ids) {
var i = 0;
if (coin_ids === undefined) if (coin_ids === undefined)
L3D.shuffle(totalCoins); L3D.shuffle(totalCoins);
else { 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++) { for (var j = 0; j < totalCoins.length; j++) {