diff options
| author | xHire <xhire@tuxportal.cz> | 2008-10-25 14:11:06 +0200 |
|---|---|---|
| committer | xHire <xhire@tuxportal.cz> | 2008-10-25 14:11:06 +0200 |
| commit | c8a9209d77a896bf49227e5aeccd54e91ccf29cc (patch) | |
| tree | 6b7367406ebbc6ce3ea5e0c8668c75f6fb3f6ae9 /src/base/net_multiplayer.c | |
| parent | cb9deba915dd7b114eeb76601eb1c8b07c1ba90f (diff) | |
Changed style of the code to the K&R standard
Diffstat (limited to 'src/base/net_multiplayer.c')
| -rw-r--r-- | src/base/net_multiplayer.c | 169 |
1 files changed, 82 insertions, 87 deletions
diff --git a/src/base/net_multiplayer.c b/src/base/net_multiplayer.c index bfd4f94..d967413 100644 --- a/src/base/net_multiplayer.c +++ b/src/base/net_multiplayer.c @@ -15,125 +15,120 @@ #include "udp.h" #ifndef PUBLIC_SERVER -#include "screen_setting.h" -#include "screen_choiceArena.h" +# include "screen_setting.h" +# include "screen_choiceArena.h" -#include "screen.h" -#include "client.h" +# include "screen.h" +# include "client.h" #endif static int netGameType; -int -getNetTypeGame() +int getNetTypeGame() { - return netGameType; + return netGameType; } -int -initNetMuliplayerForGameServer(char *ip4, int port4, char *ip6, int port6) +int initNetMuliplayerForGameServer(char *ip4, int port4, char *ip6, int port6) { - int ret; + int ret; - ret = initServer(ip4, port4, ip6, port6); + ret = initServer(ip4, port4, ip6, port6); - if (ret > 0) { - netGameType = NET_GAME_TYPE_SERVER; - } + if (ret > 0) { + netGameType = NET_GAME_TYPE_SERVER; + } - return ret; + return ret; } -int -initNetMuliplayer(int type, char *ip, int port, int proto) +int initNetMuliplayer(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 (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; + netGameType = type; + + switch (netGameType) { + case NET_GAME_TYPE_NONE: + break; + + case NET_GAME_TYPE_SERVER: + switch (proto) { + 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; #ifndef PUBLIC_SERVER - case NET_GAME_TYPE_CLIENT: - if (initClient(ip, port, proto) != 0) { - fprintf(stderr, - _("Unable to inicialize network game as client!\n")); - netGameType = NET_GAME_TYPE_NONE; - return -1; - } - break; + case NET_GAME_TYPE_CLIENT: + if (initClient(ip, port, proto) != 0) { + fprintf(stderr, + _("Unable to inicialize network game as client!\n")); + netGameType = NET_GAME_TYPE_NONE; + return -1; + } + break; #endif - default: - assert(!_("Variable netGameType has a really weird value!")); - break; - } + default: + assert(!_("Variable netGameType has a really weird value!")); + break; + } - return 0; + return 0; } -void -eventNetMultiplayer() +void eventNetMultiplayer() { - switch (netGameType) { - case NET_GAME_TYPE_NONE: - break; + switch (netGameType) { + case NET_GAME_TYPE_NONE: + break; - case NET_GAME_TYPE_SERVER: - eventServer(); - break; + case NET_GAME_TYPE_SERVER: + eventServer(); + break; #ifndef PUBLIC_SERVER - case NET_GAME_TYPE_CLIENT: - eventClient(); - break; + case NET_GAME_TYPE_CLIENT: + eventClient(); + break; #endif - default: - assert(!_("Variable netGameType has a really weird value!")); - break; - } + default: + assert(!_("Variable netGameType has a really weird value!")); + break; + } } -void -quitNetMultiplayer() +void quitNetMultiplayer() { - switch (netGameType) { - case NET_GAME_TYPE_NONE: - break; + switch (netGameType) { + case NET_GAME_TYPE_NONE: + break; - case NET_GAME_TYPE_SERVER: - quitServer(); - break; + case NET_GAME_TYPE_SERVER: + quitServer(); + break; #ifndef PUBLIC_SERVER - case NET_GAME_TYPE_CLIENT: - quitClient(); - break; + case NET_GAME_TYPE_CLIENT: + quitClient(); + break; #endif - default: - assert(!_("Variable netGameType has a really weird value!")); - break; - } + default: + assert(!_("Variable netGameType has a really weird value!")); + break; + } - netGameType = NET_GAME_TYPE_NONE; + netGameType = NET_GAME_TYPE_NONE; } |