mindustry logic execution, map- and schematic- parsing and rendering
fix defaulting for displays
bendn 2023-09-14
parent 6d9ad38 · commit 6cf0bbb
-rw-r--r--lemu/Cargo.toml2
-rw-r--r--lemu/src/executor/mod.rs7
-rw-r--r--lemu/src/parser.rs2
3 files changed, 3 insertions, 8 deletions
diff --git a/lemu/Cargo.toml b/lemu/Cargo.toml
index 37465ba..3452163 100644
--- a/lemu/Cargo.toml
+++ b/lemu/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lemu"
-version = "0.2.0"
+version = "0.2.1"
edition = "2021"
description = "M-LOG runner"
authors = ["bend-n <[email protected]>"]
diff --git a/lemu/src/executor/mod.rs b/lemu/src/executor/mod.rs
index f436916..d8fd6e4 100644
--- a/lemu/src/executor/mod.rs
+++ b/lemu/src/executor/mod.rs
@@ -7,13 +7,8 @@ pub use builder::ExecutorBuilderInternal;
use fimg::Image;
use std::{collections::VecDeque, io::Write, num::NonZeroUsize, pin::Pin};
-#[derive(Debug, Copy, Clone)]
+#[derive(Debug, Copy, Clone, Default)]
pub struct Display(pub usize);
-impl Default for Display {
- fn default() -> Self {
- Self(1)
- }
-}
#[derive(Debug, Copy, Clone)]
// negative means bank, positive means cell
pub struct Memory(pub(crate) i8);
diff --git a/lemu/src/parser.rs b/lemu/src/parser.rs
index 3290af6..9fd08e1 100644
--- a/lemu/src/parser.rs
+++ b/lemu/src/parser.rs
@@ -583,7 +583,7 @@ pub fn parse<'source, W: Wr>(
}
Token::DrawFlush => {
let t = tok!();
- if let Ok(t) = t {
+ if let Ok(t) = t && t != Token::Newline {
let screen = take_ident!(t)?;
if screen != "display" {
yeet!(InvalidDisplayType(screen));