diff options
author | rodri <rgl@antares-labs.eu> | 2023-09-26 18:39:02 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-09-26 18:39:02 +0000 |
commit | 05825e751d69cde554c21ddfd00e646049425e31 (patch) | |
tree | 0ba2620bd9df21613b422e3eb475bd21cac8b4a1 /btsd.c | |
parent | 2293ed78636e5f66b5e2884bebd193803cb6939f (diff) | |
download | battleship-05825e751d69cde554c21ddfd00e646049425e31.tar.gz battleship-05825e751d69cde554c21ddfd00e646049425e31.tar.bz2 battleship-05825e751d69cde554c21ddfd00e646049425e31.zip |
initial work towards spectator mode.
Diffstat (limited to 'btsd.c')
-rw-r--r-- | btsd.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -317,6 +317,7 @@ battleproc(void *arg) Cmdtab *ct; Player *p, *op; Stands stands; + uchar buf1[BY2MAP], buf2[BY2MAP]; uint n0; Point2 cell; @@ -432,8 +433,8 @@ Nocmd: }else{ op = p == m->pl[0]? m->pl[1]: m->pl[0]; chanprint(op->io.out, "win\n"); - op->state = Waiting0; op->battle = nil; + op->state = Waiting0; freeplayer(p); freemsg(msg); goto Finish; @@ -442,6 +443,11 @@ Nocmd: takeseat(&stands, p); p->battle = m; p->state = Watching; + bitpackmap(buf1, sizeof buf1, m->pl[0]); + bitpackmap(buf2, sizeof buf2, m->pl[1]); + chanprint(p->io.out, "watching %d %s %s %.*[ %.*[\n", + m->id, m->pl[0]->name, m->pl[1]->name, + sizeof buf1, buf1, sizeof buf2, buf2); }else if(strcmp(msg->body, "leave seat") == 0){ leaveseat(&stands, p); p->battle = nil; @@ -642,6 +648,7 @@ threadmain(int argc, char *argv[]) char *addr; GEOMfmtinstall(); + fmtinstall('[', encodefmt); addr = "tcp!*!3047"; ARGBEGIN{ case 'd': |