#define HEADER_SIZE3 sizeof(netint4[3])
MyEventType NetGenFunc(EventGenRec *gen, MyEvent *event);
-EventGenRec netGen =
- { NULL, 0, FT_read, -1, NetGenFunc, EM_net, 0, "\0", 0, HEADER_SIZE3 };
+EventGenRec netGen = {
+ NULL, 0, FT_read, -1, NetGenFunc, EM_net, 0, "\0", 0, HEADER_SIZE3
+};
static sigjmp_buf close_env;
void CatchInt(int sig)
{
siglongjmp(close_env, 1);
-} //CatchInt
+}
int InitiateConnection(char *hostStr, short port)
{ //connect to host
}
AddEventGen(&netGen);
return 0;
-} //InitiateConnection
+}
void HandShake(void)
{ //talk to your host
{
static struct {
int playerflags;
- int maxplayers; //1
- int started; //2
- int continuous; //3
- long seed; //4
- int initspeed; //5
+ int maxplayers; //1
+ int started; //2
+ int continuous; //3
+ long seed; //4
+ int initspeed; //5
} data;
memcpy(&data, event.u.net.data, event.u.net.size);
fatal("Hm, the party apparantly ended prematurely.");
}
while (event.u.net.type != NP_gamedata);
-} //HandShake
+}
MyEventType NetGenFunc(EventGenRec *gen, MyEvent *event)
event->u.net.data = gen->buf + HEADER_SIZE3;
if (type == NP_endConn) return E_lostConn;
return E_net;
-} //NetGenFunc
+}
void SendPacket(short uid, NetPacketType type, int size, void *data)
{ //send shit to server
die("write (header)");
if (size > 0 && data && MyWrite(netGen.fd, data, size) != size)
die("write");
-} //SendPacket
+}
void CloseNet(void)
{ //kick some connection's ass!
}
if (netGen.next)
RemoveEventGen(&netGen);
-} //CloseNet
+}
-/*
- * vi: ts=4 ai
- * vim: noai si
- */