mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix issues loading larger maps
This commit is contained in:
parent
6bc0f76bf8
commit
f3284b7d90
@ -251,13 +251,13 @@ impl Civs {
|
||||
.into_iter()
|
||||
.for_each(|posi| {
|
||||
let chpos = uniform_idx_as_vec2(ctx.sim.map_size_lg(), posi);
|
||||
let wpos = chpos * TerrainChunkSize::RECT_SIZE.map(|e| e as i32);
|
||||
let wpos = chpos.map(|e| e as i64) * TerrainChunkSize::RECT_SIZE.map(|e| e as i64);
|
||||
let closest_site = (*sites)
|
||||
.iter_mut()
|
||||
.filter(|s| !matches!(s.1.kind, crate::site::SiteKind::Dungeon(_)))
|
||||
.min_by_key(|(_id, s)| s.get_origin().distance_squared(wpos));
|
||||
.min_by_key(|(_id, s)| s.get_origin().map(|e| e as i64).distance_squared(wpos));
|
||||
if let Some((_id, s)) = closest_site {
|
||||
let distance_squared = s.get_origin().distance_squared(wpos);
|
||||
let distance_squared = s.get_origin().map(|e| e as i64).distance_squared(wpos);
|
||||
s.economy
|
||||
.add_chunk(ctx.sim.get(chpos).unwrap(), distance_squared);
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ impl Economy {
|
||||
// info!("resources {:?}", self.stocks);
|
||||
}
|
||||
|
||||
pub fn add_chunk(&mut self, ch: &SimChunk, distance_squared: i32) {
|
||||
pub fn add_chunk(&mut self, ch: &SimChunk, distance_squared: i64) {
|
||||
let biome = ch.get_biome();
|
||||
// we don't scale by pi, although that would be correct
|
||||
let distance_bin = (distance_squared >> 16).min(64) as usize;
|
||||
|
Loading…
Reference in New Issue
Block a user