MCPcopy Create free account
hub / github.com/ZDoom/Raze / I_InitNetwork

Function I_InitNetwork

source/common/engine/i_net.cpp:982–1034  ·  view source on GitHub ↗

I_InitNetwork Returns true if packet server mode might be a good idea.

Source from the content-addressed store, hash-verified

980// Returns true if packet server mode might be a good idea.
981//
982int I_InitNetwork (void)
983{
984 int i;
985 const char *v;
986
987 memset (&doomcom, 0, sizeof(doomcom));
988
989 // set up for network
990 v = Args->CheckValue ("-dup");
991 if (v)
992 {
993 doomcom.ticdup = clamp<int> (atoi (v), 1, MAXTICDUP);
994 }
995 else
996 {
997 doomcom.ticdup = 1;
998 }
999
1000 v = Args->CheckValue ("-port");
1001 if (v)
1002 {
1003 DOOMPORT = atoi (v);
1004 Printf ("using alternate port %i\n", DOOMPORT);
1005 }
1006
1007 // parse network game options,
1008 // player 1: -host <numplayers>
1009 // player x: -join <player 1's address>
1010 if ( (i = Args->CheckParm ("-host")) )
1011 {
1012 if (!HostGame (i)) return -1;
1013 }
1014 else if ( (i = Args->CheckParm ("-join")) )
1015 {
1016 if (!JoinGame (i)) return -1;
1017 }
1018 else
1019 {
1020 // single player game
1021 netgame = false;
1022 multiplayer = false;
1023 doomcom.id = DOOMCOM_ID;
1024 doomcom.numplayers = doomcom.numnodes = 1;
1025 doomcom.consoleplayer = 0;
1026 return false;
1027 }
1028 if (doomcom.numnodes < 3)
1029 { // Packet server mode with only two players is effectively the same as
1030 // peer-to-peer but with some slightly larger packets.
1031 return false;
1032 }
1033 return doomcom.numnodes > 3 || !NodesOnSameNetwork();
1034}
1035
1036
1037void I_NetCmd (void)

Callers 1

D_CheckNetGameFunction · 0.85

Calls 6

PrintfFunction · 0.85
HostGameFunction · 0.85
JoinGameFunction · 0.85
NodesOnSameNetworkFunction · 0.85
CheckParmMethod · 0.80
CheckValueMethod · 0.45

Tested by

no test coverage detected