mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/block/simple.rs')
-rw-r--r--src/block/simple.rs47
1 files changed, 20 insertions, 27 deletions
diff --git a/src/block/simple.rs b/src/block/simple.rs
index b45e2bf..46b0b23 100644
--- a/src/block/simple.rs
+++ b/src/block/simple.rs
@@ -1,34 +1,9 @@
use std::any::{Any, type_name};
use crate::block::{BlockLogic, DeserializeError, SerializeError};
+use crate::data::GridPos;
use crate::data::dynamic::DynData;
-macro_rules!gen_state_empty
-{
- () =>
- {
- fn data_from_i32(&self, _: i32) -> DynData
- {
- DynData::Empty
- }
-
- fn deserialize_state(&self, _: DynData) -> Result<Option<Box<dyn Any>>, DeserializeError>
- {
- Ok(None)
- }
-
- fn clone_state(&self, _: &dyn Any) -> Box<dyn Any>
- {
- panic!("{} has no custom state", type_name::<Self>())
- }
-
- fn serialize_state(&self, _: &dyn Any) -> Result<DynData, SerializeError>
- {
- Ok(DynData::Empty)
- }
- };
-}
-
macro_rules!state_impl
{
($vis:vis $type:ty) =>
@@ -84,5 +59,23 @@ impl BlockLogic for SimpleBlock
self.symmetric
}
- gen_state_empty!();
+ fn data_from_i32(&self, _: i32, _: GridPos) -> DynData
+ {
+ DynData::Empty
+ }
+
+ fn deserialize_state(&self, _: DynData) -> Result<Option<Box<dyn Any>>, DeserializeError>
+ {
+ Ok(None)
+ }
+
+ fn clone_state(&self, _: &dyn Any) -> Box<dyn Any>
+ {
+ panic!("{} has no custom state", type_name::<Self>())
+ }
+
+ fn serialize_state(&self, _: &dyn Any) -> Result<DynData, SerializeError>
+ {
+ Ok(DynData::Empty)
+ }
}