1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-18 15:00:26 +00:00

rulegen3:: w_ignore_transducer_dist flag

This commit is contained in:
Zeno Rogue 2022-08-18 18:00:10 +02:00
parent d571d2f1cb
commit f866f66582

View File

@ -381,6 +381,13 @@ void error_found(vstate& vs) {
} }
void check(vstate& vs) { void check(vstate& vs) {
dynamicval<int> vst(vs.steps, vs.steps + 1);
if(vs.steps >= 5000) {
println(hlog, "check does not seem to terminate: ", isize(vs.vcells), " cells, ", isize(vs.movestack), " stack");
error_found(vs);
throw rulegen_retry("check does not terminate");
}
if(check_debug >= 3) println(hlog, "vcells=", isize(vs.vcells), " pos=", vs.current_pos, " stack=", vs.movestack, " rpath=", vs.rpath); if(check_debug >= 3) println(hlog, "vcells=", isize(vs.vcells), " pos=", vs.current_pos, " stack=", vs.movestack, " rpath=", vs.rpath);
indenter ind(check_debug >= 3 ? 2 : 0); indenter ind(check_debug >= 3 ? 2 : 0);
@ -403,7 +410,7 @@ void check(vstate& vs) {
/* connection already exists */ /* connection already exists */
if(c.adj[p.first] != -1) { if(c.adj[p.first] != -1) {
int dif = (rule == DIR_PARENT) ? -1 : 1; int dif = (rule == DIR_PARENT) ? -1 : 1;
if(p.second != dif && p.second != MYSTERY) { if(p.second != dif && p.second != MYSTERY && !(flags & w_ignore_transducer_dist)) {
if(error_debug >= 1) if(error_debug >= 1)
println(hlog, "error: connection ", p.first, " at ", vs.current_pos, " has distance ", dif, " but ", p.second, " is expected"); println(hlog, "error: connection ", p.first, " at ", vs.current_pos, " has distance ", dif, " but ", p.second, " is expected");
dist_errors++; dist_errors++;
@ -458,7 +465,7 @@ void check(vstate& vs) {
else { else {
vs.recursions.push_back({vs.current_pos, p}); vs.recursions.push_back({vs.current_pos, p});
auto& v = rev_roadsign_id[rule]; auto& v = rev_roadsign_id[rule];
if(v.back() != p.second + 1 && p.second != MYSTERY) { if(v.back() != p.second + 1 && p.second != MYSTERY && !(flags & w_ignore_transducer_dist)) {
if(error_debug >= 1) println(hlog, "error: side connection"); if(error_debug >= 1) println(hlog, "error: side connection");
side_errors++; side_errors++;
error_found(vs); error_found(vs);
@ -498,7 +505,7 @@ void check_det(vstate& vs) {
if(c.adj[p.first] != -1) { if(c.adj[p.first] != -1) {
vs.current_pos = c.adj[p.first]; vs.current_pos = c.adj[p.first];
int dif = (rule == DIR_PARENT) ? -1 : 1; int dif = (rule == DIR_PARENT) ? -1 : 1;
if(p.second != dif && p.second != MYSTERY) { if(p.second != dif && p.second != MYSTERY && !(flags & w_ignore_transducer_dist)) {
error_found(vs); error_found(vs);
return; return;
} }
@ -525,7 +532,7 @@ void check_det(vstate& vs) {
/* side connection */ /* side connection */
else { else {
auto& v = rev_roadsign_id[rule]; auto& v = rev_roadsign_id[rule];
if(v.back() != p.second + 1 && p.second != MYSTERY) { if(v.back() != p.second + 1 && p.second != MYSTERY && !(flags & w_ignore_transducer_dist)) {
error_found(vs); error_found(vs);
return; return;
} }