]> git.cworth.org Git - empires-server/commitdiff
Omit inactive players when reporting scores
authorCarl Worth <cworth@cworth.org>
Sat, 27 Jun 2020 15:29:49 +0000 (08:29 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 27 Jun 2020 15:32:32 +0000 (08:32 -0700)
If they have left the game, then we don't need to report a score for
them in this round, since they obviously didn't play in it.

With this commit, the new test added in the previous commit now
passes, and the entire test suite is back to passing again.

empathy.js

index 0ae52df96a442558124c0dd2f9e35dc572bc3f32..bc846c19600a13b9c03e8cd65b9673f517c7109e 100644 (file)
@@ -481,7 +481,7 @@ class Empathy extends Game {
       group.players.forEach(p => p.round_score += group.players.size);
     }
 
-    const scores = this.players.map(p => {
+    const scores = this.players.filter(p => p.active).map(p => {
       return {
         player: p.name,
         score: p.round_score