create meta bp only if it will reduce the bp count

develop
myk002 2022-10-12 17:49:37 -07:00
parent c52138b168
commit b4986aad97
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
1 changed files with 10 additions and 3 deletions

@ -1285,7 +1285,7 @@ static void add_processor(vector<blueprint_processor> &processors,
static bool do_transform(color_ostream &out, static bool do_transform(color_ostream &out,
const df::coord &start, const df::coord &end, const df::coord &start, const df::coord &end,
const blueprint_options &opts, blueprint_options &opts,
vector<string> &filenames) { vector<string> &filenames) {
// empty map instances to pass to emplace() below // empty map instances to pass to emplace() below
static const bp_area EMPTY_AREA; static const bp_area EMPTY_AREA;
@ -1358,17 +1358,24 @@ static bool do_transform(color_ostream &out,
} }
} }
std::map<string, ofstream*> output_files;
std::vector<string> meta_phases; std::vector<string> meta_phases;
for (blueprint_processor &processor : processors) { for (blueprint_processor &processor : processors) {
if (processor.mapdata.empty() && !processor.force_create) if (processor.mapdata.empty() && !processor.force_create)
continue; continue;
if (is_meta_phase(out, opts, processor.phase)) if (is_meta_phase(out, opts, processor.phase))
meta_phases.push_back(processor.phase); meta_phases.push_back(processor.phase);
}
if (meta_phases.size() <= 1)
opts.nometa = true;
std::map<string, ofstream*> output_files;
for (blueprint_processor &processor : processors) {
if (processor.mapdata.empty() && !processor.force_create)
continue;
if (!write_blueprint(out, output_files, opts, processor, pretty)) if (!write_blueprint(out, output_files, opts, processor, pretty))
break; break;
} }
if (meta_phases.size()) { if (!opts.nometa) {
write_meta_blueprint(out, output_files, opts, meta_phases); write_meta_blueprint(out, output_files, opts, meta_phases);
} }