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

rulegen:: debug get_parent_dir

This commit is contained in:
Zeno Rogue 2021-08-17 14:20:54 +02:00
parent dd79a01f02
commit 43aec99cd8

View File

@ -41,6 +41,8 @@ const int MYSTERY = 31999;
const int MYSTERY_DIST = 31998; const int MYSTERY_DIST = 31998;
#endif #endif
EX bool parent_debug;
/* === tcell === */ /* === tcell === */
/** number of tcells created */ /** number of tcells created */
@ -563,9 +565,12 @@ EX int get_parent_dir(tcell *c) {
for(int i=0; i<n; i++) { for(int i=0; i<n; i++) {
tcell *c1 = c->cmove(i); tcell *c1 = c->cmove(i);
be_solid(c1); be_solid(c1);
if(parent_debug) println(hlog, "direction = ", i, " distance = ", c1->dist);
if(c1->dist < d) nearer.push_back(i); if(c1->dist < d) nearer.push_back(i);
} }
if(parent_debug) println(hlog, "nearer = ", nearer, " n=", n, " k=", k);
auto oc = c; auto oc = c;
ufindc(c); if(d != c->dist || oc != c) { ufindc(c); if(d != c->dist || oc != c) {
return get_parent_dir(c); return get_parent_dir(c);
@ -577,6 +582,8 @@ EX int get_parent_dir(tcell *c) {
if(beats(ne, bestd)) if(beats(ne, bestd))
bestd = ne; bestd = ne;
if(parent_debug) for(auto ne: nearer) println(hlog, "beats", tie(ne, bestd), " = ", beats(ne, bestd));
for(auto ne: nearer) for(auto ne: nearer)
if(ne != bestd && beats(ne, bestd)) { if(ne != bestd && beats(ne, bestd)) {