This commit is contained in:
shenjack 2024-05-23 00:12:41 +08:00
parent f5abf92cff
commit 06835d70b8
Signed by: shenjack
GPG Key ID: 7B1134A979775551
5 changed files with 6 additions and 3 deletions

View File

@ -21,7 +21,7 @@ fn get_version_str() -> String {
#[pymodule]
#[pyo3(name = "Difficult_Rocket_rs")]
fn module_init(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
fn module_init(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction!(get_version_str, m)?)?;
m.add_function(wrap_pyfunction!(sr1_parse::part_list::read_part_list_py, m)?)?;
m.add_function(wrap_pyfunction!(sr1_parse::ship::py_raw_ship_from_file, m)?)?;

View File

@ -8,4 +8,5 @@
pub mod console;
pub mod data;
#[allow(unused)]
pub mod editor;

View File

@ -5,7 +5,7 @@ use pyo3::prelude::*;
use crate::dr_physics::math::{Point2D, Rotate};
use crate::sr1_parse::part_list::RawPartList;
use crate::sr1_parse::ship::{Connection, Connections, RawConnectionData, RawShip};
use crate::sr1_parse::ship::{Connection, RawConnectionData, RawShip};
use crate::sr1_parse::SaveStatus;
use crate::sr1_parse::{get_max_box, SR1PartData, SR1PartListTrait};
use crate::sr1_parse::{SR1PartList, SR1PartType, SR1Ship};
@ -233,7 +233,7 @@ impl PySR1Connections {
}
/// 通过父子双方 id 获取连接
///
/// 保险期间, 我还是返回一个 Vec
/// 保险起见, 我还是返回一个 Vec
///
/// 万一真有 双/多 连接呢
fn search_by_both_id(&self, parent_id: IdType, child_id: IdType) -> Vec<RawConnectionData> {

View File

@ -386,6 +386,7 @@ impl RawPartList {
Ok(part_list)
}
#[allow(unused)]
pub fn list_print(&self) {
for part_data in self.part_types.iter() {
println!("{:?}\n", part_data);

View File

@ -269,6 +269,7 @@ impl RawShip {
}
}
#[allow(unused)]
pub fn save(&self, file_name: String) -> Result<()> {
let part_list_file = to_string(self)?;
print!("{:?}", part_list_file);