54 lines
1.0 KiB
C
54 lines
1.0 KiB
C
#ifndef NETWORK_H
|
|
#define NETWORK_H
|
|
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
|
|
#define MAXNETNODES 8
|
|
|
|
struct netnode {
|
|
struct sockaddr_in netname;
|
|
char name[16];
|
|
char used;
|
|
};
|
|
|
|
extern struct netnode netnodes[MAXNETNODES];
|
|
|
|
void getsocket(void);
|
|
void freesocket(void);
|
|
|
|
int send_join(struct sockaddr_in *netname, char playername[16]);
|
|
void send_config();
|
|
void send_quit();
|
|
int scaninvite(int msec);
|
|
|
|
int start_network_game();
|
|
int handle_joins();
|
|
int begin_network_game();
|
|
void send_invites();
|
|
void cancel_network_game();
|
|
|
|
extern const unsigned char gameversion[4];
|
|
|
|
typedef enum { NETWORK_NONE = 0, NETWORK_MASTER, NETWORK_SLAVE } network_type;
|
|
extern network_type network;
|
|
|
|
/* actions */
|
|
int networktraffic(void);
|
|
|
|
#define ACTIONHIST 20
|
|
|
|
extern int mydatacount;
|
|
extern int myslot;
|
|
extern int actionput,actioncount;
|
|
extern unsigned char actionblock[ACTIONHIST*MAXNETNODES];
|
|
|
|
extern int myaction;
|
|
extern unsigned char actions[MAXNETNODES];
|
|
|
|
extern unsigned char latestactions[MAXNETNODES];
|
|
extern long latestcounts[MAXNETNODES];
|
|
|
|
#endif
|