summaryrefslogtreecommitdiff
path: root/src/client.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-15 12:41:22 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-03-15 12:41:22 +0000
commit6038f9434f1eb40caf7992ece9a3972e95a9fc11 (patch)
tree6d99a66c5504ee894e15b215291f57e3e551a3e6 /src/client.c
parentd9e19a0d5ba8a797e12052e29f9c3a945d2331bc (diff)
- 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
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c10
1 files changed, 6 insertions, 4 deletions
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");
}