Formating fixes

This commit is contained in:
Piotr Siuszko 2025-10-04 22:03:03 +02:00
parent 6e2820b500
commit 476b8d067f
2 changed files with 16 additions and 18 deletions

View File

@ -363,9 +363,8 @@ impl TilemapGenerationConfig {
} }
} }
}; };
let working_dir = std::path::absolute(dir).unwrap_or_default();
working_dir std::path::absolute(dir).unwrap_or_default()
} }
pub fn generate(&self) -> anyhow::Result<()> { pub fn generate(&self) -> anyhow::Result<()> {

View File

@ -70,26 +70,25 @@ impl SkylinePacker {
// keep the `bottom` and `width` as small as possible // keep the `bottom` and `width` as small as possible
for i in 0..self.skylines.len() { for i in 0..self.skylines.len() {
if let Some(r) = self.can_put(i, w, h) { if let Some(r) = self.can_put(i, w, h)
if r.bottom() < bottom || (r.bottom() == bottom && self.skylines[i].w < width) { && (r.bottom() < bottom || (r.bottom() == bottom && self.skylines[i].w < width))
{
bottom = r.bottom(); bottom = r.bottom();
width = self.skylines[i].w; width = self.skylines[i].w;
index = Some(i); index = Some(i);
rect = r; rect = r;
} }
}
if self.config.allow_rotation { if self.config.allow_rotation
if let Some(r) = self.can_put(i, h, w) { && let Some(r) = self.can_put(i, h, w)
if r.bottom() < bottom || (r.bottom() == bottom && self.skylines[i].w < width) { && (r.bottom() < bottom || (r.bottom() == bottom && self.skylines[i].w < width))
{
bottom = r.bottom(); bottom = r.bottom();
width = self.skylines[i].w; width = self.skylines[i].w;
index = Some(i); index = Some(i);
rect = r; rect = r;
} }
} }
}
}
index.map(|x| (x, rect)) index.map(|x| (x, rect))
} }