aboutsummaryrefslogtreecommitdiff
path: root/bts.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-10-07 23:17:10 +0000
committerrodri <rgl@antares-labs.eu>2023-10-07 23:17:10 +0000
commit94fcdfff9e7a073fc15e71b111c728cdb6106520 (patch)
tree95058f6028da8c0344d64b1240751c196262080a /bts.c
parent71c2cd61f6e53a455140f5920cff88cdfd4b4d33 (diff)
downloadbattleship-94fcdfff9e7a073fc15e71b111c728cdb6106520.tar.gz
battleship-94fcdfff9e7a073fc15e71b111c728cdb6106520.tar.bz2
battleship-94fcdfff9e7a073fc15e71b111c728cdb6106520.zip
only send a shot if the target cell is clear/unknown.
Diffstat (limited to 'bts.c')
-rw-r--r--bts.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bts.c b/bts.c
index ca951dc..80aad06 100644
--- a/bts.c
+++ b/bts.c
@@ -643,8 +643,10 @@ lmb(Mousectl *mc)
cell = toboard(&alienboard, mc->xy);
/* TODO check if we already shot at that cell */
cell2coords(buf, sizeof buf, cell);
- chanprint(egress, "shoot %s\n", buf);
- lastshot = cell;
+ if(gettile(&alienboard, cell) == Twater){
+ chanprint(egress, "shoot %s\n", buf);
+ lastshot = cell;
+ }
break;
}
}