summaryrefslogtreecommitdiff
path: root/server/src/bin/graph.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/bin/graph.rs')
-rw-r--r--server/src/bin/graph.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/server/src/bin/graph.rs b/server/src/bin/graph.rs
index deae2034..024512c6 100644
--- a/server/src/bin/graph.rs
+++ b/server/src/bin/graph.rs
@@ -17,7 +17,7 @@
*/
use anyhow::{anyhow, Result};
use undercooked::{
- data::DataIndex,
+ data::{DataIndex, Demand},
interaction::Recipe,
protocol::{ItemIndex, RecipeIndex},
};
@@ -59,14 +59,24 @@ fn main() -> Result<()> {
}
}
- for (di, d) in data.demands.iter().enumerate() {
+ for (
+ di,
+ Demand {
+ duration,
+ from: ItemIndex(from),
+ to,
+ points,
+ },
+ ) in data.demands.iter().enumerate()
+ {
let color = "#c4422b";
println!(
- "d{di} [label=\"Demand\\ntakes {}s\" shape=box color={color:?} fillcolor={color:?} style=filled]",
- d.duration
+ "d{di} [label=\"Demand\\ntakes {duration}s\\n{points} points\" shape=box color={color:?} fillcolor={color:?} style=filled]",
);
- println!("i{} -> d{di}", d.from.0);
- println!("d{di} -> i{}", d.to.0);
+ println!("i{from} -> d{di}");
+ if let Some(ItemIndex(to)) = to {
+ println!("d{di} -> i{to}");
+ }
}
println!("}}");