We still haven't yet ported the Empires implementation to play nicely
with all of the new functionality in the base Game class. In
particular, Game now has a base "add_player" method with different
semantics than the older "add_player" method in Empires.
To avoid Empires.add_player from being inadvertently called, we rename
it here to register_player.
This fixes, for the moment, a failure when trying to create a new
Empires game of:
TypeError: player.remove_connection is not a function
this.broadcast_event("spectator-leave", `{"id": ${id}}`);
}
this.broadcast_event("spectator-leave", `{"id": ${id}}`);
}
- add_player(name, character) {
+ register_player(name, character) {
const new_player = {id: this.next_player_id,
name: name,
character: character,
const new_player = {id: this.next_player_id,
name: name,
character: character,
if (request.body.name)
name = request.body.name;
if (request.body.name)
name = request.body.name;
- const player = game.add_player(name, request.body.character);
+ const player = game.register_player(name, request.body.character);
response.send(JSON.stringify(player.id));
});
response.send(JSON.stringify(player.id));
});