From 3713e3db9b54152a1f929cfbb773b4b0611eac0d Mon Sep 17 00:00:00 2001 From: helixhorned Date: Tue, 1 Nov 2011 22:01:35 +0000 Subject: [PATCH] Fix another dragpoint() bug that was wrongly omitting walls. This one could have only happened with TROR maps, I think. git-svn-id: https://svn.eduke32.com/eduke32@2097 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/engine.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 4564a733f..981f1412b 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -11477,7 +11477,7 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day) } } - if (clockwise==0) //search points CCW + if (!clockwise) //search points CCW { if (wall[w].nextwall >= 0) w = wall[wall[w].nextwall].point2; @@ -11488,7 +11488,15 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day) } } - if (clockwise==1) + cnt--; + if (cnt==0) + { + initprintf("dragpoint %d: infloop!\n", pointhighlight); + i = numyaxwalls; + break; + } + + if (clockwise) { thelastwall = lastwall(w); if (wall[thelastwall].nextwall >= 0) @@ -11497,9 +11505,15 @@ void dragpoint(int16_t pointhighlight, int32_t dax, int32_t day) break; } - cnt--; - if ((walbitmap[w>>3] & (1<<(w&7))) || cnt==0) - break; + if ((walbitmap[w>>3] & (1<<(w&7)))) + { + if (clockwise) + break; + + w = tmpstartwall; + clockwise = 1; + continue; + } } }