X-Git-Url: http://git.shiar.net/netris.git/blobdiff_plain/e3d58186949bfcdb149cc2a545ce6c14a8689268..21add7c13bc1df386e45aad2939ee5ff2a152c2b:/inet.c diff --git a/inet.c b/inet.c index 85b1b70..b21b137 100644 --- a/inet.c +++ b/inet.c @@ -37,30 +37,13 @@ ExtFunc MyEventType NetGenFunc(EventGenRec *gen, MyEvent *event); EventGenRec netGen[MAX_SCREENS] = { { NULL, 0, FT_read, -1, NetGenFunc, EM_net, 0, "\0", 0, HEADER_SIZE3 } }; -//static char netBuf[64]; -//static int netBufSize, netBufGoal = HEADER_SIZE3; -ExtFunc void make_netGen(void) -{ - int i; - - for (i = 1; i <= MAX_SCREENS; i++) - memcpy(netGen+i, &netGen[0], sizeof(EventGenRec)); -} //Make_netGen - - -ExtFunc int InitiateConnection(char *hostStr, char *portStr) +ExtFunc int InitiateConnection(char *hostStr, short port) { //connect to host struct sockaddr_in addr; struct hostent *host; - short port; -// make_netGen(); AtExit(CloseNet); - if (portStr) - port = atoi(portStr); /* XXX Error checking */ - else - port = DEFAULT_PORT; host = gethostbyname(hostStr); if (!host) die("gethostbyname"); @@ -80,7 +63,7 @@ ExtFunc int InitiateConnection(char *hostStr, char *portStr) goto again; } AddEventGen(&netGen[0]); - totalPlayers = 0; + totalPlayers = 1; return 0; } //InitiateConnection @@ -111,7 +94,8 @@ ExtFunc void HandShake(void) } case NP_gamedata: { - fprintf(stderr, ": %d\n", event.type); + memcpy(&Game, event.u.net.data, event.u.net.size); + SRandom(Game.seed); break; } case NP_newPlayer: