]> git.cworth.org Git - empires-server/commitdiff
Drop the name field from the Game class
authorCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 00:44:14 +0000 (17:44 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 1 Jun 2020 00:44:14 +0000 (17:44 -0700)
This name is already not used anywhere, (the code has since changed to
using Game.meta.identifier instead), so kill it.

And this lets us frop the global "engine_name" variable from each
game's JavaScript file (which had a value redundant with
meta.identifier anyway).

empires.js
game.js
tictactoe.js

index 78e7f2591d6b18cd14927b466d0f7b55399a1d94..3072a121e68c98d0ac060218437c4e53860ae0a5 100644 (file)
@@ -1,8 +1,6 @@
 const express = require("express");
 const Game = require("./game.js");
 
-const engine_name = "empires";
-
 const router = express.Router();
 
 const GameState = {
@@ -35,7 +33,7 @@ function shuffle(a) {
 
 class Empires extends Game {
   constructor() {
-    super(engine_name);
+    super();
     this._spectators = [];
     this.next_spectator_id = 1;
     this._players = [];
diff --git a/game.js b/game.js
index 5bbd7f503885a964105a90266f5e36d8cd981210..fb2d75afa87214f1eaa4fe426772ca59f39e24f3 100644 (file)
--- a/game.js
+++ b/game.js
@@ -1,7 +1,6 @@
 /* Base class providing common code for game engine implementations. */
 class Game {
-  constructor(name) {
-    this.name = name;
+  constructor() {
     this.clients = [];
     this.next_client_id = 1;
   }
index 12bf6801ac0f20e4f36e444bbb9fab1909fce116..11b4295df247ced277c82d8f1501369483a7a4e0 100644 (file)
@@ -1,13 +1,11 @@
 const express = require("express");
 const Game = require("./game.js");
 
-const engine_name = "tictactoe";
-
 const router = express.Router();
 
 class TicTacToe extends Game {
   constructor() {
-    super(engine_name);
+    super();
     this.moves = [];
     this.board = Array(9).fill(null);
   }