mirror of
https://github.com/SpaceManiac/SpacemanDMM.git
synced 2025-12-23 05:36:47 +00:00
Add map saving back to the editor
This commit is contained in:
parent
aba941f77d
commit
6877bf3298
2 changed files with 51 additions and 2 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue