]> git.cworth.org Git - empires-server/commitdiff
Remove player names from answering and judging when they submit
authorCarl Worth <cworth@cworth.org>
Sun, 14 Jun 2020 21:57:10 +0000 (14:57 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 25 Jun 2020 16:16:04 +0000 (09:16 -0700)
Without this fix, reloading the "still waiting" view would make player
names that had previously submitted erroneously appear in the "still
waiting" list once again.

empathy.js

index ae400a6009709deceef876caa71343a1957a4d1a..abaf72f247fc5f796a79e49df594e4702124e6c5 100644 (file)
@@ -135,8 +135,11 @@ class Empathy extends Game {
       answers: answers
     });
 
-    /* And notify all players that this player has answered. */
+    /* Update state (to be sent out to any future clients) */
+    this.state.players_answering.delete(player.name);
     this.state.players_answered.push(player.name);
+
+    /* And notify all players that this player has answered. */
     this.broadcast_event_object('player-answered', player.name);
 
     return { valid: true };
@@ -244,8 +247,11 @@ class Empathy extends Game {
       }
     }
 
-    /* And notify all players this this player has judged. */
+    /* Update state (to be sent out to any future clients) */
+    this.state.players_judging.delete(player.name);
     this.state.players_judged.push(player.name);
+
+    /* And notify all players this this player has judged. */
     this.broadcast_event_object('player-judged', player.name);
 
     return { valid: true };