Fix dropping and joining
This commit is contained in:
@@ -354,6 +354,14 @@ function join() {
|
||||
games.forGame("id", (game) => {
|
||||
var redundant = false;
|
||||
var set = false;
|
||||
for (var i = 0; i < game.Players.length; i++) {
|
||||
if (!set && game.Players[i].ID == id) {
|
||||
game.Players[i].Name = name
|
||||
game.Players[i].Participating = true
|
||||
set = true
|
||||
}
|
||||
}
|
||||
if (!set) {
|
||||
for (var i = 0; i < game.Players.length; i++) {
|
||||
if (!set && game.Players[i].ID == "") {
|
||||
game.Players[i] = {
|
||||
@@ -366,6 +374,7 @@ function join() {
|
||||
redundant = redundant || game.Players[i].ID == id;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!set) {
|
||||
throw new Error("did not take a seat");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user