From 6038f9434f1eb40caf7992ece9a3972e95a9fc11 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sat, 15 Mar 2008 12:41:22 +0000 Subject: - uprava par detialov v setovom mutiplayeri s portokolom UDP ( hlavne monznost synchronizacie dat od servera kazdnych 5 sekund ) git-svn-id: http://opensvn.csie.org/tuxanci_ng@17 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/client.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/client.c') diff --git a/src/client.c b/src/client.c index dc9d324..5a96b00 100644 --- a/src/client.c +++ b/src/client.c @@ -23,6 +23,7 @@ static Uint32 lastPing; static void initClient() { clientBuffer = newBuffer( LIMIT_BUFFER ); + lastPing = SDL_GetTicks(); proto_send_hello_client(); } @@ -36,6 +37,7 @@ int initTcpClient(char *ip, int port) } printf("connect TCP %s %d\n", ip, port); + protocolType = NET_PROTOCOL_TYPE_TCP; initClient(); @@ -52,8 +54,8 @@ int initUdpClient(char *ip, int port) } printf("connect UDP %s %d\n", ip, port); + protocolType = NET_PROTOCOL_TYPE_UDP; - lastPing = SDL_GetTicks(); initClient(); return 0; @@ -138,7 +140,7 @@ void eventServerBuffer() while ( getBufferLine(clientBuffer, line, STR_SIZE) >= 0 ) { - //printf("dostal som %s", line); + printf("spracuvavam %s", line); if( strncmp(line, "init", 4) == 0 )proto_recv_init_client(line); if( strncmp(line, "event", 5) == 0 )proto_recv_event_client(line); @@ -222,7 +224,7 @@ void quitTcpClient() assert( sock_server_tcp != NULL ); closeTcpSocket(sock_server_tcp); - printf("quit conenct\n"); + printf("quit TCP conenct\n"); } void quitUdpClient() @@ -232,5 +234,5 @@ void quitUdpClient() assert( sock_server_udp != NULL ); closeUdpSocket(sock_server_udp); - printf("quit conenct\n"); + printf("quit UDP conenct\n"); } -- cgit v1.2.3