From 04c90470556a5d3a66fb592ff7b6fee1228be95e Mon Sep 17 00:00:00 2001 From: rodri Date: Tue, 15 Aug 2023 02:41:43 +0000 Subject: added ship drawing and placement procedures. --- dat.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'dat.h') diff --git a/dat.h b/dat.h index 2a2c6b5..6d2a6ba 100644 --- a/dat.h +++ b/dat.h @@ -5,6 +5,9 @@ enum { Tmiss, NTILES, + OH, /* horizontal */ + OV, /* vertical */ + Waiting0 = 0, Outlaying, Waiting1, @@ -22,8 +25,8 @@ enum { }; typedef struct Input Input; -typedef struct Board Board; typedef struct Ship Ship; +typedef struct Board Board; typedef struct Player Player; typedef struct Playerq Playerq; typedef struct Chanpipe Chanpipe; @@ -34,24 +37,28 @@ struct Input Keyboardctl *kc; }; -struct Board +struct Ship { - RFrame; - char map[17][17]; + Point2 p; /* board cell */ Rectangle bbox; + int orient; + int ncells; + int *hit; /* |hit| = ncells and hit = {x: 0 ≤ x ≤ 1} */ + int sunk; }; -struct Ship +struct Board { RFrame; - int ncells; - int sunk; + char map[17][17]; + Rectangle bbox; }; struct Player { int fd; int sfd; + Channel *mc; /* for matching */ Player *o; /* opponent */ }; -- cgit v1.2.3