From 90e2dc5f5aad3a173bf020c3fc21e7338d75fb4f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 15 Jan 2016 16:40:50 +0100 Subject: [PATCH] - 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. --- src/p_local.h | 1 - src/p_maputl.cpp | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p_local.h b/src/p_local.h index e8cc5fde03..8597229121 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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); diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 1d806d0449..85e9183c57 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -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()