diff options
author | Holger Zickner <[email protected]> | 2004-07-23 10:09:55 +0000 |
---|---|---|
committer | Holger Zickner <[email protected]> | 2004-07-23 10:09:55 +0000 |
commit | a161d9817f1a86aedffb8789e2134c6a29e5fa35 (patch) | |
tree | 9d5298865c5a7781c099a0f3fca94c2205476610 /src/jake2 | |
parent | 4d14584117e56e51ea4fd69de1807a0e3329e7dc (diff) |
replace Lib functions
Diffstat (limited to 'src/jake2')
-rw-r--r-- | src/jake2/client/Key.java | 8 | ||||
-rw-r--r-- | src/jake2/client/Menu.java | 6 | ||||
-rw-r--r-- | src/jake2/game/Cmd.java | 12 | ||||
-rw-r--r-- | src/jake2/game/GameSpawn.java | 11 | ||||
-rw-r--r-- | src/jake2/game/M_Flyer.java | 8 | ||||
-rw-r--r-- | src/jake2/server/SV_CCMDS.java | 4 | ||||
-rw-r--r-- | src/jake2/server/SV_MAIN.java | 6 | ||||
-rw-r--r-- | src/jake2/util/Lib.java | 33 |
8 files changed, 29 insertions, 59 deletions
diff --git a/src/jake2/client/Key.java b/src/jake2/client/Key.java index 5f7d921..6d011cb 100644 --- a/src/jake2/client/Key.java +++ b/src/jake2/client/Key.java @@ -2,7 +2,7 @@ * Key.java * Copyright (C) 2003 * - * $Id: Key.java,v 1.4 2004-07-09 06:50:50 hzi Exp $ + * $Id: Key.java,v 1.5 2004-07-23 10:02:49 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -615,7 +615,8 @@ public class Key extends Globals { while (history_line != Globals.edit_line && Globals.key_lines[history_line][1] == 0); if (history_line == Globals.edit_line) history_line = (Globals.edit_line + 1) & 31; - Lib.strcpy(Globals.key_lines[Globals.edit_line], Globals.key_lines[history_line]); + //Lib.strcpy(Globals.key_lines[Globals.edit_line], Globals.key_lines[history_line]); + System.arraycopy(Globals.key_lines[history_line], 0, Globals.key_lines[Globals.edit_line], 0, Globals.key_lines[Globals.edit_line].length); Globals.key_linepos = Lib.strlen(Globals.key_lines[Globals.edit_line]); return; } @@ -632,7 +633,8 @@ public class Key extends Globals { Globals.key_linepos = 1; } else { - Lib.strcpy(Globals.key_lines[Globals.edit_line], Globals.key_lines[history_line]); + //Lib.strcpy(Globals.key_lines[Globals.edit_line], Globals.key_lines[history_line]); + System.arraycopy(Globals.key_lines[history_line], 0, Globals.key_lines[Globals.edit_line], 0, Globals.key_lines[Globals.edit_line].length); Globals.key_linepos = Lib.strlen(Globals.key_lines[Globals.edit_line]); } return; diff --git a/src/jake2/client/Menu.java b/src/jake2/client/Menu.java index faaf77c..c6c7606 100644 --- a/src/jake2/client/Menu.java +++ b/src/jake2/client/Menu.java @@ -2,7 +2,7 @@ * Menu.java * Copyright (C) 2004 * - * $Id: Menu.java,v 1.4 2004-07-09 06:50:50 hzi Exp $ + * $Id: Menu.java,v 1.5 2004-07-23 10:02:49 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -2531,7 +2531,7 @@ public final class Menu extends Key { // ignore if duplicated for (i = 0; i < m_num_servers; i++) - if (0 == strcmp(x, local_server_names[i])) + if (x.equals(local_server_names[i])) return; local_server_netadr[m_num_servers] = adr; @@ -3924,7 +3924,7 @@ public final class Menu extends Key { // copy the valid skins for (s = 0, k = 0; k < npcxfiles - 1; k++) { - if (!strstr(pcxnames[k], "_i.pcx")) { + if (pcxnames[k].indexOf("_i.pcx") < 0) { if (IconOfSkinExists(pcxnames[k], pcxnames, npcxfiles - 1)) { a = pcxnames[k].lastIndexOf('/'); b = pcxnames[k].lastIndexOf('\\'); diff --git a/src/jake2/game/Cmd.java b/src/jake2/game/Cmd.java index a5a0a50..22d35a5 100644 --- a/src/jake2/game/Cmd.java +++ b/src/jake2/game/Cmd.java @@ -2,7 +2,7 @@ * Cmd.java * Copyright (C) 2003 * - * $Id: Cmd.java,v 1.3 2004-07-09 06:50:49 hzi Exp $ + * $Id: Cmd.java,v 1.4 2004-07-23 10:07:14 hzi Exp $ */ /* Copyright (C) 1997-2001 Id Software, Inc. @@ -395,7 +395,7 @@ public final class Cmd extends PlayerView for (cmd= cmd_functions; cmd != null; cmd= cmd.next) { - if (0 == strcmp(cmd_name, cmd.name)) + if (cmd.name.equals(cmd_name)) return true; } @@ -1197,9 +1197,9 @@ public final class Cmd extends PlayerView if (arg0) { - strcat(text, gi.argv(0)); - strcat(text, " "); - strcat(text, gi.args()); + text += gi.argv(0); + text += " "; + text += gi.args(); } else { @@ -1224,7 +1224,7 @@ public final class Cmd extends PlayerView //text[150] = 0; text= text.substring(0, 150); - strcat(text, "\n"); + text += "\n"; if (flood_msgs.value != 0) { diff --git a/src/jake2/game/GameSpawn.java b/src/jake2/game/GameSpawn.java index 34412fd..7dc4934 100644 --- a/src/jake2/game/GameSpawn.java +++ b/src/jake2/game/GameSpawn.java @@ -19,13 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 18.11.2003 by RST. -// $Id: GameSpawn.java,v 1.3 2004-07-09 06:50:49 hzi Exp $ +// $Id: GameSpawn.java,v 1.4 2004-07-23 10:07:14 hzi Exp $ package jake2.game; -import jake2.Defines; -import jake2.util.*; -import jake2.qcommon.*; +import jake2.qcommon.Com; +import jake2.util.Lib; public class GameSpawn extends GameSave { @@ -595,14 +594,14 @@ public class GameSpawn extends GameSave { if (item.classname == null) continue; - if (0 == Lib.stricmp(item.classname, ent.classname)) { // found it + if (item.classname.equalsIgnoreCase(ent.classname)) { // found it SpawnItem(ent, item); return; } } // check normal spawn functions for (i=0; (s = spawns[i]) !=null && s.name != null; i++) { - if (0 == Lib.stricmp(s.name, ent.classname)) { // found it + if (s.name.equalsIgnoreCase(ent.classname)) { // found it if (s.spawn == null) gi.error("ED_CallSpawn: null-spawn on index=" + i); diff --git a/src/jake2/game/M_Flyer.java b/src/jake2/game/M_Flyer.java index 7cfc66b..09b629a 100644 --- a/src/jake2/game/M_Flyer.java +++ b/src/jake2/game/M_Flyer.java @@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.11.2003 by RST. -// $Id: M_Flyer.java,v 1.2 2004-07-08 15:58:44 hzi Exp $ +// $Id: M_Flyer.java,v 1.3 2004-07-23 10:07:14 hzi Exp $ package jake2.game; -import jake2.util.*; -import jake2.util.*; +import jake2.util.Lib; +import jake2.util.Math3D; public class M_Flyer extends M_Player { // This file generated by ModelGen - Do NOT Modify @@ -760,7 +760,7 @@ public class M_Flyer extends M_Player { } // fix a map bug in jail5.bsp - if (0 == Lib.stricmp(level.mapname, "jail5") && (self.s.origin[2] == -104)) { + if (level.mapname.equalsIgnoreCase("jail5") && (self.s.origin[2] == -104)) { self.targetname= self.target; self.target= null; } diff --git a/src/jake2/server/SV_CCMDS.java b/src/jake2/server/SV_CCMDS.java index f890cab..105e156 100644 --- a/src/jake2/server/SV_CCMDS.java +++ b/src/jake2/server/SV_CCMDS.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 18.01.2004 by RST. -// $Id: SV_CCMDS.java,v 1.4 2004-07-14 15:34:24 cawe Exp $ +// $Id: SV_CCMDS.java,v 1.5 2004-07-23 10:09:01 hzi Exp $ package jake2.server; @@ -652,7 +652,7 @@ public class SV_CCMDS extends SV_ENTS { // if not a pcx, demo, or cinematic, check to make sure the level exists map = Cmd.Argv(1); - if (!strstr(map, ".")) { + if (map.indexOf(".") < 0) { expanded = "maps/" + map + ".bsp"; if (FS.LoadFile(expanded) == null) { Com.Printf("Can't find " + expanded + "\n"); diff --git a/src/jake2/server/SV_MAIN.java b/src/jake2/server/SV_MAIN.java index 510decc..b3d5e9d 100644 --- a/src/jake2/server/SV_MAIN.java +++ b/src/jake2/server/SV_MAIN.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 13.01.2004 by RST. -// $Id: SV_MAIN.java,v 1.3 2004-07-09 06:50:49 hzi Exp $ +// $Id: SV_MAIN.java,v 1.4 2004-07-23 10:09:01 hzi Exp $ package jake2.server; @@ -444,8 +444,8 @@ public class SV_MAIN extends SV_GAME { remaining = ""; for (i = 2; i < Cmd.Argc(); i++) { - strcat(remaining, Cmd.Argv(i)); - strcat(remaining, " "); + remaining += Cmd.Argv(i); + remaining += " "; } Cmd.ExecuteString(remaining); diff --git a/src/jake2/util/Lib.java b/src/jake2/util/Lib.java index 4f5559c..e0d1791 100644 --- a/src/jake2/util/Lib.java +++ b/src/jake2/util/Lib.java @@ -19,7 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // Created on 09.12.2003 by RST. -// $Id: Lib.java,v 1.4 2004-07-12 20:47:01 hzi Exp $ +// $Id: Lib.java,v 1.5 2004-07-23 10:09:55 hzi Exp $ package jake2.util; @@ -75,10 +75,6 @@ public class Lib { return in1.compareTo(in2); } - public static int stricmp(String in1, String in2) { - return in1.compareToIgnoreCase(in2); - } - public static boolean strstr(String i1, String i2) { return (i1.indexOf(i2) != -1); } @@ -123,10 +119,6 @@ public class Lib { return res; } -// public static int strlen(String in) { -// return in.length(); -// } - public static int strlen(char in[]) { for (int i = 0; i < in.length; i++) if (in[i] == 0) @@ -141,21 +133,6 @@ public class Lib { return in.length; } - public static void strcat(String in, String i) { - in += i; - } - - public static void strcpy(byte dest[], byte src[]) { - for (int i = 0; i < dest.length && i < src.length; i++) - if (src[i] == 0) { - dest[i] = 0; - return; - } - else - dest[i] = src[i]; - - } - static byte[] buffer = new byte[Defines.MAX_INFO_STRING]; public static String readString(ByteBuffer bb, int len) { bb.get(buffer, 0, len); @@ -242,14 +219,6 @@ public class Lib { f.write(s.getBytes(), 0, len); } - public static String cut(String in, char c) { - int pos = in.indexOf(c); - - if (pos != -1) - return in.substring(0, pos); - return in; - } - public static RandomAccessFile fopen(String name, String mode) { try { return new RandomAccessFile(name, mode); |