aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2005-01-23 20:04:06 +0000
committerCarsten Weisse <[email protected]>2005-01-23 20:04:06 +0000
commite39c6f05a296e872b4b4dd024913c67dfdc9c19f (patch)
treecd004552513792662cd73281ed4b0f784bb1be5e /src/jake2
parent48a610b869b67b56c9450a2264165f614064fb55 (diff)
now it works without null and handles empty strings correctly
Diffstat (limited to 'src/jake2')
-rw-r--r--src/jake2/client/SCR.java7
-rw-r--r--src/jake2/game/Cmd.java4
-rw-r--r--src/jake2/qcommon/Com.java10
3 files changed, 12 insertions, 9 deletions
diff --git a/src/jake2/client/SCR.java b/src/jake2/client/SCR.java
index 9e263a1..7e27e3e 100644
--- a/src/jake2/client/SCR.java
+++ b/src/jake2/client/SCR.java
@@ -2,7 +2,7 @@
* SCR.java
* Copyright (C) 2003
*
- * $Id: SCR.java,v 1.11 2005-01-23 19:16:17 cawe Exp $
+ * $Id: SCR.java,v 1.12 2005-01-23 20:04:06 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -896,7 +896,8 @@ public final class SCR extends Globals {
Com.ParseHelp ph = new Com.ParseHelp(s);
- while ((token = Com.Parse(ph)) != null) {
+ while (!ph.isEof()) {
+ token = Com.Parse(ph);
if (token.equals("xl")) {
token = Com.Parse(ph);
x = Lib.atoi(token);
@@ -1127,7 +1128,7 @@ public final class SCR extends Globals {
value = cl.frame.playerstate.stats[Lib.atoi(token)];
if (value == 0) {
// skip to endif
- while ((token = Com.Parse(ph)) != null && !token.equals("endif"));
+ while (!ph.isEof() && !(token = Com.Parse(ph)).equals("endif"));
}
continue;
}
diff --git a/src/jake2/game/Cmd.java b/src/jake2/game/Cmd.java
index 749612e..621937e 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.9 2005-01-23 19:00:07 cawe Exp $
+ * $Id: Cmd.java,v 1.10 2005-01-23 20:04:02 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -284,7 +284,7 @@ public final class Cmd {
com_token = Com.Parse(ph);
- if (com_token == null)
+ if (ph.data == null)
return;
if (cmd_argc < Defines.MAX_STRING_TOKENS) {
diff --git a/src/jake2/qcommon/Com.java b/src/jake2/qcommon/Com.java
index ebd35ee..c8d7117 100644
--- a/src/jake2/qcommon/Com.java
+++ b/src/jake2/qcommon/Com.java
@@ -2,7 +2,7 @@
* Com.java
* Copyright (C) 2003
*
- * $Id: Com.java,v 1.9 2005-01-23 18:58:11 cawe Exp $
+ * $Id: Com.java,v 1.10 2005-01-23 20:04:02 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -207,14 +207,16 @@ public final class Com
int len = 0;
if (hlp.data == null) {
- return null;
+ return "";
}
while (true) {
// skip whitespace
hlp.skipwhites();
- if (hlp.isEof())
- return null;
+ if (hlp.isEof()) {
+ hlp.data = null;
+ return "";
+ }
// skip // comments
if (hlp.getchar() == '/') {