1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-24 02:17:40 +00:00

determinePush now accepts movei instead of c

This commit is contained in:
Zeno Rogue
2021-05-29 15:44:07 +02:00
parent b0333a6ab7
commit d7e2b491ac
5 changed files with 16 additions and 11 deletions

View File

@@ -935,17 +935,19 @@ movei determinePush(cellwalker who, int subdir, const T& valid) {
auto rd = reverse_directions(push.at, push.spin);
for(int i: rd) {
push.spin = i;
if(valid(push.cpeek())) return movei(push.at, push.spin);
movei mi = movei(push.at, i);
if(valid(mi)) return mi;
}
return movei(c2, NO_SPACE);
}
int pd = push.at->type/2;
push += pd * -subdir;
movei mi(push.at, push.spin);
push += wstep;
if(valid(push.at)) return movei(c2, (push+wstep).spin);
if(valid(mi)) return mi;
if(c2->type&1) {
push = push + wstep - subdir + wstep;
if(valid(push.at)) return movei(c2, (push+wstep).spin);
if(valid(mi)) return mi;
}
if(gravityLevelDiff(push.at, c2) < 0) {
push = push + wstep + 1 + wstep;
@@ -955,7 +957,8 @@ movei determinePush(cellwalker who, int subdir, const T& valid) {
if(gravityLevelDiff(push.at, c2) < 0) {
push = push + wstep + 1 + wstep;
}
if(valid(push.at)) return movei(c2, (push+wstep).spin);
movei mi = movei(c2, (push+wstep).spin);
if(valid(mi)) return mi;
}
return movei(c2, NO_SPACE);
}