Skip to content

Commit

Permalink
allow DRAY to copy energy particles
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Sep 24, 2015
1 parent dab2516 commit 4594de5
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/simulation/elements/DRAY.cpp
Expand Up @@ -81,6 +81,8 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
for (int xStep = rx*-1, yStep = ry*-1, xCurrent = x+xStep, yCurrent = y+yStep; ; xCurrent+=xStep, yCurrent+=yStep)
{
int rr = pmap[yCurrent][xCurrent];
if (!rr)
rr = sim->photons[yCurrent][xCurrent];
if ((!copyLength && (rr&0xFF) == ctype && (ctype != PT_LIFE || parts[rr>>8].ctype == ctypeExtra))
|| !(--partsRemaining && InBounds(xCurrent+xStep, yCurrent+yStep)))
{
Expand All @@ -96,6 +98,12 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
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)
{
int type = pmap[yCurrent][xCurrent]&0xFF, p;
bool isPhot = false;
if (!type)
{
type = sim->photons[yCurrent][xCurrent]&0xFF;
isPhot = true;
}
if (overwrite)
sim->delete_part(xCopyTo, yCopyTo);
if (type == PT_SPRK) //hack
Expand All @@ -108,7 +116,10 @@ int Element_DRAY::update(UPDATE_FUNC_ARGS)
{
if (type == PT_SPRK)
sim->part_change_type(p, xCopyTo, yCopyTo, PT_SPRK);
parts[p] = parts[pmap[yCurrent][xCurrent]>>8];
if (isPhot)
parts[p] = parts[sim->photons[yCurrent][xCurrent]>>8];
else
parts[p] = parts[pmap[yCurrent][xCurrent]>>8];
parts[p].x = xCopyTo;
parts[p].y = yCopyTo;
}
Expand Down

0 comments on commit 4594de5

Please sign in to comment.