diff rlgterm.js @ 64:e3082fd06520

Some status improvements. Status messages now consistently use the game's uname, and the table of choices puts the games in the right order.
author John "Elwin" Edwards <elwin@sdf.org>
date Wed, 20 Jun 2012 08:49:10 -0700
parents a077f9f84052
children e63c26dc0497
line wrap: on
line diff
--- a/rlgterm.js	Wed Jun 20 07:41:59 2012 -0700
+++ b/rlgterm.js	Wed Jun 20 08:49:10 2012 -0700
@@ -454,7 +454,13 @@
       var cell2 = document.createElement("div");
       var cell3 = document.createElement("div");
       cell1.appendChild(document.createTextNode(reply.g[i].p));
-      cell2.appendChild(document.createTextNode(reply.g[i].g));
+      var uname = reply.g[i].g;
+      if (uname in games)
+        cell2.appendChild(document.createTextNode(games[uname].name));
+      else {
+        debug(1, "Unrecognized game: " + uname);
+        continue;
+      }
       var button = document.createElement("span");
       button.appendChild(document.createTextNode("Watch"));
       button.onclick = makeWatcher(reply.g[i].n);
@@ -492,8 +498,8 @@
     /* Don't remove the first child, it's the header. */
     while (optdiv.childNodes.length > 1)
       optdiv.removeChild(optdiv.childNodes[1]);
-    for (var gname in reply.stat) {
-      if (!(gname in games))
+    for (var gname in games) {
+      if (!(gname in reply.stat))
         continue;
       var acttext;
       if (reply.stat[gname] == "s")