Clean up code (fix warnings)
This commit is contained in:
parent
642f815f9d
commit
8e268f7612
4 changed files with 12 additions and 24 deletions
|
|
@ -1,11 +1,10 @@
|
||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use factorio_blueprint::abstraction::{Blueprint, Entity};
|
use factorio_blueprint::abstraction::{Blueprint, Entity};
|
||||||
use factorio_core::{beltoptions::Beltspeed, prelude::*, visualize::Visualize};
|
use factorio_core::{beltoptions::Beltspeed, prelude::*, visualize::Visualize};
|
||||||
use factorio_layout::{Connection, Interface, LayoutInput, Layouter, MacroBlock};
|
use factorio_layout::{Connection, Interface, LayoutInput, Layouter, MacroBlock};
|
||||||
use factorio_pathfinding::Pathfinder;
|
use factorio_pathfinding::Pathfinder;
|
||||||
use rand::{Rng, SeedableRng, seq::IndexedRandom};
|
use rand::{Rng, SeedableRng};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
assembly::assembly_line_2_input,
|
assembly::assembly_line_2_input,
|
||||||
|
|
@ -256,7 +255,7 @@ pub fn generate_factory<L: Layouter, P: Pathfinder + Sync, R: Rng + SeedableRng
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Building::ExternalConnection => {
|
Building::ExternalConnection => {
|
||||||
let step = 1;
|
// let step = 1;
|
||||||
// static_input.extend((0..*inputs).map(|y| Interface {
|
// static_input.extend((0..*inputs).map(|y| Interface {
|
||||||
// offset: Position::new(
|
// offset: Position::new(
|
||||||
// -1,
|
// -1,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
use crate::{BlueprintEntity, BlueprintPosition};
|
||||||
use factorio_core::{
|
use factorio_core::{
|
||||||
aabb::AABB,
|
aabb::AABB,
|
||||||
beltoptions::Beltspeed,
|
beltoptions::Beltspeed,
|
||||||
|
|
@ -7,12 +8,7 @@ use factorio_core::{
|
||||||
quaterdirection::QuaterDirection,
|
quaterdirection::QuaterDirection,
|
||||||
visualize::{Color, Visualization},
|
visualize::{Color, Visualization},
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{collections::HashMap, sync::atomic::AtomicUsize};
|
||||||
collections::{HashMap, HashSet},
|
|
||||||
sync::atomic::AtomicUsize,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{BlueprintEntity, BlueprintPosition};
|
|
||||||
|
|
||||||
mod power_connection;
|
mod power_connection;
|
||||||
mod visualize;
|
mod visualize;
|
||||||
|
|
@ -386,7 +382,7 @@ impl Entity {
|
||||||
}
|
}
|
||||||
fn visualize(&self, v: &mut Visualization, offset: Position) {
|
fn visualize(&self, v: &mut Visualization, offset: Position) {
|
||||||
match &self.entity {
|
match &self.entity {
|
||||||
EntityType::Belt(beltspeed) => {
|
EntityType::Belt(_beltspeed) => {
|
||||||
v.add_symbol(
|
v.add_symbol(
|
||||||
(self.position - Position::new(1, 1)) / 2 + offset,
|
(self.position - Position::new(1, 1)) / 2 + offset,
|
||||||
factorio_core::visualize::Symbol::Arrow(self.direction.unwrap_dir()),
|
factorio_core::visualize::Symbol::Arrow(self.direction.unwrap_dir()),
|
||||||
|
|
@ -394,7 +390,7 @@ impl Entity {
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
EntityType::UndergroundBelt(beltspeed, underground_type) => match underground_type {
|
EntityType::UndergroundBelt(_beltspeed, underground_type) => match underground_type {
|
||||||
UndergroundType::Input => {
|
UndergroundType::Input => {
|
||||||
v.add_symbol(
|
v.add_symbol(
|
||||||
(self.position - Position::new(1, 1)) / 2 + offset,
|
(self.position - Position::new(1, 1)) / 2 + offset,
|
||||||
|
|
@ -412,7 +408,7 @@ impl Entity {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
EntityType::Splitter(beltspeed) => (),
|
EntityType::Splitter(_beltspeed) => (),
|
||||||
EntityType::ElectricPole(electric_pole_type) => match electric_pole_type {
|
EntityType::ElectricPole(electric_pole_type) => match electric_pole_type {
|
||||||
ElectricPoleType::Small => v.add_symbol(
|
ElectricPoleType::Small => v.add_symbol(
|
||||||
(self.position - Position::new(1, 1)) / 2 + offset,
|
(self.position - Position::new(1, 1)) / 2 + offset,
|
||||||
|
|
@ -447,13 +443,7 @@ impl Entity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
EntityType::Inserter {
|
_ => (),
|
||||||
inserter_type,
|
|
||||||
override_stack_size,
|
|
||||||
} => (),
|
|
||||||
EntityType::Production { name, recipe, size } => (),
|
|
||||||
EntityType::Rail { rail_type } => (),
|
|
||||||
EntityType::Unknown { name, size, misc } => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -627,7 +617,7 @@ impl Blueprint {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Placibility {
|
pub struct Placibility {
|
||||||
blocked: PositionMap<bool>,
|
blocked: PositionMap<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -637,7 +627,7 @@ impl Placibility {
|
||||||
for y in aabb.min().y..=aabb.max().y {
|
for y in aabb.min().y..=aabb.max().y {
|
||||||
for x in aabb.min().x..=aabb.max().x {
|
for x in aabb.min().x..=aabb.max().x {
|
||||||
if !self.blocked.get_aabb().contains_pos(Position::new(x, y))
|
if !self.blocked.get_aabb().contains_pos(Position::new(x, y))
|
||||||
|| self.blocked[Position::new(x, y)] == true
|
|| self.blocked[Position::new(x, y)]
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
use factorio_core::visualize::Visualize;
|
|
||||||
use factorio_graph::{
|
use factorio_graph::{
|
||||||
priority_queue::binary_heap::FastBinaryHeap,
|
priority_queue::binary_heap::FastBinaryHeap,
|
||||||
wheighted_graph::{WheightedGraph, steiner_tree},
|
wheighted_graph::{WheightedGraph, steiner_tree},
|
||||||
|
|
|
||||||
|
|
@ -38,5 +38,5 @@ fn main() {
|
||||||
|
|
||||||
let r = l.layout(&problem, &p, &mut rng);
|
let r = l.layout(&problem, &p, &mut rng);
|
||||||
|
|
||||||
// dbg!(r);
|
dbg!(r);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue