aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-09-27 16:25:42 +0000
committerrodri <rgl@antares-labs.eu>2023-09-27 16:25:42 +0000
commitadf2defff479edb6483378684d356fd0160bbd47 (patch)
tree962d14d517a47efa8b30c7f0aaf5415eda01ab88
parent8760478c61d8b96d9aab1511b8759daeb84378c5 (diff)
downloadbattleship-adf2defff479edb6483378684d356fd0160bbd47.tar.gz
battleship-adf2defff479edb6483378684d356fd0160bbd47.tar.bz2
battleship-adf2defff479edb6483378684d356fd0160bbd47.zip
give more feedback about the current state of play to the spectator.
-rw-r--r--bts.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/bts.c b/bts.c
index fe87836..650d1ad 100644
--- a/bts.c
+++ b/bts.c
@@ -319,7 +319,7 @@ drawinfo(Image *dst)
{
static Image *c;
Point p;
- char *s, aux[32];
+ char *s, aux[32], aux2[32];
int i;
s = "";
@@ -363,12 +363,17 @@ drawinfo(Image *dst)
}else if(game.state == Watching){
if(c == nil)
c = eallocimage(display, Rect(0,0,1,1), screen->chan, 1, DYellow);
+ snprint(aux, sizeof aux, "waiting for players to");
+ snprint(aux2, sizeof aux2, "lay out their fleet");
for(i = 0; i < nelem(match.pl); i++)
if(match.pl[i].state == Playing){
snprint(aux, sizeof aux, "it's %s's turn", match.pl[i].uid);
- p = Pt(SCRW/2 - stringwidth(font, aux)/2, SCRH-Boardmargin);
- string(dst, p, c, ZP, font, aux);
+ aux2[0] = 0;
}
+ p = Pt(SCRW/2 - stringwidth(font, aux)/2, SCRH-Boardmargin);
+ string(dst, p, c, ZP, font, aux);
+ p = Pt(SCRW/2 - stringwidth(font, aux2)/2, SCRH-Boardmargin+font->height);
+ string(dst, p, c, ZP, font, aux2);
}
}