Rename object 'keys' to fix bug (there's already a function named that way)
This commit is contained in:
parent
1d7a680d48
commit
315db97abb
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
function Room(domElem, lib) {
|
||||
var players = {};
|
||||
var keys = {};
|
||||
var keysByName = {};
|
||||
var logins = [];
|
||||
var session = {
|
||||
key: null,
|
||||
|
@ -51,10 +51,10 @@ function Room(domElem, lib) {
|
|||
|
||||
function enter(key, name) {
|
||||
var player = Player(key, name);
|
||||
keys[key] = name;
|
||||
keysByName[name] = key;
|
||||
players[key] = player;
|
||||
player.position = lib.insert(name, logins);
|
||||
beforePlayer = players[keys[logins[player.position]]];
|
||||
beforePlayer = players[keysByName[logins[player.position]]];
|
||||
playersList.insertBefore(player.dom, beforePlayer && beforePlayer.dom);
|
||||
logins.splice(player.position, 0, name);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ function Room(domElem, lib) {
|
|||
if(player != undefined) {
|
||||
playersList.removeChild(player.dom);
|
||||
logins.splice(player.position, 1);
|
||||
delete keys[player.name]
|
||||
delete keysByName[player.name]
|
||||
delete players[key];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue