Convert to chunk positions for downhill

This commit is contained in:
Joshua Barretto 2020-01-26 13:21:33 +00:00
parent a4573f6fb2
commit 6e2784ba0e

View File

@ -1465,7 +1465,12 @@ impl WorldSim {
const MAX_ITERS: usize = 64;
for _ in 0..MAX_ITERS {
match this.get(pos)?.downhill {
Some(downhill) => pos = downhill,
Some(downhill) => {
pos = downhill
.map2(Vec2::from(TerrainChunkSize::RECT_SIZE), |e, sz: u32| {
e / (sz as i32)
})
}
None => return Some(pos),
}
}