mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 23:50:27 +00:00
rulegen:: distance warnings
This commit is contained in:
parent
775a087624
commit
872ce9d389
20
rulegen.cpp
20
rulegen.cpp
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user