Resolve warnings
This commit is contained in:
parent
dfdeae5638
commit
b715c4ad06
18 changed files with 48 additions and 35 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -574,6 +574,7 @@ dependencies = [
|
|||
name = "factorio-core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap 4.5.26",
|
||||
"criterion",
|
||||
"image",
|
||||
"proptest",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use factorio_blueprint::{
|
||||
Blueprint, BlueprintEntity, BlueprintPosition, belt::convert_to_blueprint, misc::Beltspeed,
|
||||
Blueprint, BlueprintEntity, BlueprintPosition, belt::convert_to_blueprint,
|
||||
};
|
||||
use factorio_core::{pathfield::PathField, prelude::*};
|
||||
use factorio_core::{beltoptions::Beltspeed, pathfield::PathField, prelude::*};
|
||||
|
||||
pub fn generate_4_lane_balancer() -> Blueprint {
|
||||
let mut e = vec![
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
use clap::{Parser, Subcommand};
|
||||
use factorio_blueprint::{
|
||||
BlueprintBook, BlueprintBookEntry, BlueprintString, encode,
|
||||
misc::{Beltspeed, Belttype},
|
||||
};
|
||||
use factorio_blueprint::{BlueprintBook, BlueprintBookEntry, BlueprintString, encode};
|
||||
use factorio_blueprint_generator::station::basic_unload_station;
|
||||
use factorio_core::beltoptions::{Beltspeed, Belttype};
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use factorio_blueprint::{
|
||||
Blueprint, BlueprintEntity, BlueprintPosition,
|
||||
misc::{Beltspeed, Belttype},
|
||||
};
|
||||
use factorio_blueprint::{Blueprint, BlueprintEntity, BlueprintPosition};
|
||||
use factorio_core::beltoptions::{Beltspeed, Belttype};
|
||||
|
||||
pub fn station_unload(
|
||||
length: usize,
|
||||
locomotives: usize,
|
||||
unloader: &Vec<BlueprintEntity>,
|
||||
unloader: &[BlueprintEntity],
|
||||
beltspeed: Beltspeed,
|
||||
outputs: usize,
|
||||
output_x: f64,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
use factorio_core::{pathfield::PathField, prelude::*};
|
||||
|
||||
use crate::misc::Beltspeed;
|
||||
use factorio_core::{beltoptions::Beltspeed, pathfield::PathField, prelude::*};
|
||||
|
||||
use super::{BlueprintEntity, BlueprintPosition};
|
||||
|
||||
|
|
|
|||
19
factorio-blueprint/src/bin/decode_base64.rs
Normal file
19
factorio-blueprint/src/bin/decode_base64.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use std::io::{Cursor, Read};
|
||||
|
||||
use base64::{Engine, prelude::BASE64_STANDARD};
|
||||
|
||||
fn main() {
|
||||
let i = std::fs::read_to_string("test").unwrap();
|
||||
|
||||
let u = BASE64_STANDARD.decode(i.trim().as_bytes()).unwrap();
|
||||
|
||||
dbg!(&u);
|
||||
|
||||
let mut o = String::new();
|
||||
|
||||
flate2::bufread::ZlibDecoder::new(Cursor::new(u))
|
||||
.read_to_string(&mut o)
|
||||
.unwrap();
|
||||
|
||||
dbg!(o);
|
||||
}
|
||||
|
|
@ -4,10 +4,8 @@ use base64::prelude::BASE64_STANDARD;
|
|||
use std::io::Cursor;
|
||||
use std::io::Read;
|
||||
|
||||
pub mod misc;
|
||||
|
||||
pub mod structs;
|
||||
pub mod belt;
|
||||
pub mod structs;
|
||||
|
||||
pub use structs::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use bon::Builder;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ edition = "2024"
|
|||
criterion = "0.3"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.5.26", features = ["derive"] }
|
||||
image = "0.25.5"
|
||||
proptest = "1.5.0"
|
||||
proptest-derive = "0.5.0"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
pub mod aabb;
|
||||
pub mod beltoptions;
|
||||
pub mod block;
|
||||
pub mod color;
|
||||
pub mod direction;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
use crate::{belt_finding::brute_force::BruteforceBuilder, misc::Map};
|
||||
use factorio_blueprint::{belt::convert_to_blueprint, misc::Beltspeed, BlueprintEntity};
|
||||
use factorio_core::{pathfield::PathField, prelude::*, visualize::Visualize};
|
||||
use factorio_blueprint::{belt::convert_to_blueprint, BlueprintEntity};
|
||||
use factorio_core::{
|
||||
beltoptions::Beltspeed, pathfield::PathField, prelude::*, visualize::Visualize,
|
||||
};
|
||||
use std::{
|
||||
ops::RangeInclusive,
|
||||
time::{Duration, Instant},
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ struct MapInternal<'a> {
|
|||
end: (Position, Direction),
|
||||
}
|
||||
|
||||
impl<'a> WheightedGraph for MapInternal<'a> {
|
||||
impl WheightedGraph for MapInternal<'_> {
|
||||
type Node = (Position, Direction);
|
||||
|
||||
fn edge(&self, node: &Self::Node, num: usize) -> Option<(Self::Node, f64)> {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ fn output_blueprint(conflict: &ConflictAvoidance) {
|
|||
let bp = BlueprintString::Blueprint(
|
||||
Blueprint::builder()
|
||||
.entities(belts)
|
||||
.label(format!("test"))
|
||||
.label("solution".to_string())
|
||||
.build(),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ fn main() {
|
|||
.iter()
|
||||
.map(|f| {
|
||||
let f = File::open(f).unwrap();
|
||||
let mut p = serde_json::from_reader::<File, Problem>(f).unwrap();
|
||||
let p = serde_json::from_reader::<File, Problem>(f).unwrap();
|
||||
|
||||
let c = ConflictAvoidance::new(&p);
|
||||
c.visualize()
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b, G> Iterator for WheightedGraphEdgeIter<'a, 'b, G>
|
||||
impl<G> Iterator for WheightedGraphEdgeIter<'_, '_, G>
|
||||
where
|
||||
G: WheightedGraph,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
use crate::belt_finding::conflict_avoidance::ConflictAvoidance;
|
||||
use factorio_core::pathfield::PathField;
|
||||
use factorio_core::prelude::*;
|
||||
use factorio_core::visualize::{image_grid, Color, Symbol, Visualization, Visualize};
|
||||
use factorio_core::{
|
||||
pathfield::PathField,
|
||||
prelude::*,
|
||||
visualize::{image_grid, Color, Symbol, Visualization, Visualize},
|
||||
};
|
||||
use rand::{seq::SliceRandom, Rng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::sync::atomic::AtomicU32;
|
||||
use std::time::Instant;
|
||||
use std::{sync::atomic::AtomicU32, time::Instant};
|
||||
|
||||
static OUTFILEINDEX: AtomicU32 = AtomicU32::new(0);
|
||||
|
||||
|
|
@ -240,7 +241,7 @@ impl<'a> PathLayout<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Visualize for PathLayout<'a> {
|
||||
impl Visualize for PathLayout<'_> {
|
||||
fn visualize(&self) -> factorio_core::visualize::Visualization {
|
||||
let mut v = self.layout.visualize();
|
||||
let offset = self.layout.blocks.len();
|
||||
|
|
@ -525,7 +526,7 @@ impl Layout<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Visualize for Layout<'a> {
|
||||
impl Visualize for Layout<'_> {
|
||||
fn visualize(&self) -> Visualization {
|
||||
let mut v = Visualization::new(self.problem.size);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub struct FibonacciHeap<I> {
|
|||
impl<I: std::fmt::Debug> std::fmt::Debug for FibonacciHeap<I> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
struct PrintData<'a, I>(&'a Vec<Option<Node<I>>>);
|
||||
impl<'a, I: Debug> Debug for PrintData<'a, I> {
|
||||
impl<I: Debug> Debug for PrintData<'_, I> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_map()
|
||||
.entries(self.0.iter().enumerate().filter_map(|d| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue