Commit ddc688d9 authored by Eben Blaisdell's avatar Eben Blaisdell

addToRankings fix

parent 7541acca
......@@ -259,7 +259,7 @@ function setUserInfo(username,userInfo){
function addToRankings(playerScore){
var index = 0;
while(rankings[index] && rankings[index][1]>playerScore[1]){index++;}
while(rankings[index] && rankings[index][1]>=playerScore[1]){index++;}
rankings.splice(index,0,playerScore);
}
......@@ -374,8 +374,8 @@ Game.prototype.end = function(winnerIndex){
winnerInfo = getUserInfo(winner);
loserInfo = getUserInfo(loser);
winnerIndex = rankings.indexOf([winner,winnerInfo.score]);
loserIndex = rankings.indexOf([loser,loserInfo.score]);
rankings.splice(winnerIndex,1);
loserIndex = rankings.indexOf([loser,loserInfo.score]);
rankings.splice(loserIndex,1);
winnerInfo.wins++;
loserInfo.loses++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment