mindustry logic execution, map- and schematic- parsing and rendering
-rw-r--r--lemu/Cargo.toml4
-rw-r--r--lemu/src/instructions/draw.rs27
2 files changed, 5 insertions, 26 deletions
diff --git a/lemu/Cargo.toml b/lemu/Cargo.toml
index b877728..cc69700 100644
--- a/lemu/Cargo.toml
+++ b/lemu/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lemu"
-version = "0.2.9"
+version = "0.2.10"
edition = "2021"
description = "M-LOG runner"
authors = ["bend-n <[email protected]>"]
@@ -12,7 +12,7 @@ keywords = ["mindustry", "logic", "emulator", "executor"]
[dependencies]
thiserror = "1.0"
enum_dispatch = "0.3"
-fimg = { version = "0.4", default-features = false }
+fimg = { version = "0.4.3", default-features = false }
logos = "0.13.0"
rust-fuzzy-search = { version = "0.1.1", optional = true }
beef = "0.5"
diff --git a/lemu/src/instructions/draw.rs b/lemu/src/instructions/draw.rs
index 405d40b..365b422 100644
--- a/lemu/src/instructions/draw.rs
+++ b/lemu/src/instructions/draw.rs
@@ -140,12 +140,6 @@ impl<'v> DrawInstruction<'v> for Line<'v> {
}
}
-macro_rules! unbounded {
- ($img:ident @ $x:expr => $y:expr) => {
- $img.width() <= $x || $img.height() <= $y
- };
-}
-
#[derive(Debug)]
pub struct RectFilled<'v> {
pub position: Point<'v>,
@@ -162,11 +156,7 @@ impl<'v> DrawInstruction<'v> for RectFilled<'v> {
let pos = map!(point!([email protected]), |n| n as u32);
let width = get_num!(mem.get(&self.width)) as u32;
let height = get_num!(mem.get(&self.height)) as u32;
- if unbounded!(image @ pos.0 + width => pos.1 + height) {
- return;
- }
- // SAFETY: bounds checked above
- unsafe { image.filled_box(pos, width, height, state.col()) };
+ image.filled_box(pos, width, height, state.col());
}
}
@@ -188,11 +178,7 @@ impl<'v> DrawInstruction<'v> for RectBordered<'v> {
let pos = map!(point!([email protected]), |n| n as u32);
let width = get_num!(mem.get(&self.width)) as u32;
let height = get_num!(mem.get(&self.height)) as u32;
- if unbounded!(image @ pos.0 + width => pos.1 + height) {
- return;
- }
- // SAFETY: bounds checked above
- unsafe { image.r#box(pos, width, height, state.col()) };
+ image.r#box(pos, width, height, state.col());
}
}
@@ -208,14 +194,7 @@ impl<'v> DrawInstruction<'v> for Triangle<'v> {
map!(point!([email protected]), to32),
map!(point!([email protected]), to32),
);
- if unbounded!(i @ a.0 as u32 => a.1 as u32)
- || unbounded!(i @ b.0 as u32 => b.1 as u32)
- || unbounded!(i @ c.0 as u32 => c.1 as u32)
- {
- return;
- }
- // SAFETY: bounds are checked
- unsafe { i.tri(a, b, c, state.col()) };
+ i.tri(a, b, c, state.col());
}
}