dedupe animation frames handling
This commit is contained in:
10
src/tile.rs
10
src/tile.rs
@@ -1,4 +1,5 @@
|
||||
use crate::{from_base36, optional_data_line, AnimationFrames, Image, ToBase36};
|
||||
use crate::image::animation_frames_from_string;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Tile {
|
||||
@@ -60,12 +61,9 @@ impl From<String> for Tile {
|
||||
}
|
||||
}
|
||||
|
||||
let animation_frames = lines[1..].join("");
|
||||
let animation_frames: Vec<&str> = animation_frames.split(">").collect();
|
||||
let animation_frames: Vec<Image> = animation_frames
|
||||
.iter()
|
||||
.map(|&frame| Image::from(frame.to_string()))
|
||||
.collect();
|
||||
let animation_frames = animation_frames_from_string(
|
||||
lines[1..].join("\n")
|
||||
);
|
||||
|
||||
Tile {
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user