- some minor optimizations to FPathTraverse:

* since we can trivially decide whether a line crosses the trace behind the end point from checking the return value of P_InterceptVector, there is no need to add those to the list of intercepts as they get discarded anyway in t
* maxfrac is always FRACUNIT so there's no need to waste some variable for a constant value.
This commit is contained in:
Christoph Oelckers 2016-01-15 16:40:50 +01:00
parent ef8dc22f7d
commit 90e2dc5f5a
2 changed files with 2 additions and 4 deletions

View File

@ -380,7 +380,6 @@ class FPathTraverse
divline_t trace;
unsigned int intercept_index;
unsigned int intercept_count;
fixed_t maxfrac;
unsigned int count;
void AddLineIntercepts(int bx, int by);

View File

@ -985,7 +985,7 @@ void FPathTraverse::AddLineIntercepts(int bx, int by)
P_MakeDivline (ld, &dl);
frac = P_InterceptVector (&trace, &dl);
if (frac < 0) continue; // behind source
if (frac < 0 || frac > 1) continue; // behind source or beyond end point
intercept_t newintercept;
@ -1170,7 +1170,7 @@ intercept_t *FPathTraverse::Next()
}
}
if (dist > maxfrac || in == NULL) return NULL; // checked everything in range
if (dist > FRACUNIT || in == NULL) return NULL; // checked everything in range
in->done = true;
return in;
}
@ -1388,7 +1388,6 @@ FPathTraverse::FPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, in
break;
}
}
maxfrac = FRACUNIT;
}
FPathTraverse::~FPathTraverse()