mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed i16 underflow
This commit is contained in:
parent
1db7cc7fde
commit
3881d2ea38
@ -484,20 +484,27 @@ impl World {
|
||||
.filter(|col| layer::tree::tree_valid_at(col, attr.seed))
|
||||
.zip(Some(attr))
|
||||
})
|
||||
.map(|(col, tree)| lod::Object {
|
||||
.filter_map(|(col, tree)| Some(lod::Object {
|
||||
kind: match tree.forest_kind {
|
||||
all::ForestKind::Oak => lod::ObjectKind::Oak,
|
||||
all::ForestKind::Pine
|
||||
| all::ForestKind::Frostpine=> lod::ObjectKind::Pine,
|
||||
_ => lod::ObjectKind::Oak,
|
||||
},
|
||||
pos: (tree.pos - min_wpos)
|
||||
pos: {
|
||||
let rpos = tree.pos - min_wpos;
|
||||
if rpos.is_any_negative() {
|
||||
return None
|
||||
} else {
|
||||
rpos
|
||||
.map(|e| e as u16)
|
||||
.with_z(self.sim().get_alt_approx(tree.pos).unwrap_or(0.0) as u16),
|
||||
.with_z(self.sim().get_alt_approx(tree.pos).unwrap_or(0.0) as u16)
|
||||
}
|
||||
},
|
||||
flags: lod::Flags::empty()
|
||||
| if col.snow_cover { lod::Flags::SNOW_COVERED } else { lod::Flags::empty() }
|
||||
,
|
||||
})
|
||||
}))
|
||||
.collect());
|
||||
|
||||
lod::Zone { objects }
|
||||
|
Loading…
Reference in New Issue
Block a user