distance tester added

This commit is contained in:
Zeno Rogue 2019-03-10 14:34:42 +01:00
parent cf57e9fc81
commit 8028392b70
1 changed files with 13 additions and 0 deletions

View File

@ -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());