From f1ddc12b68b4e4c8087962de25260470e6df2bea Mon Sep 17 00:00:00 2001 From: Connor Thomson Date: Tue, 8 Sep 2026 18:27:39 -0700 Subject: Add tuxanci2 files --- src/base/net_multiplayer.c | 138 --------------------------------------------- 1 file changed, 138 deletions(-) delete mode 100644 src/base/net_multiplayer.c (limited to 'src/base/net_multiplayer.c') diff --git a/src/base/net_multiplayer.c b/src/base/net_multiplayer.c deleted file mode 100644 index 9888f03..0000000 --- a/src/base/net_multiplayer.c +++ /dev/null @@ -1,138 +0,0 @@ -#include -#include -#include -#include -#include - -#include "main.h" -#include "list.h" -#include "tux.h" -#include "item.h" -#include "arenaFile.h" -#include "net_multiplayer.h" -#include "server.h" - -#include "udp.h" - -#ifndef PUBLIC_SERVER -#include "setting.h" -#include "choiceArena.h" - -#include "screen.h" -#include "client.h" -#endif /* PUBLIC_SERVER */ - -static int netGameType; - -int net_multiplayer_get_game_type() -{ - return netGameType; -} - -int net_multiplayer_init_for_game_server(char *ip4, char *ip6, int port) -{ - int ret; - - ret = server_init(ip4, ip6, port); - - if (ret > 0) { - netGameType = NET_GAME_TYPE_SERVER; - } - - return ret; -} - -int net_multiplayer_init(int type, char *ip, int port, int proto) -{ - netGameType = type; - - switch (netGameType) { - case NET_GAME_TYPE_NONE: - break; - - case NET_GAME_TYPE_SERVER: - switch (proto) { - case PROTO_UDPv4: - if (server_init(ip, NULL, port) != 1) { - error("Unable to initialize multiplayer game"); - netGameType = NET_GAME_TYPE_NONE; - return -1; - } - break; - - case PROTO_UDPv6: - if (server_init(NULL, ip, port) != 1) { - error("Unable to initialize multiplayer game"); - netGameType = NET_GAME_TYPE_NONE; - return -1; - } - break; - } - break; - -#ifndef PUBLIC_SERVER - case NET_GAME_TYPE_CLIENT: - if (client_init(ip, port) != 0) { - error("Unable to join multiplayer game"); - netGameType = NET_GAME_TYPE_NONE; - return -1; - } - break; -#endif /* PUBLIC_SERVER */ - - default: - error("Unknown type of the network game [%d]", netGameType); - assert(0); - break; - } - - return 0; -} - -void net_multiplayer_event() -{ - switch (netGameType) { - case NET_GAME_TYPE_NONE: - break; - - case NET_GAME_TYPE_SERVER: - server_event(); - break; - -#ifndef PUBLIC_SERVER - case NET_GAME_TYPE_CLIENT: - client_event(); - break; -#endif /* PUBLIC_SERVER */ - - default: - error("Unknown type of the network game [%d]", netGameType); - assert(0); - break; - } -} - -void net_multiplayer_quit() -{ - switch (netGameType) { - case NET_GAME_TYPE_NONE: - break; - - case NET_GAME_TYPE_SERVER: - server_quit(); - break; - -#ifndef PUBLIC_SERVER - case NET_GAME_TYPE_CLIENT: - client_quit(); - break; -#endif /* PUBLIC_SERVER */ - - default: - error("Unknown type of the network game [%d]", netGameType); - assert(0); - break; - } - - netGameType = NET_GAME_TYPE_NONE; -} -- cgit v1.2.3