home
·
contact
·
privacy
projects
/
plomrogue2-experiments
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor fixes.
[plomrogue2-experiments]
/
new2
/
rogue_chat_nocanvas_monochrome.html
diff --git
a/new2/rogue_chat_nocanvas_monochrome.html
b/new2/rogue_chat_nocanvas_monochrome.html
index 11fbfc64d9f4391d53e59aace62e2797706ac10f..e3204e8ac373d3e48edbed165341d8f3bd220b94 100644
(file)
--- a/
new2/rogue_chat_nocanvas_monochrome.html
+++ b/
new2/rogue_chat_nocanvas_monochrome.html
@@
-132,16
+132,15
@@
let server = {
this.websocket = new WebSocket(url);
this.websocket.onopen = function(event) {
window.setInterval(function() { server.send(['PING']) }, 30000);
this.websocket = new WebSocket(url);
this.websocket.onopen = function(event) {
window.setInterval(function() { server.send(['PING']) }, 30000);
- tui.log_msg("@ server connected!");
+ tui.log_msg("@ server connected!
:)
");
tui.init_login();
};
tui.init_login();
};
+ this.websocket.onclose = function(event) {
+ tui.log_msg('@ server disconnected :(');
+ }
},
send: function(tokens) {
},
send: function(tokens) {
- if (this.websocket.readyState !== WebSocket.OPEN) {
- tui.log_msg('server disconnected :(');
- } else {
- this.websocket.send(unparser.untokenize(tokens));
- }
+ this.websocket.send(unparser.untokenize(tokens));
}
}
}
}
@@
-268,9
+267,8
@@
let tui = {
return lines;
},
log_msg: function(msg) {
return lines;
},
log_msg: function(msg) {
- let lines = this.msg_into_lines_of_width(msg, this.window_width);
- this.log = this.log.concat(lines);
- while (this.log.length > terminal.rows) {
+ this.log.push(msg);
+ while (this.log.length > terminal.rows * 4) {
this.log.shift();
};
this.full_refresh();
this.log.shift();
};
this.full_refresh();
@@
-338,14
+336,15
@@
let tui = {
terminal.write(1, this.window_width, 'TURN: ' + game.turn);
},
draw_history: function() {
terminal.write(1, this.window_width, 'TURN: ' + game.turn);
},
draw_history: function() {
- if (terminal.rows <= this.height_header + this.height_input) {
- return;
- }
+ let log_display_lines = [];
+ for (let line of this.log) {
+ log_display_lines = log_display_lines.concat(this.msg_into_lines_of_width(line, this.window_width));
+ };
for (let y = terminal.rows - 1 - this.height_input,
for (let y = terminal.rows - 1 - this.height_input,
- i =
this.log
.length - 1;
+ i =
log_display_lines
.length - 1;
y >= this.height_header && i >= 0;
y--, i--) {
y >= this.height_header && i >= 0;
y--, i--) {
- terminal.write(y, this.window_width,
this.log
[i]);
+ terminal.write(y, this.window_width,
log_display_lines
[i]);
}
},
draw_info: function() {
}
},
draw_info: function() {
@@
-414,13
+413,10
@@
server.websocket.onmessage = function (event) {
tui.log_msg('# ' + tokens[1], 1);
} else if (tokens[0] === 'PLAYER_ID') {
game.player_id = parseInt(tokens[1]);
tui.log_msg('# ' + tokens[1], 1);
} else if (tokens[0] === 'PLAYER_ID') {
game.player_id = parseInt(tokens[1]);
- } else if (tokens[0] === 'META') {
- tui.log_msg('@ ' + tokens[1]);
} else if (tokens[0] === 'LOGIN_OK') {
server.send(['GET_GAMESTATE']);
} else if (tokens[0] === 'LOGIN_OK') {
server.send(['GET_GAMESTATE']);
- tui.log_msg('@ ' + tokens[1]);
tui.log_help();
tui.log_help();
- tui.switch_mode(mode_
chat
);
+ tui.switch_mode(mode_
play
);
} else if (tokens[0] === 'ANNOTATION') {
let position = parser.parse_yx(tokens[1]);
explorer.update_info_db(position, tokens[2]);
} else if (tokens[0] === 'ANNOTATION') {
let position = parser.parse_yx(tokens[1]);
explorer.update_info_db(position, tokens[2]);