aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jake2/qcommon/Cvar.java32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/jake2/qcommon/Cvar.java b/src/jake2/qcommon/Cvar.java
index b84a40c..8f1c182 100644
--- a/src/jake2/qcommon/Cvar.java
+++ b/src/jake2/qcommon/Cvar.java
@@ -2,7 +2,7 @@
* Cvar.java
* Copyright (C) 2003
*
- * $Id: Cvar.java,v 1.1 2004-07-07 19:59:30 hzi Exp $
+ * $Id: Cvar.java,v 1.2 2004-07-20 11:02:24 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -132,7 +132,12 @@ public class Cvar extends Globals {
Globals.userinfo_modified = true; // transmit at next oportunity
var.string = value;
- var.value = Lib.atof(var.string);
+ try {
+ var.value = Float.parseFloat(var.string);
+ } catch (Exception e) {
+ var.value = 0.0f;
+ }
+
var.flags = flags;
return var;
@@ -186,13 +191,15 @@ public class Cvar extends Globals {
if (Com.ServerState() != 0) {
Com.Printf(var_name + " will be changed for next game.\n");
- //var.latched_string = CopyString(value);
var.latched_string = value;
}
else {
- //var.string = CopyString(value);
var.string = value;
- var.value = Lib.atof(var.string);
+ try {
+ var.value = Float.parseFloat(var.string);
+ } catch (Exception e) {
+ var.value = 0.0f;
+ }
if (var.name.equals("game")) {
FS.SetGamedir(var.string);
FS.ExecAutoexec();
@@ -216,11 +223,12 @@ public class Cvar extends Globals {
if ((var.flags & CVAR_USERINFO) != 0)
Globals.userinfo_modified = true; // transmit at next oportunity
- //Z_Free(var.string); // free the old value string
-
- //var.string = CopyString(value);
var.string = value;
- var.value = Lib.atof(var.string);
+ try {
+ var.value = Float.parseFloat(var.string);
+ } catch (Exception e) {
+ var.value = 0.0f;
+ }
return var;
}
@@ -311,7 +319,11 @@ public class Cvar extends Globals {
cvar_t var = Cvar.FindVar(var_name);
if (var == null)
return 0;
- return Lib.atof(var.string);
+ float val = 0.0f;
+ try {
+ val = Float.parseFloat(var.string);
+ } catch (Exception e) {}
+ return val;
}
/*