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

Function D_CheckNetGame

source/core/d_net.cpp:1658–1762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1656//
1657
1658bool D_CheckNetGame (void)
1659{
1660 const char *v;
1661 int i;
1662
1663 // First install the global net command handlers
1664
1665 Net_SetCommandHandler(DEM_GENERICCHEAT, genericCheat);
1666 Net_SetCommandHandler(DEM_CHANGEMAP, changeMap);
1667 Net_SetCommandHandler(DEM_ENDSCREENJOB, endScreenJob);
1668 Net_SetCommandHandler(DEM_SAVEGAME, startSaveGame);
1669
1670 for (i = 0; i < MAXNETNODES; i++)
1671 {
1672 nodeingame[i] = false;
1673 nettics[i] = 0;
1674 remoteresend[i] = false; // set when local needs tics
1675 resendto[i] = 0; // which tic to start sending
1676 }
1677
1678 // Packet server has proven to be rather slow over the internet. Print a warning about it.
1679 v = Args->CheckValue("-netmode");
1680 if (v != NULL && (atoi(v) != 0))
1681 {
1682 Printf(TEXTCOLOR_YELLOW "Notice: Using PacketServer (netmode 1) over the internet is prone to running too slow on some internet configurations."
1683 "\nIf the game is running well below expected speeds, use netmode 0 (P2P) instead.\n");
1684 }
1685
1686 int result = I_InitNetwork ();
1687 // I_InitNetwork sets doomcom and netgame
1688 if (result == -1)
1689 {
1690 return false;
1691 }
1692 else if (result > 0)
1693 {
1694 // For now, stop auto selecting PacketServer, as it's more likely to cause confusion.
1695 //NetMode = NET_PacketServer;
1696 }
1697 if (doomcom.id != DOOMCOM_ID)
1698 {
1699 I_FatalError ("Doomcom buffer invalid!");
1700 }
1701#if 0
1702 players[0].settings_controller = true;
1703#endif
1704
1705 myconnectindex = doomcom.consoleplayer;
1706
1707 if (myconnectindex == Net_Arbitrator)
1708 {
1709 v = Args->CheckValue("-netmode");
1710 if (v != NULL)
1711 {
1712 NetMode = atoi(v) != 0 ? NET_PacketServer : NET_PeerToPeer;
1713 }
1714 if (doomcom.numnodes > 1)
1715 {

Callers 1

RunGameFunction · 0.85

Calls 8

Net_SetCommandHandlerFunction · 0.85
PrintfFunction · 0.85
I_InitNetworkFunction · 0.85
I_FatalErrorFunction · 0.85
D_ArbitrateNetStartFunction · 0.85
CheckParmMethod · 0.80
ReadNetVarsMethod · 0.80
CheckValueMethod · 0.45

Tested by

no test coverage detected