Fix dray with tmp=0 acting weirdly

This commit is contained in:
LBPHacker
2018-08-05 13:17:52 +02:00
committed by jacob1
parent 50a121f613
commit 5733073c33

View File

@@ -72,6 +72,7 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
{ {
bool overwrite = parts[ID(r)].ctype == PT_PSCN; bool overwrite = parts[ID(r)].ctype == PT_PSCN;
int partsRemaining = copyLength, xCopyTo, yCopyTo; //positions where the line will start being copied at int partsRemaining = copyLength, xCopyTo, yCopyTo; //positions where the line will start being copied at
int localCopyLength = copyLength;
if (parts[ID(r)].ctype == PT_INWR && rx && ry) // INWR doesn't spark from diagonals if (parts[ID(r)].ctype == PT_INWR && rx && ry) // INWR doesn't spark from diagonals
continue; continue;
@@ -106,10 +107,10 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
// 1: if .tmp isn't set, and the element in this spot is the ctype, then stop // 1: if .tmp isn't set, and the element in this spot is the ctype, then stop
// 2: if .tmp is set, stop when the length limit reaches 0 // 2: if .tmp is set, stop when the length limit reaches 0
// 3. Stop when we are out of bounds // 3. Stop when we are out of bounds
if ((!copyLength && TYP(rr) == ctype && (ctype != PT_LIFE || parts[ID(rr)].ctype == ctypeExtra)) if ((!localCopyLength && TYP(rr) == ctype && (ctype != PT_LIFE || parts[ID(rr)].ctype == ctypeExtra))
|| !(--partsRemaining && InBounds(xCurrent+xStep, yCurrent+yStep))) || !(--partsRemaining && InBounds(xCurrent+xStep, yCurrent+yStep)))
{ {
copyLength -= partsRemaining; localCopyLength -= partsRemaining;
xCopyTo = xCurrent + xStep*copySpaces; xCopyTo = xCurrent + xStep*copySpaces;
yCopyTo = yCurrent + yStep*copySpaces; yCopyTo = yCurrent + yStep*copySpaces;
break; break;
@@ -117,7 +118,7 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
} }
// now, actually copy the particles // now, actually copy the particles
partsRemaining = copyLength + 1; partsRemaining = localCopyLength + 1;
int type, p; int type, p;
for (int xStep = rx*-1, yStep = ry*-1, xCurrent = x+xStep, yCurrent = y+yStep; InBounds(xCopyTo, yCopyTo) && --partsRemaining; xCurrent+=xStep, yCurrent+=yStep, xCopyTo+=xStep, yCopyTo+=yStep) for (int xStep = rx*-1, yStep = ry*-1, xCurrent = x+xStep, yCurrent = y+yStep; InBounds(xCopyTo, yCopyTo) && --partsRemaining; xCurrent+=xStep, yCurrent+=yStep, xCopyTo+=xStep, yCopyTo+=yStep)
{ {