This fixes the aforementioned TROR corruption. It happened because Mapster32

allowed circle-walls started on the unconstrained _other_ side of a constrained
wall. Also fix a potential invalid wall access when inserting a point (pretty
serious, that!)

git-svn-id: https://svn.eduke32.com/eduke32@2091 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-10-30 19:48:13 +00:00
parent 78cf620036
commit 51b31c5445

View file

@ -385,27 +385,10 @@ static void yax_resetbunchnums(void)
// Whether a wall is constrained by sector extensions. // Whether a wall is constrained by sector extensions.
// If false, it's a wall that you can freely move around, // If false, it's a wall that you can freely move around,
// attach points to, etc... // attach points to, etc...
static int32_t yax_islockedwall(int16_t sec, int16_t line) static int32_t yax_islockedwall(int16_t line)
#if 1
{ {
UNREFERENCED_PARAMETER(sec);
return !!(wall[line].cstat&YAX_NEXTWALLBITS); return !!(wall[line].cstat&YAX_NEXTWALLBITS);
} }
#else
{
int16_t cb,fb, cbn,fbn;
int16_t ns = wall[line].nextsector;
yax_getbunches(sec, &cb, &fb);
if (ns < 0)
return (cb>=0 || fb>=0);
yax_getbunches(ns, &cbn, &fbn);
return (cb!=cbn || fb!=fbn);
}
#endif
# define DEFAULT_YAX_HEIGHT (2048<<4) # define DEFAULT_YAX_HEIGHT (2048<<4)
#endif #endif
@ -5517,7 +5500,10 @@ end_join_sectors:
if (linehighlight >= 0) if (linehighlight >= 0)
{ {
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (yax_islockedwall(sectorofwall(linehighlight), linehighlight)) j = linehighlight;
if (yax_islockedwall(j) ||
(wall[j].nextwall >= 0 && yax_islockedwall(wall[j].nextwall)))
printmessage16("Can't make circle in wall constrained by sector extension."); printmessage16("Can't make circle in wall constrained by sector extension.");
else else
#endif #endif
@ -6469,11 +6455,10 @@ point_not_inserted:
else else
{ {
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
int32_t sec = sectorofwall(linehighlight), nextw=wall[linehighlight].nextwall; int32_t nextw = wall[linehighlight].nextwall;
int32_t tmpcf; int32_t tmpcf;
k = linehighlight; if (yax_islockedwall(linehighlight) || (nextw>=0 && yax_islockedwall(nextw)))
if (yax_islockedwall(sec, k) || yax_islockedwall(wall[k].nextsector, wall[k].nextwall))
{ {
// yax'ed wall -- first find out which walls are affected // yax'ed wall -- first find out which walls are affected
for (i=0; i<numwalls; i++) for (i=0; i<numwalls; i++)