summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-08-16 15:04:07 +0200
committermetamuffin <metamuffin@disroot.org>2024-08-16 15:04:07 +0200
commit81ba02e8880765148724bfb68d24cfea175805a2 (patch)
tree2f7e193954af14e7a19a17b9ff00943aeae6912f /server/src
parent5ebc6a33e09641b5234122fb19d8e7a32cdf2011 (diff)
downloadhurrycurry-81ba02e8880765148724bfb68d24cfea175805a2.tar
hurrycurry-81ba02e8880765148724bfb68d24cfea175805a2.tar.bz2
hurrycurry-81ba02e8880765148724bfb68d24cfea175805a2.tar.zst
show demand in graph again
Diffstat (limited to 'server/src')
-rw-r--r--server/src/bin/graph.rs43
1 files changed, 21 insertions, 22 deletions
diff --git a/server/src/bin/graph.rs b/server/src/bin/graph.rs
index c16bfe2d..7019de9c 100644
--- a/server/src/bin/graph.rs
+++ b/server/src/bin/graph.rs
@@ -16,7 +16,7 @@
*/
use anyhow::{anyhow, Result};
-use hurrycurry_protocol::{ItemIndex, Recipe, RecipeIndex};
+use hurrycurry_protocol::{Demand, ItemIndex, Recipe, RecipeIndex};
use hurrycurry_server::data::DataIndex;
#[tokio::main]
@@ -30,7 +30,7 @@ async fn main() -> Result<()> {
.nth(1)
.ok_or(anyhow!("first arg should be recipe set name"))?;
- let (data, _, _) = index.generate(format!("sushibar-{rn}")).await?;
+ let (data, _, _) = index.generate(format!("5star-{rn}")).await?;
for i in 0..data.item_names.len() {
println!("i{i} [label=\"{}\"]", data.item_name(ItemIndex(i)))
@@ -57,26 +57,25 @@ async fn main() -> Result<()> {
}
}
- // TODO
- // for (
- // di,
- // Demand {
- // duration,
- // from: ItemIndex(from),
- // to,
- // points,
- // },
- // ) in data.demands.iter().enumerate()
- // {
- // let color = "#c4422b";
- // println!(
- // "d{di} [label=\"Demand\\ntakes {duration}s\\n{points} points\" shape=box color={color:?} fillcolor={color:?} style=filled]",
- // );
- // println!("i{from} -> d{di}");
- // if let Some(ItemIndex(to)) = to {
- // println!("d{di} -> i{to}");
- // }
- // }
+ for (
+ di,
+ Demand {
+ duration,
+ input: ItemIndex(input),
+ output,
+ points,
+ },
+ ) in data.demands.iter().enumerate()
+ {
+ let color = "#c4422b";
+ println!(
+ "d{di} [label=\"Demand\\ntakes {duration}s\\n{points} points\" shape=box color={color:?} fillcolor={color:?} style=filled]",
+ );
+ println!("i{input} -> d{di}");
+ if let Some(ItemIndex(output)) = output {
+ println!("d{di} -> i{output}");
+ }
+ }
println!("}}");
Ok(())