aboutsummaryrefslogtreecommitdiff
path: root/dat.h
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2021-07-25 20:59:58 +0000
committerrodri <rgl@antares-labs.eu>2021-07-25 20:59:58 +0000
commitbdaa63a1a4604ada3539aeb50e4af144da3ba6f0 (patch)
tree6aa3d68f94d7756d45f78cce10af1796bdb744d2 /dat.h
parentf54a8666413d80db3bda3de6e17f795faf7790eb (diff)
downloadmusw-bdaa63a1a4604ada3539aeb50e4af144da3ba6f0.tar.gz
musw-bdaa63a1a4604ada3539aeb50e4af144da3ba6f0.tar.bz2
musw-bdaa63a1a4604ada3539aeb50e4af144da3ba6f0.zip
implemented parties to hold PvP match info.
started serializing game state through the wire. made some major changes to the Lobby struct, plus the ability to check the health of every connection. added some more debug statements, did some cleanup and put more checks.
Diffstat (limited to 'dat.h')
-rw-r--r--dat.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/dat.h b/dat.h
index fb790ae..9ea1f7f 100644
--- a/dat.h
+++ b/dat.h
@@ -2,8 +2,10 @@
typedef struct GameState GameState;
typedef struct Derivative Derivative;
-typedef struct Seats Seats;
+typedef struct Conn Conn;
+typedef struct Player Player;
typedef struct Lobby Lobby;
+typedef struct Party Party;
struct GameState
{
@@ -15,18 +17,35 @@ struct Derivative
double dx, dv;
};
-struct Seats
+struct Conn
{
- int *fds;
- ulong len;
- ulong cap;
+ char dir[40];
+ int ctl;
+ int data;
+};
+
+struct Player
+{
+ char *name;
+ Conn conn;
};
struct Lobby
{
- Seats seats;
+ Player *seats;
+ ulong nseats;
+ ulong cap;
- int (*takeseat)(Lobby*, int);
- int (*getcouple)(Lobby*, int*);
+ int (*takeseat)(Lobby*, char*, int, int);
int (*leaveseat)(Lobby*, ulong);
+ int (*getcouple)(Lobby*, Player*);
+ void (*healthcheck)(Lobby*);
};
+
+struct Party
+{
+ Player players[2]; /* the needle and the wedge */
+ Party *prev, *next;
+};
+
+extern Party theparty;