Skip to content

Commit

Permalink
fix STOR->PRTI transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Jan 3, 2018
1 parent 5012c3c commit 1405c10
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions src/simulation/elements/PIPE.cpp
Expand Up @@ -359,15 +359,25 @@ int Element_PIPE::graphics(GRAPHICS_FUNC_ARGS)
return 0;
}

//#TPT-Directive ElementHeader Element_PIPE static void transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part)
void Element_PIPE::transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part)
//#TPT-Directive ElementHeader Element_PIPE static void transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part, bool STOR=false)
void Element_PIPE::transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part, bool STOR)
{
part->type = TYP(pipe->ctype);
// STOR also calls this function to move particles from STOR to PRTI
// PIPE was changed, so now PIPE and STOR don't use the same particle storage format
if (STOR)
{
part->type = TYP(pipe->tmp);
pipe->tmp = 0;
}
else
{
part->type = TYP(pipe->ctype);
pipe->ctype = 0;
}
part->temp = pipe->temp;
part->life = pipe->tmp2;
part->tmp = pipe->pavg[0];
part->ctype = pipe->pavg[1];
pipe->ctype = 0;

if (!(sim->elements[part->type].Properties & TYPE_ENERGY))
{
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/elements/PRTI.cpp
Expand Up @@ -94,7 +94,7 @@ int Element_PRTI::update(UPDATE_FUNC_ARGS)
if (sim->IsValidElement(parts[ID(r)].tmp) && (sim->elements[parts[ID(r)].tmp].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)))
{
// STOR uses same format as PIPE, so we can use this function to do the transfer
Element_PIPE::transfer_pipe_to_part(sim, parts+(ID(r)), &sim->portalp[parts[i].tmp][count][nnx]);
Element_PIPE::transfer_pipe_to_part(sim, parts+(ID(r)), &sim->portalp[parts[i].tmp][count][nnx], true);
break;
}
}
Expand Down

0 comments on commit 1405c10

Please sign in to comment.