aboutsummaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'util.c')
-rw-r--r--util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/util.c b/util.c
index 42db012..826a508 100644
--- a/util.c
+++ b/util.c
@@ -94,6 +94,19 @@ fprintmap(int fd, Map *m)
}
int
+countshipcells(Map *m)
+{
+ int i, j, n;
+
+ n = 0;
+ for(i = 0; i < MAPW; i++)
+ for(j = 0; j < MAPH; j++)
+ if(gettile(m, Pt2(i,j,1)) == Tship)
+ n++;
+ return n;
+}
+
+int
shiplen(int stype)
{
assert(stype >= 0 && stype < NSHIPS);