Mercurial > hg > rlgwebd
comparison rlgwebd.js @ 91:e07f98799120
RLG-Web: improve game-starting messages.
Include the name of the player and game when watching or playing.
| author | John "Elwin" Edwards <elwin@sdf.org> |
|---|---|
| date | Tue, 10 Jul 2012 16:32:49 -0700 |
| parents | d644e7d46852 |
| children | 597e9477b8ae |
comparison
equal
deleted
inserted
replaced
| 90:6c6a6e4f1e5b | 91:e07f98799120 |
|---|---|
| 619 // Game starting has been approved. | 619 // Game starting has been approved. |
| 620 var respondlaunch = function(nclient, success) { | 620 var respondlaunch = function(nclient, success) { |
| 621 if (success) { | 621 if (success) { |
| 622 res.writeHead(200, {'Content-Type': 'application/json'}); | 622 res.writeHead(200, {'Content-Type': 'application/json'}); |
| 623 var reply = {"t": "s", "id": nclient.id, "w": nclient.w, "h": | 623 var reply = {"t": "s", "id": nclient.id, "w": nclient.w, "h": |
| 624 nclient.h}; | 624 nclient.h, "p": username, "g": gname}; |
| 625 res.write(JSON.stringify(reply)); | 625 res.write(JSON.stringify(reply)); |
| 626 res.end(); | 626 res.end(); |
| 627 } | 627 } |
| 628 else { | 628 else { |
| 629 sendError(res, 5, "Failed to open TTY"); | 629 sendError(res, 5, "Failed to open TTY"); |
| 645 sendError(res, 7); | 645 sendError(res, 7); |
| 646 return; | 646 return; |
| 647 } | 647 } |
| 648 var session = sessions[gamenumber]; | 648 var session = sessions[gamenumber]; |
| 649 var watch = new Watcher(session); | 649 var watch = new Watcher(session); |
| 650 var reply = {"t": "w", "id": watch.id, "w": session.w, "h": session.h}; | 650 var reply = {"t": "w", "id": watch.id, "w": session.w, "h": session.h, |
| 651 "p": session.pname, "g": session.game.uname}; | |
| 651 res.writeHead(200, {'Content-Type': 'application/json'}); | 652 res.writeHead(200, {'Content-Type': 'application/json'}); |
| 652 res.write(JSON.stringify(reply)); | 653 res.write(JSON.stringify(reply)); |
| 653 res.end(); | 654 res.end(); |
| 654 tslog("Game %d is being watched (key %s)", gamenumber, watch.id); | 655 tslog("Game %d is being watched (key %s)", gamenumber, watch.id); |
| 655 } | 656 } |
