aboutsummaryrefslogtreecommitdiff
path: root/dat.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-08-12 05:35:54 +0000
committerrodri <rgl@antares-labs.eu>2023-08-12 05:35:54 +0000
commit8285721acfc247d57e0831503543dd29290ac4c5 (patch)
tree7e40088ab8c403d36ff455dc66ab6b8ab5a16904 /dat.h
parent7b76e7467822316b699847cbd61a0ecb985882d3 (diff)
downloadbattleship-8285721acfc247d57e0831503543dd29290ac4c5.tar.gz
battleship-8285721acfc247d57e0831503543dd29290ac4c5.tar.bz2
battleship-8285721acfc247d57e0831503543dd29290ac4c5.zip
latest try of player mgmt procedure. (not working)
Diffstat (limited to 'dat.h')
-rw-r--r--dat.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/dat.h b/dat.h
index b0350e1..2a2c6b5 100644
--- a/dat.h
+++ b/dat.h
@@ -5,6 +5,11 @@ enum {
Tmiss,
NTILES,
+ Waiting0 = 0,
+ Outlaying,
+ Waiting1,
+ Playing,
+
Boardmargin = 50,
TW = 16,
TH = TW,
@@ -12,10 +17,16 @@ enum {
MAPH = MAPW,
SCRW = Boardmargin+MAPW*TW+Boardmargin,
SCRH = Boardmargin+MAPH*TH+TH+MAPH*TH+Boardmargin,
+
+ KB = 1024,
};
typedef struct Input Input;
typedef struct Board Board;
+typedef struct Ship Ship;
+typedef struct Player Player;
+typedef struct Playerq Playerq;
+typedef struct Chanpipe Chanpipe;
struct Input
{
@@ -29,3 +40,31 @@ struct Board
char map[17][17];
Rectangle bbox;
};
+
+struct Ship
+{
+ RFrame;
+ int ncells;
+ int sunk;
+};
+
+struct Player
+{
+ int fd;
+ int sfd;
+ Player *o; /* opponent */
+};
+
+struct Playerq
+{
+ QLock;
+ Player **players;
+ ulong cap;
+ ulong nplayers;
+};
+
+struct Chanpipe
+{
+ Channel *c;
+ int fd;
+};