Permalink
Browse files

Fix dray with tmp=0 acting weirdly

  • Loading branch information...
LBPHacker authored and jacob1 committed Aug 5, 2018
1 parent 50a121f commit 5733073c33ffdbbe349256f8297e017590e0a33a
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/simulation/elements/DRAY.cpp
@@ -72,6 +72,7 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
{
bool overwrite = parts[ID(r)].ctype == PT_PSCN;
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
continue;
@@ -106,18 +107,18 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
// 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
// 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)))
{
copyLength -= partsRemaining;
localCopyLength -= partsRemaining;
xCopyTo = xCurrent + xStep*copySpaces;
yCopyTo = yCurrent + yStep*copySpaces;
break;
}
}
// now, actually copy the particles
partsRemaining = copyLength + 1;
partsRemaining = localCopyLength + 1;
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)
{

0 comments on commit 5733073

Please sign in to comment.