]> git.cworth.org Git - empires-server/commitdiff
Rename a variable from "player_string" to "player_data"
authorCarl Worth <cworth@cworth.org>
Sun, 10 May 2020 21:21:19 +0000 (14:21 -0700)
committerCarl Worth <cworth@cworth.org>
Sun, 10 May 2020 21:21:19 +0000 (14:21 -0700)
The name of "player_string" made me think this is just a string
representation of a player's name. But instead, this variable is
holding the JSON representation of the data block of a
"player-register" event. So a name of "player_data" is much more
clear.

server.js

index 7bb29e5fe47f1e656ff54524f9abe8dc3ba1d8d2..ca7b844c5296b893ca114bc68433b8dd299a0ea5 100644 (file)
--- a/server.js
+++ b/server.js
@@ -27,8 +27,8 @@ class Game {
     /* The syntax here is using an anonymous function to create a new
       object from new_player with just the subset of fields that we
       want. */
-    const player_string = JSON.stringify((({id, name}) => ({id, name}))(new_player));
-    this.broadcast_event("player-join", player_string);
+    const player_data = JSON.stringify((({id, name}) => ({id, name}))(new_player));
+    this.broadcast_event("player-join", player_data);
   }
 
   remove_player(id) {