X-Git-Url: http://git.shiar.net/netris.git/blobdiff_plain/0e779d807aa1830dde2f4a75117fd16f5627dc76..eb820d60637feceb84f559675344cf24a2c2f1cd:/inet.c diff --git a/inet.c b/inet.c index 8da9956..4300eb7 100644 --- a/inet.c +++ b/inet.c @@ -15,8 +15,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: inet.c,v 1.18 1996/02/09 08:22:13 mhw Exp $ */ #include "netris.h" @@ -37,8 +35,9 @@ #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; @@ -46,7 +45,7 @@ static sigjmp_buf close_env; void CatchInt(int sig) { siglongjmp(close_env, 1); -} //CatchInt +} int InitiateConnection(char *hostStr, short port) { //connect to host @@ -77,7 +76,7 @@ int InitiateConnection(char *hostStr, short port) } AddEventGen(&netGen); return 0; -} //InitiateConnection +} void HandShake(void) { //talk to your host @@ -114,11 +113,11 @@ void HandShake(void) { 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); @@ -138,9 +137,8 @@ void HandShake(void) } else fatal("Hm, the party apparantly ended prematurely."); - } - while (event.u.net.type != NP_gamedata); -} //HandShake + } while (event.u.net.type != NP_gamedata); +} MyEventType NetGenFunc(EventGenRec *gen, MyEvent *event) @@ -175,7 +173,7 @@ 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 @@ -188,7 +186,7 @@ void SendPacket(short uid, NetPacketType type, int size, void *data) die("write (header)"); if (size > 0 && data && MyWrite(netGen.fd, data, size) != size) die("write"); -} //SendPacket +} void CloseNet(void) { //kick some connection's ass! @@ -201,9 +199,5 @@ void CloseNet(void) } if (netGen.next) RemoveEventGen(&netGen); -} //CloseNet +} -/* - * vi: ts=4 ai - * vim: noai si - */