diff options
author | rodri <rgl@antares-labs.eu> | 2021-07-25 20:59:58 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2021-07-25 20:59:58 +0000 |
commit | bdaa63a1a4604ada3539aeb50e4af144da3ba6f0 (patch) | |
tree | 6aa3d68f94d7756d45f78cce10af1796bdb744d2 /dat.h | |
parent | f54a8666413d80db3bda3de6e17f795faf7790eb (diff) | |
download | musw-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.h | 35 |
1 files changed, 27 insertions, 8 deletions
@@ -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; |