mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
PF_traceline causes program to die badly if given non-numeric (isnan) vectors. So we must check to not allow this happening. Additionally, stop program execution is developer cvar is set. Note: Compiling program with gcc option \'-ffast-math\' (and more specifically, -funsafe-math-optimizations) is an alternative fix than this patch. It performs FPU opts that gloss over the issue
git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@268 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
d9ed158672
commit
41d8164068
1 changed files with 13 additions and 0 deletions
|
@ -658,6 +658,19 @@ void PF_traceline (void)
|
|||
nomonsters = G_FLOAT(OFS_PARM2);
|
||||
ent = G_EDICT(OFS_PARM3);
|
||||
|
||||
if (developer.value) {
|
||||
if (isnan(v1[0]) || isnan(v1[1]) || isnan(v1[2]) ||
|
||||
isnan(v2[0]) || isnan(v2[1]) || isnan(v2[2]))
|
||||
{
|
||||
Host_Error("NAN in traceline:\nv1(%f %f %f) v2(%f %f %f)\nentity %d",
|
||||
v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], EDICT_TO_PROG(ent));
|
||||
}
|
||||
} else {
|
||||
if (isnan(v1[0]) || isnan(v1[1]) || isnan(v1[2]))
|
||||
v1[0] = v1[1] = v1[2] = 0;
|
||||
if (isnan(v2[0]) || isnan(v2[1]) || isnan(v2[2]))
|
||||
v2[0] = v2[1] = v2[2] = 0;
|
||||
}
|
||||
trace = SV_Move (v1, vec3_origin, vec3_origin, v2, nomonsters, ent);
|
||||
|
||||
pr_global_struct->trace_allsolid = trace.allsolid;
|
||||
|
|
Loading…
Reference in a new issue