RLG-Web: Allow games to be taken over.
Make it possible to reconnect to a game if the user has left the page without saving.
This commit is contained in:
parent
8ebcf32a4d
commit
2828b5f33c
2 changed files with 51 additions and 5 deletions
17
rlgterm.js
17
rlgterm.js
|
|
@ -562,14 +562,14 @@ function getchoices() {
|
|||
else if (reply.stat[gname] == "0")
|
||||
acttext = "Start a game";
|
||||
else if (reply.stat[gname] == "p")
|
||||
acttext = "Game in progress";
|
||||
acttext = "Reconnect";
|
||||
else if (reply.stat[gname] == "d")
|
||||
acttext = "Game in progress (dgl)";
|
||||
else
|
||||
continue;
|
||||
var button = document.createElement("span");
|
||||
button.appendChild(document.createTextNode(acttext));
|
||||
if ("s0".indexOf(reply.stat[gname]) >= 0) {
|
||||
if ("s0p".indexOf(reply.stat[gname]) >= 0) {
|
||||
button.onclick = makeStarter(gname);
|
||||
button.className = "ibutton";
|
||||
}
|
||||
|
|
@ -628,9 +628,20 @@ function startgame(game) {
|
|||
}
|
||||
else if (reply.t == 'E') {
|
||||
debug(1, "Could not start game: " + reply.s);
|
||||
message("Your game could not be started: " + reply.s);
|
||||
if (reply.c == 1) {
|
||||
logout();
|
||||
message("The server forgot about you, please log in again.");
|
||||
}
|
||||
else if (reply.c == 4) {
|
||||
message("You can't play that game because it is currently being " +
|
||||
"played over SSH.");
|
||||
}
|
||||
else if (reply.c == 7) {
|
||||
message("The game is being saved, try again in a few seconds.");
|
||||
}
|
||||
else {
|
||||
message("The server says it can't start your game because \"" +
|
||||
reply.s + "\". This is probably a bug.");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue