From 24879b8123b0336dd4dc2e365de0957ee5ab77fe Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Tue, 10 Jul 2012 16:32:49 -0700 Subject: [PATCH] RLG-Web: improve game-starting messages. Include the name of the player and game when watching or playing. --- rlgterm.js | 6 ++++-- rlgwebd.js | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rlgterm.js b/rlgterm.js index 46ce78e..11916b4 100644 --- a/rlgterm.js +++ b/rlgterm.js @@ -625,7 +625,7 @@ function startgame(game) { termemu.resize(reply.h, reply.w); setTitle("Playing as " + session.lname); debug(1, "Playing with id " + session.id); - message("Your game has started."); + message("You are now playing " + game.name + "."); setmode("play"); getData(); } @@ -661,7 +661,9 @@ function startwatching(gamenumber) { termemu.toAltBuf(); setTitle("Watching"); debug(1, "Watching with id " + session.id); - message("You are now watching."); + var pname = reply.p; + var gname = games[reply.g].name; + message("You are now watching " + pname + " play " + gname + "."); setmode("watch"); getData(); } diff --git a/rlgwebd.js b/rlgwebd.js index 4d50315..cec8ec8 100755 --- a/rlgwebd.js +++ b/rlgwebd.js @@ -621,7 +621,7 @@ function startgame(req, res, formdata) { if (success) { res.writeHead(200, {'Content-Type': 'application/json'}); var reply = {"t": "s", "id": nclient.id, "w": nclient.w, "h": - nclient.h}; + nclient.h, "p": username, "g": gname}; res.write(JSON.stringify(reply)); res.end(); } @@ -647,7 +647,8 @@ function watch(req, res, formdata) { } var session = sessions[gamenumber]; var watch = new Watcher(session); - var reply = {"t": "w", "id": watch.id, "w": session.w, "h": session.h}; + var reply = {"t": "w", "id": watch.id, "w": session.w, "h": session.h, + "p": session.pname, "g": session.game.uname}; res.writeHead(200, {'Content-Type': 'application/json'}); res.write(JSON.stringify(reply)); res.end();