shithub: battleship

Download patch

ref: 94fcdfff9e7a073fc15e71b111c728cdb6106520
parent: 71c2cd61f6e53a455140f5920cff88cdfd4b4d33
author: rodri <rgl@antares-labs.eu>
date: Sat Oct 7 19:17:10 EDT 2023

only send a shot if the target cell is clear/unknown.

--- a/bts.c
+++ b/bts.c
@@ -643,8 +643,10 @@
 		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;
 	}
 }