Mercurial > hg > rlgwebd
comparison rlgterm.js @ 61:071ec6b1ec03
RLG-Web client: initialize and restore the terminal when watching.
Since watchers might not get the curses initialization and ending
sequences, the terminal emulator needs to be set up for and restored
after watching.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Tue, 19 Jun 2012 20:08:05 -0700 |
parents | 00b985b8ba6a |
children | a077f9f84052 |
comparison
equal
deleted
inserted
replaced
60:31bb3cf4f25f | 61:071ec6b1ec03 |
---|---|
579 if (reply.t == 'w') { | 579 if (reply.t == 'w') { |
580 /* Success */ | 580 /* Success */ |
581 session.id = reply.id; | 581 session.id = reply.id; |
582 session.playing = false; | 582 session.playing = false; |
583 termemu.resize(reply.h, reply.w); | 583 termemu.resize(reply.h, reply.w); |
584 termemu.reset(); | |
585 termemu.toAltBuf(); | |
584 setTitle("Watching"); | 586 setTitle("Watching"); |
585 debug(1, "Watching with id " + session.id); | 587 debug(1, "Watching with id " + session.id); |
586 setmode("play"); | 588 setmode("play"); |
587 getData(); | 589 getData(); |
588 } | 590 } |
642 /* TODO IFACE2 If the end was unexpected, tell player the game was saved. */ | 644 /* TODO IFACE2 If the end was unexpected, tell player the game was saved. */ |
643 session.id = null; | 645 session.id = null; |
644 session.playing = false; | 646 session.playing = false; |
645 ajaxstate.clear(); | 647 ajaxstate.clear(); |
646 setTitle("Game over."); | 648 setTitle("Game over."); |
649 termemu.toNormBuf(); | |
647 nsend = 0; | 650 nsend = 0; |
648 nrecv = 0; | 651 nrecv = 0; |
649 msgQ = []; | 652 msgQ = []; |
650 if (session.lcred != null) | 653 if (session.lcred != null) |
651 setmode("choose"); | 654 setmode("choose"); |