From 1a592767c6e34bdeb7f30fa063b5e24c57d45894 Mon Sep 17 00:00:00 2001 From: oroborus Date: Sat, 2 Aug 2008 14:12:48 +0000 Subject: - gameserver podporuje clientov z IPv4-UDP IPv4-TCP IPv6-UDP IPv6-TCP - client sa moze pripojit na gameserver, ktory podporuje IPv4-UDP IPv4-TCP IPv6-UDP IPv6-TCP ( nie, nie je to samozrejmost :) ) - client ma parametre --tcp , --udp ( ak sa neuvedie, implicitne sa berie --udp ) - btw. ladit, ladit, ladit git-svn-id: http://opensvn.csie.org/tuxanci_ng@187 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e --- src/base/net_multiplayer.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'src/base/net_multiplayer.c') diff --git a/src/base/net_multiplayer.c b/src/base/net_multiplayer.c index f85d287..d0732d7 100644 --- a/src/base/net_multiplayer.c +++ b/src/base/net_multiplayer.c @@ -31,14 +31,19 @@ int getNetTypeGame() return netGameType; } -#ifdef OLD_PUBLIC_SERVER - -int initNetMulitplayerPublicServer(char *ip4, int port4, char *ip6, int port6) +int initNetMuliplayerForGameServer(char *ip4, int port4, char *ip6, int port6) { - netGameType = NET_GAME_TYPE_SERVER; - return initUdpPublicServer(ip4, port4, ip6, port6); + int ret; + + ret = initServer(ip4, port4, ip6, port6); + + if( ret > 0 ) + { + netGameType = NET_GAME_TYPE_SERVER; + } + + return ret; } -#endif int initNetMuliplayer(int type, char *ip, int port, int proto) { @@ -50,11 +55,24 @@ int initNetMuliplayer(int type, char *ip, int port, int proto) break; case NET_GAME_TYPE_SERVER : - if( initServer(ip, port, proto) != 0 ) + switch( proto ) { - fprintf(stderr, "Unable to inicialize network game as server!\n"); - netGameType = NET_GAME_TYPE_NONE; - return -1; + case PROTO_UDPv4 : + if( initServer(ip, port, NULL, 0) != 1 ) + { + fprintf(stderr, "Unable to inicialize network game as server!\n"); + netGameType = NET_GAME_TYPE_NONE; + return -1; + } + break; + case PROTO_UDPv6 : + if( initServer(NULL, 0, ip, port) != 1 ) + { + fprintf(stderr, "Unable to inicialize network game as server!\n"); + netGameType = NET_GAME_TYPE_NONE; + return -1; + } + break; } break; -- cgit v1.2.3