Permalink
Browse files

fix STOR->PRTI transfer

  • Loading branch information...
jacob1 committed Jan 3, 2018
1 parent 5012c3c commit 1405c10046bced478010531e826384dababa1339
Showing with 15 additions and 5 deletions.
  1. +14 −4 src/simulation/elements/PIPE.cpp
  2. +1 −1 src/simulation/elements/PRTI.cpp
@@ -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))
{
@@ -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;
}
}

0 comments on commit 1405c10

Please sign in to comment.