mindustry logic execution, map- and schematic- parsing and rendering
Diffstat (limited to 'src/block/logic.rs')
| -rw-r--r-- | src/block/logic.rs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/block/logic.rs b/src/block/logic.rs index c0cb727..f76fa5e 100644 --- a/src/block/logic.rs +++ b/src/block/logic.rs @@ -116,10 +116,6 @@ impl BlockLogic for CanvasBlock { } } - fn clone_state(&self, state: &State) -> State { - Box::new(Self::get_state(state).clone()) - } - fn serialize_state(&self, state: &State) -> Result<DynData, SerializeError> { let mut o = vec![0; self.canvas_size as usize * self.canvas_size as usize * 3]; let p = Self::get_state(state); @@ -152,8 +148,7 @@ impl BlockLogic for CanvasBlock { s: Scale, ) -> ImageHolder { if let Some(state) = state { - let state = self.clone_state(state); - let p = state.downcast::<RgbImage>().unwrap(); + let p = Self::get_state(state); let offset = match s { Scale::Full => 7, // Scale::Half => 3, @@ -164,7 +159,7 @@ impl BlockLogic for CanvasBlock { RgbImage::from_raw( self.canvas_size as u32, self.canvas_size as u32, - p.into_raw(), + p.clone().into_raw(), ) .unwrap(), ) @@ -254,10 +249,6 @@ impl BlockLogic for MessageLogic { } } - fn clone_state(&self, state: &State) -> State { - Box::new(Self::get_state(state).clone()) - } - fn mirror_state(&self, _: &mut State, _: bool, _: bool) {} fn rotate_state(&self, _: &mut State, _: bool) {} @@ -316,10 +307,6 @@ impl BlockLogic for SwitchLogic { } } - fn clone_state(&self, state: &State) -> State { - Box::new(*Self::get_state(state)) - } - fn serialize_state(&self, state: &State) -> Result<DynData, SerializeError> { Ok(DynData::Boolean(*Self::get_state(state))) } @@ -453,10 +440,6 @@ impl BlockLogic for ProcessorLogic { Ok(()) } - fn clone_state(&self, state: &State) -> State { - Box::new(Self::get_state(state).clone()) - } - fn mirror_state(&self, state: &mut State, horizontally: bool, vertically: bool) { for link in &mut Self::get_state_mut(state).links { if horizontally { |