From c25213d52a7a9d82338feef40c17a44cf3e5d551 Mon Sep 17 00:00:00 2001 From: porkbrain Date: Thu, 30 May 2024 11:28:06 +0200 Subject: [PATCH] Delv tools should not crash without graphviz installed (#181) --- main_game_lib/src/top_down/layout/map_maker.rs | 12 ++++++++++-- wiki/src/SUMMARY.md | 1 + wiki/src/devtools_map_maker.md | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 wiki/src/devtools_map_maker.md diff --git a/main_game_lib/src/top_down/layout/map_maker.rs b/main_game_lib/src/top_down/layout/map_maker.rs index ffdf62ba..f53e5a93 100644 --- a/main_game_lib/src/top_down/layout/map_maker.rs +++ b/main_game_lib/src/top_down/layout/map_maker.rs @@ -398,8 +398,16 @@ fn export_map( let dot_g = g.as_dotgraph(T::name()); info!("Graphviz dot graph: \n{}", dot_g.as_dot()); - let svg = dot_g.into_svg().unwrap(); - fs::write(format!("{scene_path}/docs/tile-graph.svg"), svg).unwrap(); + + match dot_g.into_svg() { + Ok(svg) => { + fs::write(format!("{scene_path}/docs/tile-graph.svg"), svg) + .unwrap(); + } + Err(e) => { + error!("Could not generate svg from dot graph: {e}"); + } + } } impl TileKind { diff --git a/wiki/src/SUMMARY.md b/wiki/src/SUMMARY.md index 155d5b79..628dd7ba 100644 --- a/wiki/src/SUMMARY.md +++ b/wiki/src/SUMMARY.md @@ -11,3 +11,4 @@ - [Devtools](devtools.md) - [Godot](devtools_godot.md) - [Dialog](devtools_dialog.md) + - [Map maker](devtools_map_maker.md) diff --git a/wiki/src/devtools_map_maker.md b/wiki/src/devtools_map_maker.md new file mode 100644 index 00000000..f09198f4 --- /dev/null +++ b/wiki/src/devtools_map_maker.md @@ -0,0 +1,5 @@ +TODO + +To store the edit, you can press the "Store button". +Ideally, you would have [`graphviz`] installed. +We use it to store an SVG file that shows connections between zones for debug purposes.