From a9db9987001cd402c78b2af3c1b93932460bbcfc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Feb 2016 09:54:09 +0100 Subject: [PATCH] - did some refactoring on FPathTraverse to allow inheriting from that class with different collection functions. This will be needed to implement an efficient portal checker that doesn't run through the entire blockmap to find the portals. --- src/p_maputl.cpp | 2 +- src/p_maputl.h | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 2835896f98..eee5167ce8 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -1398,7 +1398,7 @@ intercept_t *FPathTraverse::Next() // //=========================================================================== -FPathTraverse::FPathTraverse (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags) +void FPathTraverse::init (fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags) { fixed_t xt1, xt2; fixed_t yt1, yt2; diff --git a/src/p_maputl.h b/src/p_maputl.h index 452f99b3d0..415d4b83bd 100644 --- a/src/p_maputl.h +++ b/src/p_maputl.h @@ -325,6 +325,7 @@ public: class FPathTraverse { +protected: static TArray intercepts; divline_t trace; @@ -332,14 +333,19 @@ class FPathTraverse unsigned int intercept_count; unsigned int count; - void AddLineIntercepts(int bx, int by); - void AddThingIntercepts(int bx, int by, FBlockThingsIterator &it, bool compatible); + virtual void AddLineIntercepts(int bx, int by); + virtual void AddThingIntercepts(int bx, int by, FBlockThingsIterator &it, bool compatible); + void init(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags); + FPathTraverse() {} public: intercept_t *Next(); - FPathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags); - ~FPathTraverse(); + FPathTraverse(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, int flags) + { + init(x1, y1, x2, y2, flags); + } + virtual ~FPathTraverse(); const divline_t &Trace() const { return trace; } };