1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-10 15:59:53 +00:00

rulegen:: distance warnings

This commit is contained in:
Zeno Rogue 2021-12-28 11:35:37 +01:00
parent 775a087624
commit 872ce9d389

View File

@ -429,6 +429,12 @@ int solid_errors;
/** total solid errors */ /** total solid errors */
EX int all_solid_errors; EX int all_solid_errors;
/** the next distance to warn about */
EX int next_distance_warning;
/** current distance warnings */
EX int distance_warnings;
#if HDR #if HDR
struct shortcut { struct shortcut {
vector<int> pre; vector<int> pre;
@ -634,6 +640,10 @@ EX void fix_distances(tcell *c) {
remove_parentdir(tgt); remove_parentdir(tgt);
tgt_d = new_d; tgt_d = new_d;
tgt->any_nearer = tgtw.spin; tgt->any_nearer = tgtw.spin;
if(new_d >= next_distance_warning) {
if(new_d >= MYSTERY-1) throw rulegen_failure("distance limit exceeded");
next_distance_warning = new_d; distance_warnings++;
}
return true; return true;
} }
return false; return false;
@ -677,6 +687,12 @@ EX void handle_distance_errors() {
solid_errors_list = {}; solid_errors_list = {};
throw hr_solid_error(); throw hr_solid_error();
} }
b = distance_warnings;
distance_warnings = 0;
if(b && !no_errors) {
clean_parents();
throw rulegen_retry("distance exceeded");
}
} }
/** make sure that we know c->dist */ /** make sure that we know c->dist */
@ -1927,7 +1943,9 @@ EX void generate_rules() {
analyzers.clear(); analyzers.clear();
important.clear(); important.clear();
treestates.clear(); treestates.clear();
hard_parents = single_live_branches = double_live_branches = all_solid_errors = 0; hard_parents = single_live_branches = double_live_branches = all_solid_errors = solid_errors = 0;
next_distance_warning = 30000;
int NS = isize(arb::current.shapes); int NS = isize(arb::current.shapes);
shortcuts.resize(NS); shortcuts.resize(NS);