mindustry logic execution, map- and schematic- parsing and rendering
bendn 7 months ago
parent ecca26d · commit 6c2ae57
-rw-r--r--mindus/src/data/map.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/mindus/src/data/map.rs b/mindus/src/data/map.rs
index e2cb73e..3ba4300 100644
--- a/mindus/src/data/map.rs
+++ b/mindus/src/data/map.rs
@@ -455,19 +455,16 @@ macro_rules! cond {
}
impl Crossable for Map {
- fn cross(&self, j: usize, c: &PositionContext) -> Cross {
+ fn cross(&self, j: usize, _: &PositionContext) -> Cross {
let get = |i| {
- let b = &self[i];
+ let b: &Tile = self.tiles.get(i)?;
Some((b.get_block()?, b.get_rotation()?))
};
[
- cond![
- c.position.1 == 0 || c.position.1 >= c.height,
- get(j + self.height)
- ],
- cond![c.position.0 >= (c.height - 1), get(j + 1)],
- cond![c.position.1 >= (c.height - 1), get(j - self.width)],
- cond![j < c.height, get(j - 1)],
+ get(j + self.height),
+ get(j + 1),
+ get(j - self.width),
+ get(j - 1),
]
}
}