From: Carl Worth Date: Mon, 1 Jun 2020 00:44:14 +0000 (-0700) Subject: Drop the name field from the Game class X-Git-Url: https://git.cworth.org/git?p=empires-server;a=commitdiff_plain;h=7b21a4eb7ed2d6d479842b01c35ba6931c3acdc7 Drop the name field from the Game class 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). --- diff --git a/empires.js b/empires.js index 78e7f25..3072a12 100644 --- a/empires.js +++ b/empires.js @@ -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 5bbd7f5..fb2d75a 100644 --- 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; } diff --git a/tictactoe.js b/tictactoe.js index 12bf680..11b4295 100644 --- a/tictactoe.js +++ b/tictactoe.js @@ -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); }