Add map saving back to the editor

This commit is contained in:
Tad Hardesty 2018-10-05 13:13:34 -07:00
parent aba941f77d
commit 6877bf3298
2 changed files with 51 additions and 2 deletions

View file

@ -75,6 +75,16 @@ impl Map {
save_tgm(self, File::create(path)?)
}
pub fn adjust_key_length(&mut self) {
if self.dictionary.len() > 2704 {
self.key_length = 3;
} else if self.dictionary.len() > 52 {
self.key_length = 2;
} else {
self.key_length = 1;
}
}
#[inline]
pub fn dim_xyz(&self) -> (usize, usize, usize) {
let dim = self.grid.dim();
@ -130,6 +140,12 @@ impl fmt::Display for Prefab {
}
}
impl Key {
pub fn next(self) -> Key {
Key(self.0 + 1)
}
}
// ----------------------------------------------------------------------------
// Map Writer