Hello. So basically im trying to make a falling sand game. I have this vec in a my SandWorld struct called changes. Basically it stores two numbers the index of the destination cell, and the index of the source cell. When i update i want to loop through it and make any changes which is what i tried to do in apply_changes. Here is the code. The issue is is that changes wont change at all. Thats why im printing it out.
https://paste.rs/CWB.rs
#Vec wont change in a struct
6 messages · Page 1 of 1 (latest)
apply_changes looks suspicious: you're taking the first() element to use for overwriting and then pop()ing which removes the last element
for the kind of thing you want to do there, try https://doc.rust-lang.org/std/vec/struct.Vec.html#method.swap_remove
ohh alright, ill try that then