Fix Mapster32 bug where sometimes you'd get two points instead of one when pressing enter to insert points where the lines intersect with the wall drawing tool

git-svn-id: https://svn.eduke32.com/eduke32@6857 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-04-23 10:15:12 +00:00
parent 16696dbe0b
commit b4a8656910

View file

@ -7606,9 +7606,12 @@ end_space_handling:
} }
newnumwalls = -1; newnumwalls = -1;
char touchedwall[(MAXWALLS+7)>>3];
for (i=0; i<numdrawnwalls; i++) for (i=0; i<numdrawnwalls; i++)
{ {
Bmemset(touchedwall, 0, sizeof(touchedwall));
for (j=numwalls-1; j>=0; j--) /* j may be modified in loop */ for (j=numwalls-1; j>=0; j--) /* j may be modified in loop */
{ {
vec2_t pint; vec2_t pint;
@ -7616,6 +7619,9 @@ end_space_handling:
YAX_SKIPWALL(j); YAX_SKIPWALL(j);
if (wall[j].nextwall >= 0 && (touchedwall[wall[j].nextwall>>3] & pow2char[wall[j].nextwall&7]))
continue;
if (!lineintersect2v((vec2_t *)&wall[j], (vec2_t *)&POINT2(j), if (!lineintersect2v((vec2_t *)&wall[j], (vec2_t *)&POINT2(j),
&point[i], &point[i+1], &pint)) &point[i], &point[i+1], &pint))
continue; continue;
@ -7623,6 +7629,8 @@ end_space_handling:
if (vec2eq(&pint, (vec2_t *)&wall[j]) || vec2eq(&pint, (vec2_t *)&POINT2(j))) if (vec2eq(&pint, (vec2_t *)&wall[j]) || vec2eq(&pint, (vec2_t *)&POINT2(j)))
continue; continue;
touchedwall[j>>3] |= (1<<(j&7));
inspts = M32_InsertPoint(j, pint.x, pint.y, -1, &j); /* maybe modify j */ inspts = M32_InsertPoint(j, pint.x, pint.y, -1, &j); /* maybe modify j */
if (inspts==0) if (inspts==0)