veloren/world/src/site2/plot.rs

24 lines
411 B
Rust
Raw Normal View History

2021-02-04 12:47:46 +00:00
use crate::util::DHashSet;
2021-02-06 23:53:25 +00:00
use vek::*;
2020-12-26 15:53:06 +00:00
pub struct Plot {
kind: PlotKind,
2021-02-04 12:47:46 +00:00
root_tile: Vec2<i32>,
tiles: DHashSet<Vec2<i32>>,
}
impl Plot {
pub fn find_bounds(&self) -> Aabr<i32> {
self.tiles
.iter()
2021-02-06 23:53:25 +00:00
.fold(Aabr::new_empty(self.root_tile), |b, t| {
b.expanded_to_contain_point(*t)
})
2021-02-04 12:47:46 +00:00
}
2020-12-26 15:53:06 +00:00
}
pub enum PlotKind {
2021-02-04 12:47:46 +00:00
Field,
House,
2020-12-26 15:53:06 +00:00
}