3 #include "game_proxy.h"
7 static Queue cmd_queue;
10 * Enqueue SRC in the game's command queue.
12 void game_proxy_enq(const union cmd *src)
17 * Create the queue. This is done only once during the life time
18 * of the program. For simplicity's sake, the queue is never
23 cmd_queue = queue_new();
26 * Add a copy of the command to the end of the queue.
29 if ((dst = malloc(sizeof (*dst))))
32 queue_enq(cmd_queue, dst);
37 * Dequeue and return the head element in the game's command queue.
38 * The element must be freed after use.
40 union cmd *game_proxy_deq(void)
42 return cmd_queue ? queue_deq(cmd_queue) : NULL;
46 * Clear the entire queue.
48 void game_proxy_clr(void)
52 while ((cmdp = game_proxy_deq()))