aboutsummaryrefslogtreecommitdiff
path: root/party.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2023-06-05 20:23:26 +0000
committerrodri <rgl@antares-labs.eu>2023-06-05 20:23:26 +0000
commit9c20abc1ab976cab00040a32299896dc8ea71e6c (patch)
tree5037406ea18c55dc0be2001c1d27e2d89edc16f7 /party.c
parent0625897dd0194986b02988eb5a9c2969e24adf0c (diff)
downloadmusw-9c20abc1ab976cab00040a32299896dc8ea71e6c.tar.gz
musw-9c20abc1ab976cab00040a32299896dc8ea71e6c.tar.bz2
musw-9c20abc1ab976cab00040a32299896dc8ea71e6c.zip
put the player routines in their own unit.
fixed an issue with the threadsim routine that would cause re-stepping of all the previous parties after dissolving one of them due to one of the players quitting.
Diffstat (limited to 'party.c')
-rw-r--r--party.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/party.c b/party.c
index be0f4ed..031a4fa 100644
--- a/party.c
+++ b/party.c
@@ -8,8 +8,6 @@
#include "dat.h"
#include "fns.h"
-/* Party */
-
Party *
newparty(Party *p, Player *player0, Player *player1)
{
@@ -50,87 +48,3 @@ initparty(Party *p)
{
p->next = p->prev = p;
}
-
-/* Player */
-
-Player *
-newplayer(char *name, NetConn *nc)
-{
- Player *p;
-
- p = emalloc(sizeof(Player));
- p->name = name? strdup(name): nil;
- p->conn = nc;
- p->oldkdown = p->kdown = 0;
- p->next = nil;
-
- return p;
-}
-
-void
-delplayer(Player *p)
-{
- free(p->name);
- free(p);
-}
-
-/* Player queue */
-
-static void
-playerq_put(Playerq *pq, Player *p)
-{
- if(pq->tail == nil)
- pq->head = pq->tail = p;
- else{
- pq->tail->next = p;
- pq->tail = p;
- }
- pq->len++;
-}
-
-static Player *
-playerq_get(Playerq *pq)
-{
- Player *p;
-
- if(pq->head == nil)
- return nil;
-
- p = pq->head;
- if(pq->head == pq->tail)
- pq->head = pq->tail = nil;
- else{
- pq->head = p->next;
- p->next = nil;
- }
- pq->len--;
- return p;
-}
-
-static void
-playerq_del(Playerq *pq, Player *p)
-{
- Player *np;
-
- if(pq->head == p){
- pq->get(pq);
- return;
- }
-
- for(np = pq->head; np != nil && np->next != nil; np = np->next)
- if(np->next == p){
- np->next = np->next->next;
- p->next = nil;
- pq->len--;
- }
-}
-
-void
-initplayerq(Playerq *pq)
-{
- pq->head = pq->tail = nil;
- pq->len = 0;
- pq->put = playerq_put;
- pq->get = playerq_get;
- pq->del = playerq_del;
-}