diff options
author | rodri <rgl@antares-labs.eu> | 2023-08-31 10:16:12 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-08-31 10:16:12 +0000 |
commit | 68cfdc52fa2daecdd2b4db02fe5f117a4e2329f6 (patch) | |
tree | 406f9c7c4175818285c36c6e076d08f910988433 /bts.c | |
parent | be547a2dba10292fb3191bc5fec42212d2391660 (diff) | |
download | battleship-68cfdc52fa2daecdd2b4db02fe5f117a4e2329f6.tar.gz battleship-68cfdc52fa2daecdd2b4db02fe5f117a4e2329f6.tar.bz2 battleship-68cfdc52fa2daecdd2b4db02fe5f117a4e2329f6.zip |
improved playerq locking.
wrote a little how to play guide.
Diffstat (limited to 'bts.c')
-rw-r--r-- | bts.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -63,7 +63,6 @@ Cursor aimcursor = { 0x21, 0x84, 0x31, 0x8c, 0x0f, 0xf0, 0x00, 0x00, } }; - char deffont[] = "/lib/font/bit/pelm/unicode.9.font"; char winspec[32]; Channel *drawchan; @@ -76,11 +75,11 @@ Board alienboard; Board localboard; Ship armada[NSHIPS]; Ship *curship; +int layoutdone; Point2 lastshot; struct { int state; - int layoutdone; } game; struct { @@ -173,7 +172,7 @@ resetgame(void) } curship = nil; game.state = Waiting0; - game.layoutdone = 0; + layoutdone = 0; } Image * @@ -546,11 +545,11 @@ rmb(Mousectl *mc) mc->xy = addpt(mc->xy, screen->r.min); switch(menuhit(3, mc, &menu, _screen)){ case PLACESHIP: - if(!game.layoutdone) + if(!layoutdone) curship = &armada[0]; break; case DONE: - if(curship != nil || game.layoutdone) + if(curship != nil || layoutdone) break; if(!confirmdone(mc)) @@ -565,7 +564,7 @@ rmb(Mousectl *mc) cell2coords(armada[i].p), armada[i].orient == OH? 'h': 'v'); } chanprint(egress, "layout %s\n", buf); - game.layoutdone++; + layoutdone++; break; } send(drawchan, nil); |