class LMNO {
constructor() {
- this.ids = {};
+ this.games = {};
}
generate_id() {
create_game(engine_name) {
do {
var id = this.generate_id();
- } while (id in this.ids);
+ } while (id in this.games);
const engine = engines[engine_name];
const game = new engine.Game();
- this.ids[id] = {
+ this.games[id] = {
id: id,
engine: engine.name,
game: game
return;
}
- const game = lmno.ids[game_id];
+ const game = lmno.games[game_id];
if (game === undefined) {
response.sendStatus(404);
return;
}
/* See if there is any game with this ID. */
- const game = lmno.ids[game_id];
+ const game = lmno.games[game_id];
if (game === undefined) {
response.sendStatus(404);
return;
let active = [];
let idle = [];
- for (let id in lmno.ids) {
- if (lmno.ids[id].game.clients.length)
- active.push(lmno.ids[id]);
+ for (let id in lmno.games) {
+ if (lmno.games[id].game.clients.length)
+ active.push(lmno.games[id]);
else
- idle.push(lmno.ids[id]);
+ idle.push(lmno.games[id]);
}
response.render('admin.html', { test: "foobar", games: { active: active, idle: idle}});
});