mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-20 03:54:47 +00:00
faster get_side hard case
This commit is contained in:
parent
0d60ff6bdc
commit
40792a3aa1
14
rulegen.cpp
14
rulegen.cpp
@ -852,10 +852,16 @@ int get_side(twalker what) {
|
||||
debuglist = {what, to_what, wl, wr};
|
||||
throw rulegen_failure("xsidefreeze");
|
||||
}
|
||||
treewalk(wl, -1);
|
||||
treewalk(wr, +1);
|
||||
if(wl == to_what) return sidecache[what] = +1;
|
||||
if(wr == to_what) return sidecache[what] = -1;
|
||||
bool gl = wl.at->dist <= wr.at->dist;
|
||||
bool gr = wl.at->dist >= wr.at->dist;
|
||||
if(gl) {
|
||||
treewalk(wl, -1);
|
||||
if(wl == to_what) return sidecache[what] = +1;
|
||||
}
|
||||
if(gr) {
|
||||
treewalk(wr, +1);
|
||||
if(wr == to_what) return sidecache[what] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user