diff --git a/debug.cpp b/debug.cpp index 0a5e7144..437079d2 100644 --- a/debug.cpp +++ b/debug.cpp @@ -516,6 +516,16 @@ void modalDebug(cell *c) { quitmainloop = false; } +void test_distances(int max) { + int ok = 0, bad = 0; + celllister cl(cwt.at, max, 100000, NULL); + for(cell *c: cl.lst) { + bool is_ok = cl.getdist(c) == celldistance(c, cwt.at); + if(is_ok) ok++; else bad++; + } + println(hlog, "ok=", ok, " bad=", bad); + } + void raiseBuggyGeneration(cell *c, const char *s) { printf("procgen error (%p): %s\n", c, s); @@ -601,6 +611,9 @@ int read_cheat_args() { PHASE(3) cheat(); shift(); ambushval = argi(); } + else if(argis("-testdistances")) { + PHASE(3); shift(); test_distances(argi()); + } else if(argis("-M")) { PHASE(3) cheat(); shift(); eMonster m = readMonster(args());