#Vec wont change in a struct

6 messages · Page 1 of 1 (latest)

verbal dust
#

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

jagged owl
#

apply_changes looks suspicious: you're taking the first() element to use for overwriting and then pop()ing which removes the last element

verbal dust
#

ohh alright, ill try that then

jagged owl
#

overall, though, this is a lot of code to look through, so you might want to put some effort towards identifying where the problem is yourself

#

dbg!() or println!() things to see if they make sense, and so on