From 917b299ecd87ac809ec409fe7c9f8a4cdf365a80 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 15 Mar 2025 00:03:07 -0400 Subject: [PATCH] Use transfer_part_to_pipe in special sim code that puts energy particles inside PIPE This fixes heat and deco not being handled in line with recent changes. PIPE's update loop could also be changed to handle energy particles there. This would be better, and I might do it (compatibility risks are probably low) --- src/simulation/Simulation.cpp | 7 +------ src/simulation/elements/PIPE.cpp | 5 ++--- src/simulation/elements/PIPE.h | 1 + 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 2e4166904..7843e293e 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -2919,12 +2919,7 @@ killed: if ((TYP(r)==PT_PIPE || TYP(r) == PT_PPIP) && !TYP(parts[ID(r)].ctype)) { - parts[ID(r)].ctype = parts[i].type; - parts[ID(r)].temp = parts[i].temp; - parts[ID(r)].tmp2 = parts[i].life; - parts[ID(r)].tmp3 = parts[i].tmp; - parts[ID(r)].tmp4 = parts[i].ctype; - kill_part(i); + Element_PIPE_transfer_part_to_pipe(parts+i, parts+(ID(r))); continue; } diff --git a/src/simulation/elements/PIPE.cpp b/src/simulation/elements/PIPE.cpp index ec957670a..d2f0924f7 100644 --- a/src/simulation/elements/PIPE.cpp +++ b/src/simulation/elements/PIPE.cpp @@ -3,7 +3,6 @@ #include "SOAP.h" static void props_pipe_to_part(const Particle *pipe, Particle *part, bool STOR); -static void transfer_part_to_pipe(Particle *part, Particle *pipe); static void transfer_pipe_to_pipe(Particle *src, Particle *dest, bool STOR); static void pushParticle(Simulation * sim, int i, int count, int original); @@ -255,7 +254,7 @@ int Element_PIPE_update(UPDATE_FUNC_ARGS) { if (TYP(r)==PT_SOAP) Element_SOAP_detach(sim, ID(r)); - transfer_part_to_pipe(parts+(ID(r)), parts+i); + Element_PIPE_transfer_part_to_pipe(parts+(ID(r)), parts+i); sim->kill_part(ID(r)); } else if (!TYP(parts[i].ctype) && TYP(r)==PT_STOR && sd.IsElement(parts[ID(r)].tmp) && (elements[parts[ID(r)].tmp].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))) @@ -467,7 +466,7 @@ void Element_PIPE_transfer_pipe_to_part(Simulation * sim, Particle *pipe, Partic } } -static void transfer_part_to_pipe(Particle *part, Particle *pipe) +void Element_PIPE_transfer_part_to_pipe(Particle *part, Particle *pipe) { pipe->ctype = part->type; diff --git a/src/simulation/elements/PIPE.h b/src/simulation/elements/PIPE.h index 25cba410c..ad3d5d253 100644 --- a/src/simulation/elements/PIPE.h +++ b/src/simulation/elements/PIPE.h @@ -3,6 +3,7 @@ int Element_PIPE_graphics(GRAPHICS_FUNC_ARGS); void Element_PIPE_transfer_pipe_to_part(Simulation * sim, Particle *pipe, Particle *part, bool STOR); +void Element_PIPE_transfer_part_to_pipe(Particle *part, Particle *pipe); void Element_PIPE_transformPatchOffsets(Particle &part, const std::array &offsetMap); int Element_PIPE_update(UPDATE_FUNC_ARGS); void Element_PPIP_flood_trigger(Simulation * sim, int x, int y, int sparkedBy);