mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-07-31 21:50:18 +02:00
Fix yet another extremely rare pmap corruption
Don't just set the .type of struct Particle to 0, kids. Code tracked back to the times from before git; already present in b0ea52690b
, the initial commit.
Reproduce with
sim.clearSim()
elem.property(elem.DEFAULT_PT_DMND, "Update", function(i, x, y)
local ni = sim.photons(x, y)
if ni then
if not sim.partProperty(ni, "vx") then
print(x, y)
assert(false)
end
end
end)
local i = sim.partCreate(-1, 100, 100, elem.DEFAULT_PT_NEUT)
sim.partProperty(i, "vx", 0)
sim.partProperty(i, "vy", 2)
sim.partCreate(-1, 100, 100, elem.DEFAULT_PT_DMND)
sim.partCreate(-1, 100, 102, elem.DEFAULT_PT_PRTI)
sim.paused(true)
sim.framerender(1)
Though if done this way, it's actually a photons corruption.
This commit is contained in:
@@ -1216,7 +1216,7 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
|
||||
if (!portalp[parts[ID(r)].tmp][count][nnx].type)
|
||||
{
|
||||
portalp[parts[ID(r)].tmp][count][nnx] = parts[i];
|
||||
parts[i].type=PT_NONE;
|
||||
kill_part(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user