From 2816fb238a247ddc37ace0d920373dd8ddf97624 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Fri, 31 Oct 2008 02:48:01 +0000 Subject: [PATCH] float var fixes git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3353 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/command.cpp | 10 ++++++---- source/src/physics.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source/src/command.cpp b/source/src/command.cpp index 06251c35..d7a7148a 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -277,9 +277,11 @@ void intret(int v) const char *floatstr(float v) { - static string t; - ftoa(t, v); - return t; + static int n = 0; + static string t[3]; + n = (n + 1)%3; + ftoa(t[n], v); + return t[n]; } void floatret(float v) @@ -409,7 +411,7 @@ char *executeret(const char *p) // all evaluation hap float f1 = atof(w[1]); if(f1minvalf || f1>id->maxvalf) { - f1 = f1minvalf ? id->minvalf : id->maxvalf; // clamp to valfid range + f1 = f1minvalf ? id->minvalf : id->maxvalf; // clamp to valid range conoutf("valid range for %s is %s..%s", id->name, floatstr(id->minvalf), floatstr(id->maxvalf)); } *id->storage.f = f1; diff --git a/source/src/physics.cpp b/source/src/physics.cpp index 5df4bd97..299594a0 100644 --- a/source/src/physics.cpp +++ b/source/src/physics.cpp @@ -732,7 +732,7 @@ void fixcamerarange(physent *cam) while(cam->yaw>=360.0f) cam->yaw -= 360.0f; } -FVARP(sensitivity, 0.0f, 3.0f, 1000.0f); +FVARP(sensitivity, 1e-3f, 3.0f, 1000.0f); VARP(invmouse, 0, 0, 1); void mousemove(int dx, int dy)