From b4986aad97f73c6f961874d6543001af1f9e08cf Mon Sep 17 00:00:00 2001 From: myk002 Date: Wed, 12 Oct 2022 17:49:37 -0700 Subject: [PATCH] create meta bp only if it will reduce the bp count --- plugins/blueprint.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins/blueprint.cpp b/plugins/blueprint.cpp index b08f4d074..361aaa1ca 100644 --- a/plugins/blueprint.cpp +++ b/plugins/blueprint.cpp @@ -1285,7 +1285,7 @@ static void add_processor(vector &processors, static bool do_transform(color_ostream &out, const df::coord &start, const df::coord &end, - const blueprint_options &opts, + blueprint_options &opts, vector &filenames) { // empty map instances to pass to emplace() below static const bp_area EMPTY_AREA; @@ -1358,17 +1358,24 @@ static bool do_transform(color_ostream &out, } } - std::map output_files; std::vector meta_phases; for (blueprint_processor &processor : processors) { if (processor.mapdata.empty() && !processor.force_create) continue; if (is_meta_phase(out, opts, processor.phase)) meta_phases.push_back(processor.phase); + } + if (meta_phases.size() <= 1) + opts.nometa = true; + + std::map output_files; + for (blueprint_processor &processor : processors) { + if (processor.mapdata.empty() && !processor.force_create) + continue; if (!write_blueprint(out, output_files, opts, processor, pretty)) break; } - if (meta_phases.size()) { + if (!opts.nometa) { write_meta_blueprint(out, output_files, opts, meta_phases); }