Start implementing direct serialization for abstract blueprint

This commit is contained in:
hal8174 2025-04-04 21:10:17 +02:00
parent 8e4e83e7ff
commit 5be9f81205
4 changed files with 109 additions and 4 deletions

View file

@ -12,6 +12,7 @@ use std::{collections::HashMap, sync::atomic::AtomicUsize};
mod power_connection;
mod roboports;
pub mod serde;
mod visualize;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@ -126,6 +127,13 @@ impl DirectionType {
DirectionType::QuarterDir(_quater_direction) => panic!(),
}
}
fn get_index(&self) -> u8 {
match self {
DirectionType::Dir(direction) => direction.get_index() * 4,
DirectionType::QuarterDir(quater_direction) => quater_direction.to_int_direction(),
}
}
}
#[derive(Debug, Clone)]