1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-18 11:19:59 +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;
#endif
EX bool parent_debug;
/* === tcell === */
/** number of tcells created */
@ -563,9 +565,12 @@ EX int get_parent_dir(tcell *c) {
for(int i=0; i<n; i++) {
tcell *c1 = c->cmove(i);
be_solid(c1);
if(parent_debug) println(hlog, "direction = ", i, " distance = ", c1->dist);
if(c1->dist < d) nearer.push_back(i);
}
if(parent_debug) println(hlog, "nearer = ", nearer, " n=", n, " k=", k);
auto oc = c;
ufindc(c); if(d != c->dist || oc != c) {
return get_parent_dir(c);
@ -577,6 +582,8 @@ EX int get_parent_dir(tcell *c) {
if(beats(ne, bestd))
bestd = ne;
if(parent_debug) for(auto ne: nearer) println(hlog, "beats", tie(ne, bestd), " = ", beats(ne, bestd));
for(auto ne: nearer)
if(ne != bestd && beats(ne, bestd)) {