static net() { for (int kk = 0; kk < HOSTCACHESIZE; kk++) { hostcache[kk] = new hostcache_t(); } }
public static void PrintSlist() { int i; for (i = slistLastShown; i < hostCacheCount; i++) { hostcache_t hc = hostcache[i]; if (hc.maxusers != 0) { Con_Printf("{0,-15} {1,-15}\n {2,2}/{3,2}\n", Copy(hc.name, 15), Copy(hc.map, 15), hc.users, hc.maxusers); } else { Con_Printf("{0,-15} {1,-15}\n", Copy(hc.name, 15), Copy(hc.map, 15)); } } slistLastShown = i; }
public static void NET_Init() { for (int i2 = 0; i2 < hostcache.Length; i2++) { hostcache[i2] = new hostcache_t(); } if (net_drivers == null) { if (HasParam("-playback")) { net_drivers = new INetDriver[] { new NetVcr() }; } else { net_drivers = new INetDriver[] { new NetLoop(), NetDatagram.Instance }; } } if (net_landrivers == null) { net_landrivers = new INetLanDriver[] { NetTcpIp.Instance }; } if (HasParam("-record")) { recording = true; } int i = COM_CheckParm("-port"); if (i == 0) { i = COM_CheckParm("-udpport"); } if (i == 0) { i = COM_CheckParm("-ipxport"); } if (i > 0) { if (i < com_argv.Length - 1) { DEFAULTnet_hostport = atoi(Argv(i + 1)); } else { Sys_Error("Net.Init: you must specify a number after -port!"); } } net_hostport = DEFAULTnet_hostport; if (HasParam("-listen") || cls.state == cactive_t.ca_dedicated) { listening = true; } int numsockets = svs.maxclientslimit; if (cls.state != cactive_t.ca_dedicated) { numsockets++; } net_freeSockets = new List <qsocket_t>(numsockets); net_activeSockets = new List <qsocket_t>(numsockets); for (i = 0; i < numsockets; i++) { net_freeSockets.Add(new qsocket_t()); } SetNetTime(); // allocate space for network message buffer Message = new MsgWriter(q_shared.NET_MAXMESSAGE); // SZ_Alloc (&net_message, NET_MAXMESSAGE); Reader = new MsgReader(Message); net_messagetimeout = new cvar_t("net_messagetimeout", "300"); hostname = new cvar_t("hostname", "UNNAMED"); Cmd_AddCommand("slist", NET_Slist_f); Cmd_AddCommand("listen", NET_Listen_f); Cmd_AddCommand("maxplayers", MaxPlayers_f); Cmd_AddCommand("port", NET_Port_f); // initialize all the drivers net_driverlevel = 0; foreach (INetDriver driver in net_drivers) { driver.Init(); if (driver.IsInitialized && listening) { driver.Datagram_Listen(true); } net_driverlevel++; } //if (*my_ipx_address) // Con_DPrintf("IPX address %s\n", my_ipx_address); if (!String.IsNullOrEmpty(my_tcpip_address)) { Con_DPrintf("TCP/IP address {0}\n", my_tcpip_address); } }
static net() { for (int kk = 0; kk < HOSTCACHESIZE; kk++) hostcache[kk] = new hostcache_t(); }