mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 12:32:40 +02:00
fix STOR->PRTI transfer
This commit is contained in:
@@ -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)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user