# HG changeset patch # User John "Elwin" Edwards # Date 1341963169 25200 # Node ID e07f9879912071466deabd1c9ccc7a35fc22a70f # Parent 6c6a6e4f1e5b41b745e3d0536c3ddd98ac0db05f RLG-Web: improve game-starting messages. Include the name of the player and game when watching or playing. diff -r 6c6a6e4f1e5b -r e07f98799120 rlgterm.js --- a/rlgterm.js Tue Jul 10 13:53:38 2012 -0700 +++ b/rlgterm.js Tue Jul 10 16:32:49 2012 -0700 @@ -625,7 +625,7 @@ 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 @@ 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 -r 6c6a6e4f1e5b -r e07f98799120 rlgwebd.js --- a/rlgwebd.js Tue Jul 10 13:53:38 2012 -0700 +++ b/rlgwebd.js Tue Jul 10 16:32:49 2012 -0700 @@ -621,7 +621,7 @@ 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 @@ } 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();