summaryrefslogtreecommitdiff
path: root/src/base/net_multiplayer.c
diff options
context:
space:
mode:
authororoborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-08-02 14:12:48 +0000
committeroroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e>2008-08-02 14:12:48 +0000
commit1a592767c6e34bdeb7f30fa063b5e24c57d45894 (patch)
treee21ebcc5bc79cc5b6a6dfb4b9635ff95c52842c4 /src/base/net_multiplayer.c
parent6b805af42cba72e190d94ffa6d1dd7e44d9dfb61 (diff)
- 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
Diffstat (limited to 'src/base/net_multiplayer.c')
-rw-r--r--src/base/net_multiplayer.c38
1 files changed, 28 insertions, 10 deletions
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;