diff options
author | rodri <rgl@antares-labs.eu> | 2023-08-15 02:41:43 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-08-15 02:41:43 +0000 |
commit | 04c90470556a5d3a66fb592ff7b6fee1228be95e (patch) | |
tree | 5201b75c3e56fa595ceff71bd2173a041541be0e /dat.h | |
parent | 8285721acfc247d57e0831503543dd29290ac4c5 (diff) | |
download | battleship-04c90470556a5d3a66fb592ff7b6fee1228be95e.tar.gz battleship-04c90470556a5d3a66fb592ff7b6fee1228be95e.tar.bz2 battleship-04c90470556a5d3a66fb592ff7b6fee1228be95e.zip |
added ship drawing and placement procedures.
Diffstat (limited to 'dat.h')
-rw-r--r-- | dat.h | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -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 */ }; |