diff options
author | rodri <rgl@antares-labs.eu> | 2023-06-05 21:21:56 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-06-05 21:21:56 +0000 |
commit | 650a361f5a04e4fc39ade90459d280d227875cb1 (patch) | |
tree | 2d97defc243ce642522acd6a2f388574e1d66e24 /player.c | |
parent | 9c20abc1ab976cab00040a32299896dc8ea71e6c (diff) | |
download | musw-650a361f5a04e4fc39ade90459d280d227875cb1.tar.gz musw-650a361f5a04e4fc39ade90459d280d227875cb1.tar.bz2 musw-650a361f5a04e4fc39ade90459d280d227875cb1.zip |
use a queue for player input to dampen race conditions between the netcode and the sims.
Diffstat (limited to 'player.c')
-rw-r--r-- | player.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -3,6 +3,7 @@ #include <ip.h> #include <mp.h> #include <libsec.h> +#include <thread.h> #include <draw.h> #include <geometry.h> #include "dat.h" @@ -16,6 +17,7 @@ newplayer(char *name, NetConn *nc) p = emalloc(sizeof(Player)); p->name = name? strdup(name): nil; p->conn = nc; + p->inputq = chancreate(sizeof(ulong), 20); p->oldkdown = p->kdown = 0; p->next = nil; @@ -26,6 +28,7 @@ void delplayer(Player *p) { free(p->name); + chanclose(p->inputq); free(p); } |