]> git.cworth.org Git - empires-server/blobdiff - lmno.js
Add message string to the return value of add_move
[empires-server] / lmno.js
diff --git a/lmno.js b/lmno.js
index 60c0f44000dfa702ec04c4b9cddbbb6d9600a40f..b6c5b78e04e6b83a6700c19d623a6e55d625f1c8 100644 (file)
--- a/lmno.js
+++ b/lmno.js
@@ -302,13 +302,13 @@ for (let key in engines) {
       const game = request.game;
       const move = request.body.move;
 
-      const legal = game.add_move(move);
+      const result = game.add_move(move);
 
-      /* Inform this client whether the move was legal. */
-      response.send(JSON.stringify(legal));
+      /* Feed move response back to the client. */
+      response.json(result);
 
       /* And only if legal, inform all clients. */
-      if (! legal)
+      if (! result.legal)
         return;
 
       game.broadcast_move(move);