diff options
author | Carsten Weisse <[email protected]> | 2004-10-17 21:31:33 +0000 |
---|---|---|
committer | Carsten Weisse <[email protected]> | 2004-10-17 21:31:33 +0000 |
commit | e4d312fbb1ad8cd41df011543c5dc2f4fa08d214 (patch) | |
tree | 9e68ba0fd9c6c258f0a284ea53ff01adaa719704 /src/jake2 | |
parent | acd23027524869949409a8f84b1c13dcd4bc9c97 (diff) |
NET methods refactored (name cleanup)
Diffstat (limited to 'src/jake2')
-rw-r--r-- | src/jake2/qcommon/Qcommon.java | 4 | ||||
-rw-r--r-- | src/jake2/server/SV_MAIN.java | 12 | ||||
-rw-r--r-- | src/jake2/sys/NET.java | 30 |
3 files changed, 23 insertions, 23 deletions
diff --git a/src/jake2/qcommon/Qcommon.java b/src/jake2/qcommon/Qcommon.java index 4ce1129..d05629b 100644 --- a/src/jake2/qcommon/Qcommon.java +++ b/src/jake2/qcommon/Qcommon.java @@ -2,7 +2,7 @@ * Qcommon.java * Copyright 2003 * - * $Id: Qcommon.java,v 1.9 2004-09-19 20:53:07 hzi Exp $ + * $Id: Qcommon.java,v 1.10 2004-10-17 21:31:33 cawe Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -112,7 +112,7 @@ public final class Qcommon extends Globals { Cvar.Get("version", s, CVAR_SERVERINFO | CVAR_NOSET); Jake2.Q2Dialog.setStatus("initializing network subsystem..."); - NET.NET_Init(); //ok + NET.Init(); //ok Netchan.Netchan_Init(); //ok Jake2.Q2Dialog.setStatus("initializing server subsystem..."); diff --git a/src/jake2/server/SV_MAIN.java b/src/jake2/server/SV_MAIN.java index 41d5789..ea2a8ad 100644 --- a/src/jake2/server/SV_MAIN.java +++ b/src/jake2/server/SV_MAIN.java @@ -19,7 +19,7 @@ */ // Created on 13.01.2004 by RST. -// $Id: SV_MAIN.java,v 1.8 2004-09-22 19:22:12 salomo Exp $ +// $Id: SV_MAIN.java,v 1.9 2004-10-17 21:31:32 cawe Exp $ package jake2.server; import jake2.Defines; @@ -257,7 +257,7 @@ public class SV_MAIN { // see if we already have a challenge for this ip for (i = 0; i < Defines.MAX_CHALLENGES; i++) { - if (NET.NET_CompareBaseAdr(Globals.net_from, + if (NET.CompareBaseAdr(Globals.net_from, SV_INIT.svs.challenges[i].adr)) break; if (SV_INIT.svs.challenges[i].time < oldestTime) { @@ -330,7 +330,7 @@ public class SV_MAIN { // see if the challenge is valid if (!NET.IsLocalAddress(adr)) { for (i = 0; i < Defines.MAX_CHALLENGES; i++) { - if (NET.NET_CompareBaseAdr(Globals.net_from, + if (NET.CompareBaseAdr(Globals.net_from, SV_INIT.svs.challenges[i].adr)) { if (challenge == SV_INIT.svs.challenges[i].challenge) break; // good @@ -352,7 +352,7 @@ public class SV_MAIN { if (cl.state == Defines.cs_free) continue; - if (NET.NET_CompareBaseAdr(adr, cl.netchan.remote_address) + if (NET.CompareBaseAdr(adr, cl.netchan.remote_address) && (cl.netchan.qport == qport || adr.port == cl.netchan.remote_address.port)) { if (!NET.IsLocalAddress(adr) && (SV_INIT.svs.realtime - cl.lastconnect) < ((int) SV_MAIN.sv_reconnect_limit.value * 1000)) { @@ -627,7 +627,7 @@ public class SV_MAIN { cl = SV_INIT.svs.clients[i]; if (cl.state == Defines.cs_free) continue; - if (!NET.NET_CompareBaseAdr(Globals.net_from, + if (!NET.CompareBaseAdr(Globals.net_from, cl.netchan.remote_address)) continue; if (cl.netchan.qport != qport) @@ -776,7 +776,7 @@ public class SV_MAIN { Com.Printf("sv lowclamp\n"); SV_INIT.svs.realtime = SV_INIT.sv.time - 100; } - NET.NET_Sleep(SV_INIT.sv.time - SV_INIT.svs.realtime); + NET.Sleep(SV_INIT.sv.time - SV_INIT.svs.realtime); return; } diff --git a/src/jake2/sys/NET.java b/src/jake2/sys/NET.java index 86c6e29..0b657f5 100644 --- a/src/jake2/sys/NET.java +++ b/src/jake2/sys/NET.java @@ -1,7 +1,7 @@ /* * NET.java Copyright (C) 2003 * - * $Id: NET.java,v 1.4 2004-10-17 20:33:17 cawe Exp $ + * $Id: NET.java,v 1.5 2004-10-17 21:31:32 cawe Exp $ */ /* * Copyright (C) 1997-2001 Id Software, Inc. @@ -82,7 +82,7 @@ public final class NET { * * Compares without the port =================== */ - public static boolean NET_CompareBaseAdr(netadr_t a, netadr_t b) { + public static boolean CompareBaseAdr(netadr_t a, netadr_t b) { if (a.type != b.type) return false; @@ -101,7 +101,7 @@ public final class NET { + (a.ip[2] & 0xff) + "." + (a.ip[3] & 0xff) + ":" + a.port; } - public static String NET_BaseAdrToString(netadr_t a) { + public static String BaseAdrToString(netadr_t a) { return "" + (a.ip[0] & 0xff) + "." + (a.ip[1] & 0xff) + "." + (a.ip[2] & 0xff) + "." + (a.ip[3] & 0xff); } @@ -137,7 +137,7 @@ public final class NET { * ============================================================================= */ - public static boolean NET_GetLoopPacket(int sock, netadr_t net_from, + public static boolean GetLoopPacket(int sock, netadr_t net_from, sizebuf_t net_message) { loopback_t loop; loop = loopbacks[sock]; @@ -159,7 +159,7 @@ public final class NET { return true; } - public static void NET_SendLoopPacket(int sock, int length, byte[] data, + public static void SendLoopPacket(int sock, int length, byte[] data, netadr_t to) { int i; loopback_t loop; @@ -178,7 +178,7 @@ public final class NET { public static boolean GetPacket(int sock, netadr_t net_from, sizebuf_t net_message) { - if (NET_GetLoopPacket(sock, net_from, net_message)) { + if (GetLoopPacket(sock, net_from, net_message)) { return true; } @@ -221,7 +221,7 @@ public final class NET { public static void SendPacket(int sock, int length, byte[] data, netadr_t to) { if (to.type == Defines.NA_LOOPBACK) { - NET_SendLoopPacket(sock, length, data, to); + SendLoopPacket(sock, length, data, to); return; } @@ -249,18 +249,18 @@ public final class NET { /* * ==================== NET_OpenIP ==================== */ - public static void NET_OpenIP() { + public static void OpenIP() { cvar_t port, ip; port = Cvar.Get("port", "" + Defines.PORT_SERVER, Defines.CVAR_NOSET); ip = Cvar.Get("ip", "localhost", Defines.CVAR_NOSET); if (ip_sockets[Defines.NS_SERVER] == null) - ip_sockets[Defines.NS_SERVER] = NET_Socket(Defines.NS_SERVER, + ip_sockets[Defines.NS_SERVER] = Socket(Defines.NS_SERVER, ip.string, (int) port.value); if (ip_sockets[Defines.NS_CLIENT] == null) - ip_sockets[Defines.NS_CLIENT] = NET_Socket(Defines.NS_CLIENT, + ip_sockets[Defines.NS_CLIENT] = Socket(Defines.NS_CLIENT, ip.string, Defines.PORT_ANY); } @@ -280,7 +280,7 @@ public final class NET { } } else { // open sockets - NET_OpenIP(); + OpenIP(); } } @@ -289,14 +289,14 @@ public final class NET { /* * ==================== NET_Init ==================== */ - public static void NET_Init() { + public static void Init() { //empty } /* * ==================== NET_Socket ==================== */ - public static DatagramSocket NET_Socket(int sock, String ip, int port) { + public static DatagramSocket Socket(int sock, String ip, int port) { DatagramSocket newsocket = null; try { @@ -331,13 +331,13 @@ public final class NET { /* * ==================== NET_Shutdown ==================== */ - public static void NET_Shutdown() { + public static void Shutdown() { // close sockets Config(false); } // sleeps msec or until net socket is ready - public static void NET_Sleep(int msec) { + public static void Sleep(int msec) { if (ip_sockets[Defines.NS_SERVER] == null || (Globals.dedicated != null && Globals.dedicated.value == 0)) return; // we're not a server, just run full speed |