Skip to content

Commit

Permalink
Fix dray with tmp=0 acting weirdly
Browse files Browse the repository at this point in the history
  • Loading branch information
LBPHacker authored and jacob1 committed Oct 31, 2018
1 parent 50a121f commit 5733073
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/simulation/elements/DRAY.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 5733073

Please sign in to comment.