diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-20 02:27:57 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-23 19:21:49 +0200 |
commit | 934913b03957e2c11b269c6ff6f2e9441eceee0a (patch) | |
tree | 2284c236b561cbea97958cd9ddda479c031c918c /server/src | |
parent | c78665e4fd83a64a67a6747ec9429c74a3d4a466 (diff) | |
download | hurrycurry-934913b03957e2c11b269c6ff6f2e9441eceee0a.tar hurrycurry-934913b03957e2c11b269c6ff6f2e9441eceee0a.tar.bz2 hurrycurry-934913b03957e2c11b269c6ff6f2e9441eceee0a.tar.zst |
include demands in graph
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/bin/graph.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/server/src/bin/graph.rs b/server/src/bin/graph.rs index 9ff6f973..c52b1400 100644 --- a/server/src/bin/graph.rs +++ b/server/src/bin/graph.rs @@ -13,13 +13,13 @@ fn main() { println!("i{i} [label=\"{}\"]", data.item_name(ItemIndex(i))) } for (RecipeIndex(ri), recipe) in data.recipes() { + let (kind, color) = match recipe { + Recipe::Passive { .. } => ("Passive", "#2bc493"), + Recipe::Active { .. } => ("Active", "#47c42b"), + Recipe::Instant { .. } => ("Instant", "#5452d8"), + }; println!( - "r{ri} [label=\"{}\\non {}\" shape=box color=gray fillcolor=gray style=filled]", - match recipe { - Recipe::Passive { .. } => "Passive", - Recipe::Active { .. } => "Active", - Recipe::Instant { .. } => "Instant", - }, + "r{ri} [label=\"{kind}\\non {}\" shape=box color={color:?} fillcolor={color:?} style=filled]", if let Some(tile) = recipe.tile() { data.tile_name(tile) } else { @@ -34,5 +34,15 @@ fn main() { } } + for (di, d) 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 + ); + println!("i{} -> d{di}", d.from.0); + println!("d{di} -> i{}", d.to.0); + } + println!("}}"); } |